[mercury-users] Mercury and NLP on smartphones
Tomas By
tomas at basun.net
Sat Apr 9 13:01:30 AEST 2011
On Fri, April 8, 2011 20:41, Alexsandro Soares wrote:
> 2 - Has anyone worked with unification grammar formalisms (such as
> Head-Driven Phrase Structure Grammar - HPSG) in Mercury?
I think I tried this with a DCG grammar once, and gave up.
Partially instantiated data structures may be an issue. (If that is
what they are called.) This is very simple and convenient to use in
Prolog in this situation, but does not work in Mercury (yet?)
Also, I assume the grammar as a whole will be nondet, which means you
will have to, at some point, wrap it in a call to solutions/1 or
similar (which never seems to work ok unless done at a very low level).
If you find you need to do a whole bunch of easily predictable changes
when porting the grammar/code from Prolog to Mercury, it may be easier
to leave the HPSG grammar as it is and write a tool that does the
conversion. This is easy to do in Mercury with the source code parsing
module in the standard library.
But the best approach in the long term, I am sure, would be to write
code yourself that reads the HPSG grammar rules as data, and then does
the parsing. Probably this would mean implementing your own unification
in addition to the parsing. (But, besides that it will actually run,
you can easily get useful errors from the parser, and full control over
the processing.)
/Tomas
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list