home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!spool.mu.edu!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!s.psych.uiuc.edu!amead
- From: amead@s.psych.uiuc.edu (Alan Mead)
- Subject: ALGORITHM to flexibly match strings needed
- Message-ID: <C008DH.3I3@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: UIUC Department of Psychology
- Date: Tue, 29 Dec 1992 04:56:04 GMT
- Lines: 20
-
- Someone suggested that programmers here were, shall we say
- exceptionally "with it"? Anyway, although this has nothing to do with
- C per se, I'd like to know about any algorithms for matching strings.
- Specifically, I need to count typos in a sample string as compared to a
- target string. Obviously, I cannot just compare each char as an
- initial additional stroke would cause numerous, erroneous errors. Eg,
- " Run Spot run." as a sample of "Run Spot run." is one error, not 13.
-
- I've gotten as far as conceptualizing it as "sliding" the mis-matching
- sub-string of the sample string left and right in increasing amounts
- until a match is made, but I just cannot imagine how to code such a beast.
-
- I imagine that this algorithm would be analogous to that used by UNIX
- diff. I don't know how smart that utility is, but you wouldn't want to
- declare two files completely dissimilar simpily because one was
- preceeded by a blank line.
-
- Thanks for any sugestions.
-
- -alan mead
-