error: Undefined character escape in quoted atom or string: `\N' .

374 views
Skip to first unread message

Harshita Jhavar

unread,
Mar 11, 2015, 7:57:18 AM3/11/15
to swi-p...@googlegroups.com
error: Undefined character escape in quoted atom or string: `\N' . 

I am trying to pass parsed output of English text through a tool build in prolog. It has nouns desribed in it as '\N'. The compiler is taking it as escape sequence and giving the above mentioned error. If you will suggest me to put \\ instead of \, then, let me clarify, I don't want to do this manually every time. I remember there is some command which i can use in the terminal to silent this error. Can you please help me with that command or a better solution. I am using Ubuntu 14.04. Thanks

Harshita Jhavar

unread,
Mar 11, 2015, 8:00:08 AM3/11/15
to swi-p...@googlegroups.com

Also, when I add \\ manually, then it shows prolog initialisation failed.

Jan Wielemaker

unread,
Mar 12, 2015, 9:22:52 AM3/12/15
to Harshita Jhavar, swi-p...@googlegroups.com
Well, you've got to feed the compiler with valid Prolog text one way
or another. It it is not (valid) Prolog text, you either have to use
some external tool to make it valid or write a Prolog program that reads
the input character-by-character, parses it and then process it.

The simplest is probably to fix the tool that produces the \N to produce
\\N. If you have a lot of data, something like `sed -i 's/\\N/\\\\N/g'
*.input` will probably do the job (make a backup first!)

Cheers --- Jan

Shishir Kumar

unread,
Jun 19, 2015, 4:24:40 AM6/19/15
to swi-p...@googlegroups.com
Hi Harshita,

You found any solution for this? I am also facing the same error.

Jan Wielemaker

unread,
Jun 19, 2015, 4:30:51 AM6/19/15
to Shishir Kumar, swi-p...@googlegroups.com
On 06/19/2015 10:24 AM, Shishir Kumar wrote:
> Hi Harshita,
>
> You found any solution for this? I am also facing the same error.

You can't avoid that. '\N' is illegal Prolog syntax. Old versions
did accept it without an error, but '\N' was the same as 'N', which
isn't very helpful either.

There are just two options: either use some script that turns the
parser output into proper Prolog syntax or, typically easier and
cleaner, write a Prolog parser for the output of the English parser.

Cheers --- Jan
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
> <mailto:swi-prolog+...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/swi-prolog.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages