Package nltk_lite :: Package contrib :: Package mit :: Package six863 :: Package semantics :: Module category :: Class GrammarCategory
[hide private]
[frames] | no frames]

Class GrammarCategory

source code

??-167 --+    
         |    
??-168 --+    
         |    
??-169 --+    
         |    
  Category --+
             |
            GrammarCategory

A class of Category for use in parsing.

The name of the head feature in a GrammarCategory is pos (for "part of speech").

In addition, GrammarCategories are displayed and parse differently, to be consistent with NLP teaching materials: the value of the / feature can be written with a slash after the right bracket, so that the string representation looks like: head[...]/value.

Every GrammarCategory has a / feature implicitly present; if it is not explicitly written, it has the value False. This is so that "slashed" features cannot unify with "unslashed" ones.

An example of a GrammarCategory is VP[+fin]/NP, for a verb phrase that is finite and has an omitted noun phrase inside it.

Instance Methods [hide private]

Inherited from Category: __cmp__, __div__, __eq__, __getitem__, __hash__, __init__, __ne__, __repr__, __setitem__, __str__, copy, feature_names, freeze, frozen, get, has_feature, has_key, head, items, keys, remove_unbound_vars, substitute_bindings, symbol, values

Class Methods [hide private]
 
_str(cls, obj, reentrances, reentrance_ids, normalize=False) source code
 
inner_parse(cls, s, position, reentrances=None) source code

Inherited from Category: from_yaml, parse_rules, to_yaml

Inherited from Category (private): _parse, _parseval

Static Methods [hide private]
 
parse(s, position=0) source code

Inherited from Category (private): _remove_unbound_vars

Class Variables [hide private]
  headname = 'pos'
  yaml_tag = '!parse.GrammarCategory'

Inherited from Category (private): _PARSE_RE

Method Details [hide private]

_str(cls, obj, reentrances, reentrance_ids, normalize=False)
Class Method

source code 
Overrides: Category._str

parse(s, position=0)
Static Method

source code 
Overrides: Category.parse

inner_parse(cls, s, position, reentrances=None)
Class Method

source code 
Overrides: Category.inner_parse