Reputation: 17
I am working on Natural Language Generation task and need to retrieve natural language word or phrase equivalent of a Cyc term. E.g. "#$EatingEvent" -> "eat" or "#$Coyote-Animal" -> "coyote".
How can this be achieved either through Java Api or SubL function?
I am using Research Cyc 4.0q KB and Cyc Core API Suite v1.0.0-rc4.
Upvotes: 0
Views: 203
Reputation: 107
It may benefit other readers to note that you can also get some NL equivalents of Cyc terms in OpenCyc, not just ResearchCyc.
For example, if you call the following SubL...
(generate-phrase #$Dog)
...in e.g. the Interactor you will obtain this as the output:
"dog" prettyString-Canonical NIL (#( 0 NIL))
Note that there are a good number of assertions on #$prettyString and #$prettyString-Canonical in (my version of) OpenCyc. As DaveS suggests, you should be able query these using new-cyc-query.
ResearchCyc appears not to have #$prettyString or #$prettyString-Canonical but appears to use a more subtle ontology (a set of predicates) for generating NL. I suspect the coverage and flexibility of NL gen knowledge in RCyc is better than OCyc.
I obtained these results on
CycL revision level: 10.140388 Current KB: 5022
Upvotes: 1
Reputation: 100
There are at least three different ways you can achieve that:
Use a Cyc query. Below is the SubL form to run the query, but the query can be used easily with the Java API or via the Cyc browser:
(new-cyc-query '(#$termPhrases #$Coyote-Animal #$CharacterString ?X) #$InferencePSC '(:max-number 1))
This returns:
(((?X . "prairie wolf")))
If you don't ask for just one answer, you can get lots of them:
(new-cyc-query '(#$termPhrases #$Coyote-Animal #$CharacterString ?X) #$InferencePSC )
This returns:
(((?X . "Canis latrans"))
((?X . "coyote (C. latrans)"))
((?X . "C. latrans"))
((?X . "prairie wolves"))
((?X . "coyotes"))
((?X . "coyote"))
((?X . "prairie wolf")))
Use a SubL generation form:
(generate-phrase #$Coyote-Animal)
This returns:
"prairie wolf"
#$singular
Use the Java API:
Paraphraser termParaphraser = getTermParaphraser();
KbObject coyote = KbCollectionFactory.get("Coyote-Animal");
String nl = termParaphraser.paraphrase(coyote).getString());
At the end of this code, nl should be set to the string "prairie wolf".
I'm not sure if this paraphraser code is the 1.0.0-Rrc4 of the API, but it's definitely in 1.0.0-rc5, the one that's currently downloadable from dev.cyc.com.
Upvotes: 0