home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3095 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: soap.news.pipex.net!pipex!usenet
  2. From: m.hendry@dial.pipex.com (Mathew Hendry)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: "Fuzzy" string searching
  5. Date: Sun, 11 Feb 96 00:31:40
  6. Organization: Private node.
  7. Distribution: world
  8. Message-ID: <19960211.4F6A38.F17@am141.du.pipex.com>
  9. References: <311cf85e@beachyhd.demon.co.uk>
  10. NNTP-Posting-Host: am141.du.pipex.com
  11. X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
  12.  
  13. Adam@beachyhd.demon.co.uk wrote:
  14. : I wish to write a function that will perform a 'fuzzy' search for one string
  15. : within another.
  16. : The most simple level of search is to just check if the 'search' string is in
  17. : the 'source' string. So if I'm searching for 'test' in the string 'this is a
  18. : test', it will obviously be found.
  19. : But I need to go further than that, and provide more intelligent searching. If
  20. : I search for the word 'recent' in the string 'currency/recency', I still want a
  21. : very close match to be indicated.
  22. : This becomes more difficult when searching (for example) for the word
  23. : 'workload' in the string 'high work-load'. Never more than 4 characters match
  24. : at any time, though obviously this should provide a very close match.
  25. : The idea is similar to that used in spell-checkers.. When the program doesn't
  26. : recognise your word, it manages to search its dictionary for things it thinks
  27. : are very close.
  28. : Does anyone have any suggestions or code that might allow me to perform this
  29. : sort of search? Ideally a function that I pass two strings to, and which
  30. : returns a score value within a given range (say, 0 to 100)..?
  31.  
  32. Have a look at:
  33. AGrep204.lha       util/sys    35K 155+Fastest available Grep (>1MB, >=2.0)
  34.  
  35. which is a version of grep supporting inexact matching of substrings. When
  36. run, you are able to specify a number of character alterations / insertions /
  37. deletions to the search pattern when testing for a match.
  38.  
  39. Source is not included in that archive, but I believe there are pointers to
  40. public source in the archive.
  41.  
  42. As a side effect, AGrep is also the fastest grep around (someone based their
  43. PhD thesis around the searching algorithms used in it...).
  44.  
  45. -- Mat.
  46.