0
$\begingroup$

Let's say that I want to classify whether a document is a legal document or not. I have a list of keywords that will be presented only in legal documents.

What is the proper way or algorithm to calculate probability based on this list?

$\endgroup$
0
$\begingroup$

Maybe this is what you are looking for: https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm

Basically you would

  1. build and store a finite-state machine that resembles a trie with additional links between the various internal nodes using the given keywords.
  2. for the candidate document, go through it with the above finite-state machine.

Then based on the result

  1. If there is any match, then the document is valid.
  2. Otherwise it is possible that the document is invalid. However, in terms of the probability, I do not have any good idea yet.
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.