Example #1
0
def feature_record():
    """Defines an expression for feature records.
    
    Valid feature records:
     * ``T``: all terminals
     * ``NT``: all nonterminals
     
    :AST Node: `FeatureRecord:
    :Example: ``T``, ``NT``
    """
    return pyparsing.oneOf("T NT").setParseAction(
        single_value_holder(ast.FeatureRecord, lambda v: NodeType.fromkey(v[0])))
Example #2
0
 def handle_feature(self, elem):
     """Feeds feature information (values, descriptions) to the indexer."""
     self._handle_annotation(elem, 
                             partial(self._indexer.add_feature, elem.get("name"), 
                                     NodeType.fromkey(elem.get("domain")[0])))
Example #3
0
 def handle_feature(self, elem):
     """Feeds feature information (values, descriptions) to the indexer."""
     self._handle_annotation(
         elem,
         partial(self._indexer.add_feature, elem.get("name"),
                 NodeType.fromkey(elem.get("domain")[0])))