« Return to Thread: 'not' as atomic symbol

Re: 'not' as atomic symbol

by Jan Wielemaker :: Rate this Message:

Reply to Author | View in Thread

On Tuesday 09 January 2007 23:32, randy sharp wrote:
> How do I disable the predicate interpretation of 'not'? I have an NL
> application which involves the word 'not', but it seems to be trying to
> interpret the word as a predicate rather than as an atomic symbol.

not (or 'not') is an atom.  not/1 is also a predicate.  That should't
bother you.

> In SICStus, this wasn't a problem. I used the following statement to
> disable
>
> the prolog interpretation of the following words:
> :- op(0,fx,[(wait),(public),(mod),(dynamic)].

This is about *operators*.  There isn't much special about these too,
except "dynamic foo/1" is read as "dynamic(foo/1)".  More specifically,
some Prologs to not accept term(dynamic) without the declaration above
as dynamic is an operator > 1000.  SWI-Prolog doesn't care.

> I thought the same might apply here:
> :- op(0,fx,[(not)].

not is not an operator in SWI-Prolog. It is only there as a predicate
for backward compatibility.

> but this didn't work either. Any advice?

Explain the real problem. In a properly designed NLP application it
should not be an issue whether any of these are operators, predicates or
whatever. For one thing, do not use read/1 to read NLP input. read/1 is
to read Prolog terms. Use one of the predicates from the library
readutil or roll your own. Next break the input into words and
punctuation (typically using a DCG). Typically turn the words into atoms
using atom_codes/2. There are some options left here. For example how to
deal with upper/lower case. Also, how to deal with -for example-
all-in-one, etc. Finally start high-level interpretation.

The NLP package contains some useful stuff for western languages (mostly
english I'm afraid).

        Success --- Jan


------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...

 « Return to Thread: 'not' as atomic symbol

LightInTheBox - Buy quality products at wholesale price