-
Notifications
You must be signed in to change notification settings - Fork 0
Home
garfix edited this page Dec 27, 2013
·
5 revisions
Echo is a library that can be used for Natural Language Interaction programs.
Here is an example of how to generate a English sentence from a set of relations:
// Generate "Lord Byron was influenced by John Milton."
$relations = "
sentence(?e) and
mood(?e, Declarative) and
voice(?e, Passive) and
isa(?e, Influence) and
tense(?e, Past) and
subject(?e, ?s) and
object(?e, ?o) and
name(?s, 'John Milton') and
name(?o, 'Lord Byron')
";
$Parser = new SemanticStructureParser();
$Generator = new Generator();
$Sentence = $Parser->parse($relations);
$Grammar = GrammarFactory::getGrammar('en')
$text = $Generator->generate($Grammar, $Sentence);
More examples can be found in the GenerationTest class.