Re: Detecting the presence of a pattern in an atom
Steve Prior <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
Thanks everyone for the help, I've got it working now with the simple DCG.
I had only written a DCG once before about ten years ago when I added a natural
language parser to my home automation system - it's still running in my house,
but it's been so long I forgot the basics.
I'm mostly a Java programmer in my day job, but when this task came along I knew
it was time to introduce SWI Prolog to the office. The ability to pattern match
the structure of a web page to extract just what I needed would have been awful
to write in any other language, but was about 100 lines of Prolog.
Steve
> Example:
>
> %?- in_parentheses("acme ltd (HELLO) 123 (TEST)", X).
> %@ X = 'HELLO' ;
> %@ X = 'TEST' ;
> %@ false.
>
> All the best,
> Markus