StringSimilarity for ContainsText

Please discuss general Delphi programming topics here.

StringSimilarity for ContainsText

Postby PaPaVero » October 16th, 2018, 7:42 pm


I have read your article "How to match two strings approximately" on ... 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'
Posts: 3
Joined: January 30th, 2010, 11:59 pm

Re: StringSimilarity for ContainsText

Postby Kambiz » November 17th, 2018, 12:23 pm

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.
User avatar
Posts: 2430
Joined: March 7th, 2003, 7:10 pm

Return to Delphi Programming

Who is online

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