Thread View: comp.lang.prolog
2 messages
2 total messages
Started by larsson
Thu, 21 Jan 1993 19:08
Reading text files in Prolog
Author: larsson
Date: Thu, 21 Jan 1993 19:08
Date: Thu, 21 Jan 1993 19:08
34 lines
1844 bytes
1844 bytes
Dear colleagues, Here is a question I mistakenly addressed to Jamie believing it might be a FAQ: I'm fairly new to the programming language Prolog. My primary intention is to use it for natural language processing. Presently I've been able to run (and even to write) simple parsers, which will get one sentence at a time from the keyboard and produce a parse tree. So far so good. But, trying to use these techniques for text processing purposes things suddenly get difficult. Texts usually come on files, often huges ones, which I would like to read for instance sentence by sentence and parse. The difficulties arise because the system doesn't use strings internally. Another problem is how to keep track of my position in the file, when the system backtracks. And finally, for compatibility and portbility the suggested method for reading files should preferably also be compliant with the current ISO Draft Standard for the language. Thanks in advance for any hints and solutions from more experienced programmers. Arne *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Arne Larsson Nokia Telecommunications Translator Transmission Systems, Customer Services larsson@ntc02.tele.nokia.fi P.O. Box 12, SF-02611 Espoo, Finland Phone +358 0 5117476, Fax +358 0 51044287 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Re: Reading text files in Prolog
Author: Dennis C Merritt
Date: Wed, 27 Jan 1993 01:24
Date: Wed, 27 Jan 1993 01:24
12 lines
931 bytes
931 bytes
This is a yucchy part of Prolog. The best thing is to use the read_in/1 predicate defined in Clocksin & Mellish, if you can still get a copy. It seems to be out of print. It lets you define how you want to parse the text input, whether to get lines, sentences, what is white space, etc. If you have trouble finding it I can send it to you via mail -- Dennis Merritt Amziod, PO Box 273, Stow, MA 01775 Tel 508/897-7332, FAX 508/897-2784, amziod@world.std.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads