Пример #1
0
 /**
  * Returns the first tree that can be parsed from $words, given a $Grammar.
  */
 public static function getFirstTree(Grammar $Grammar, array $words)
 {
     $Parser = new EarleyParser($Grammar, $words, true);
     $Parser->parseWords();
     $tree = $Parser->extractFirstTree();
     return $tree;
 }