StringSimilarity for ContainsText

Please discuss general Delphi programming topics here.

StringSimilarity for ContainsText

Hello!

I have read your article "How to match two strings approximately" on http://www.delphiarea.com/articles/how- ... oximately/

So I wonder how could I compare the probability of a string (e.g. 'Path Copy Copy 11.0.2') is contained in 2 strings of approximately 500 characters, where:
• the first 500-char-string (A) contains the string 'PathCopyCopySettings' and
• the second 500-char-string (B) does not contain the string 'PathCopyCopySettings'
PaPaVero
Member

Posts: 3
Joined: January 30th, 2010, 11:59 pm

Re: StringSimilarity for ContainsText

One way is to split your string into words, then calculate how likely your search word is one of the words in the string.

$P(word \in sentence) = \max(P(word = w_i, w_i \in sentence))$
If your search phrase is not a single word, then you have to do the above procedure on n-gram of your string, where N is the number of words in your search phrase.
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Who is online

Users browsing this forum: Bing [Bot] and 3 guests