I am trying to use WordNetEng concrete grammar https://github.com/GrammaticalFramework/gf-wordnet which, as I understand - uses all the standard grammar features (from the GF base installation), but greatly expands lexicon. My GF installation is working, e.g.:
> import C:\Workspace-Data\GF\AllEng.gfo
linking ... OK
Languages: AllEng
3031 msec
AllEngAbs> parse "turtle is good"
The parser failed at token 1: "turtle"
31 msecAllEngAbs> parse "dog is good"
PredVPS (MassNP (UseN dog_N)) (MkVPS (TTAnt TPres ASimul) PPos (UseComp (CompAP (PositA good_A))))
PredVPS (MassNP (UseN dog_N)) (MkVPS (TTAnt TPres ASimul) PPos (UseComp (CompNP (AdjAsNP (PositA good_A)))))
...
But I can import WordNetEng, but it does not recognize nor the turtle, nor other common words, including dog:
AllEngAbs> import C:\Workspace-Data\GF\WordNetEng.gf
linking ... OK
Languages: WordNetEng
5468 msec
WordNet> parse "tortoise is good"
The parser failed at token 1: "tortoise"
4234 msec
WordNet> parse "dog is good"
The parser failed at token 1: "dog"
0 msec
What is wrong? How GF can import the grammar (quite complex set of files) and then can not parse the simplest sentences? How can I debug this and correct this? Thanks!
Maybe there is option to list all the grammatical categories or terminals that have been imported in the session, e.g. in that way I could see whther the "tortoise"
is imported or not?
I tried to generate random sentences, but there is strange error:
WordNet> gr
no trees found
0 msec
The WordNet lexicon is just a lexicon. It uses the categories from the standard RGL, but not the rest of the RGL functions. This is the abstract syntax:
So your result is completely expected.
Parse with RGL+WordNet
If you want to parse with the RGL and the WordNet lexicon, you can use the Parse module in the same repo, gf-wordnet/Parse.gf.
A warning though, that grammar can be very ambiguous. Most of the ambiguity comes from the fact that the every word has several versions, but you can also experiment with commenting out ParseExtend and see if that contributes to the multiple parses.
Use it like this:
But it will still be ambiguous, because some of the words belong to lots of different synsets (20 synsets for the word good), and a long sentence may contain several such words.
Use WordNet lexicon in an application grammar
If you write an application grammar, you can always open WordNet in it, like any other module. For instance, to recreate the Foods example from the tutorial, we could write the parametrised module (functor)
FoodsI.gf
like this instead:and instantiate it for a concrete language like this