Article View: comp.lang.prolog
Article #994making a "call" to a text file
From: Eric Iverson
Date: Thu, 19 Jul 1990 18:39
Date: Thu, 19 Jul 1990 18:39
51 lines
2311 bytes
2311 bytes
I am working with a very large text file of dictionary definitions in
prolog format. What I would like to do is write a routine that does a
virtual call without actually consulting the file. That is to say, I
would like to somehow just get the term I want from the file and unify
it with a prolog variable.
This obvious thing to do is a simple: read(Stream,Functor(Var1,...VarN)).
However, while this works, it is far too slow for multiple queries.
Is there something that could be implemented under grep or sed or lex
that would do the same thing?
Below is a sample of what I am trying to call:
int(play(v,12),
[[genera,
[[ancestor, [perform(v,1)]]]],
[differentia,
[[source,
[[preference,
[[agent, [human_being(n,1)]],
[object, [music(n,1)]]]],
[assertion,[]]]],
[target, []]]]]).
adjective(green,[green(aj,1),green(aj,2),green(aj,3)]).
int(green(aj,1),
[[genera,
[[superproperty, [coloured(aj,1)]],
[property, [green(n,1)]]]],
[differentia,
[[source,
[[preference,
[[object,
[[bounds(n,1), [bounded(aj,1)]],
[extent(n,1), [[not(aj,1),zero_dimensional(aj,1)]]],
[composition(n,1), [physical(n,1)]],
[animacy(n,1), [nonliving(aj,1)]]]]]],
[assertion,
[[object,
[[colour(n,1), [green(aj,1)]]]]]]]],
[target, []]]]]).
--
------------------------------------------------------------------------
Eric Iverson Internet: eiverson@nmsu.edu
Computing Research Lab
Box 30001/3CRL Life is something to do when
New Mexico State University you can't get to sleep.
Las Cruces, NM 88003-0001 -Fran Lebowitz
(505) 646-5711
Technical Details
Message-ID:
<EIVERSON.90Jul19123922@aigyptos.nmsu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!mintaka!yale!cmcl2!lanl!nmsu!opus!eiversonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!mintaka!yale!cmcl2!lanl!nmsu!opus!eiverson From: eiverson@nmsu.edu (Eric Iverson) Newsgroups: comp.lang.prolog Subject: making a "call" to a text file Message-ID: <EIVERSON.90Jul19123922@aigyptos.nmsu.edu> Date: 19 Jul 90 18:39:22 GMT Sender: news@NMSU.edu Distribution: comp Organization: NMSU Computer Science Lines: 51