home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / gnu / emacs / help / 4035 < prev    next >
Encoding:
Text File  |  1992-09-08  |  2.1 KB  |  58 lines

  1. Path: sparky!uunet!cs.utexas.edu!sun-barr!sh.wide!wnoc-tyo-news!ccut!news.u-tokyo.ac.jp!kappa!dave
  2. From: dave@appi.iis.u-tokyo.ac.jp (David Wuertele)
  3. Newsgroups: gnu.emacs.help
  4. Subject: Fuzzy Text Comparison Code?
  5. Message-ID: <DAVE.92Sep8190422@appi.iis.u-tokyo.ac.jp>
  6. Date: 8 Sep 92 10:04:22 GMT
  7. Sender: news@kappa.iis.u-tokyo.ac.jp
  8. Distribution: gnu
  9. Organization: Institute of Industrial Science, University of tokyo.
  10. Lines: 46
  11.  
  12. Hi, I'm writing a vocabulary learning application in elisp.  It's working
  13. great and soon I will post it to gnu.emacs.sources.  There is one
  14. function, however, that I would like to improve upon, and maybe you gurus
  15. out there can give me some suggestions.
  16.  
  17. The function I want to re-write is defined something like this:
  18.  
  19.     (defun correlation (input-string reference-string)
  20.       "Compare two strings, and return an integer in the range [0..10]
  21.     roughly representing their correlation."
  22.       ;; insert code here
  23.       )
  24.  
  25. The function should act something like this:
  26.  
  27.     (correlation "The Same STRING, really" "the same string really")
  28.          => 10  ;; case shouldn't count
  29.  
  30.     (correlation "The SAME string (really!)" "the same string really")
  31.          => 10  ;; punctuation of any kind shouldn't count
  32.  
  33.     (correlation "Almost the Same string, really" "the same string really")
  34.          => 10  ;; the input includes the output
  35.  
  36.     (correlation "really the string same" "the same string really")
  37.          => 10  ;; order should not matter.
  38.     
  39.     (correlation "The very different thing" "the same string really")
  40.          => 0   ;; words like 'the and 'a should not count as matches
  41.  
  42.     (correlation "stringamasamethingreally" "the same string really")
  43.          => ?   ;; I haven't decided what this should produce.
  44.  
  45.     (correlation "male" "female")
  46.          => 0   ;; the string 'female contains the string 'male, but, well, you get it.
  47.  
  48.     (correlation "dogs and cats" "the same dog, really")
  49.          => 3   ;; one third of the important words was matched (with a plural)
  50.  
  51. Any suggestions?
  52.  
  53. TIA,
  54. Dave
  55. -----
  56. David Wuertele, Yasuda Lab, Electronic Engineering, Institute of Industrial Science,
  57. University of Tokyo.                dave@windsor.iis.u-tokyo.ac.jp
  58.