From: Brian Kendig
Subject: Wanted: A good pattern-matcher
Date: 
Message-ID: <bskendigCKJsxI.6nt@netcom.com>
I'm looking for code that will let me ... umm, I can't describe it well, so
consider an example:

(pattern-match '("The quick " 'color " fox " 'verb " over the lazy " 'animal)
	       "The quick brown fox jumps over the lazy dog")

  ==> ((COLOR "brown") (VERB "jumps") (ANIMAL "dog"))

In other words, it's a pattern-matcher, but it associates the things it
matches with symbols to represent them.  Does that make sense?

Is there any existing code out there that does (or can be easily adapted to
do) what I'm looking for?  Thanks for any help!

-- 
_/_/_/  Brian Kendig                              Je ne suis fait comme aucun
/_/_/  ········@netcom.com                 de ceux que j'ai vus; j'ose croire
_/_/                             n'etre fait comme aucun de ceux qui existent.
  /  Be insatiably curious.   Si je ne vaux pas mieux, au moins je suis autre.
 /     Ask "why" a lot.                                           -- Rousseau

From: john r strohm
Subject: Re: Wanted: A good pattern-matcher
Date: 
Message-ID: <1994Feb1.155900.20452@mksol.dseg.ti.com>
In article <··················@netcom.com> ········@netcom.com (Brian Kendig)
 writes:
>I'm looking for code that will let me ... umm, I can't describe it well, so
>consider an example:
>
>(pattern-match '("The quick " 'color " fox " 'verb " over the lazy " 'animal)
>	       "The quick brown fox jumps over the lazy dog")
>
>  ==> ((COLOR "brown") (VERB "jumps") (ANIMAL "dog"))
>
>In other words, it's a pattern-matcher, but it associates the things it
>matches with symbols to represent them.  Does that make sense?

Well, the example you give is somewhat messy, but with some syntactic sugaring
it becomes trivial.

(match '(THE QUICK (COLOR) FOX (VERB) OVER THE LAZY (ANIMAL))
       '(THE QUICK  BROWN  FOX JUMPS  OVER THE LAZY    DOG ))

A one-level one-word matcher like this is a suitable first or second undergrad
LISP class homework problem.

The farther you get into the matching, the messier it gets.  Part of the
question is what kind of input strings you are trying to match: are they
flat, or do they contain structure (i.e., text vs. nested S-expressions).

For the former, look in any competent computational linguistics text, or even
a good mainstream AI text that hits computational linguistics (both Winston's
book and Elaine Rich's book do this; see also Winston & Horn _LISP_, which has
a fair amount on parsing and "understanding" English with augmented transition
trees).  For the latter, dig into theorem proving and the unification algorithm.
From: Ted Dunning
Subject: Re: Wanted: A good pattern-matcher
Date: 
Message-ID: <TED.94Feb3112453@lole.crl.nmsu.edu>
In article <·····················@mksol.dseg.ti.com> ······@mksol.dseg.ti.com (john r strohm) writes:

   >
   >In other words, it's a pattern-matcher, but it associates the things it
   >matches with symbols to represent them.  Does that make sense?

   Well, the example you give is somewhat messy, but with some syntactic sugaring
   it becomes trivial.

   (match '(THE QUICK (COLOR) FOX (VERB) OVER THE LAZY (ANIMAL))
	  '(THE QUICK  BROWN  FOX JUMPS  OVER THE LAZY    DOG ))

   A one-level one-word matcher like this is a suitable first or second undergrad
   LISP class homework problem.

   The farther you get into the matching, the messier it gets.  Part of the
   question is what kind of input strings you are trying to match: are they
   flat, or do they contain structure (i.e., text vs. nested S-expressions).


it isn't all that much trouble to write the lisp equivalent of
prolog's dcgs if you use continuation passing style.