class documentation

Undocumented

Method __init__ Undocumented
Method fromstring Convert a string representation of a feature structure (as displayed by repr) into a FeatStruct. This process imposes the following restrictions on the string representation:
Method read_app_value Mainly included for backwards compat.
Method read_fstruct_value Undocumented
Method read_int_value Undocumented
Method read_logic_value Undocumented
Method read_partial Helper function that reads in a feature structure.
Method read_set_value Undocumented
Method read_str_value Undocumented
Method read_sym_value Undocumented
Method read_tuple_value Undocumented
Method read_value Undocumented
Method read_var_value Undocumented
Constant VALUE_HANDLERS Undocumented
Method _error Undocumented
Method _finalize Called when we see the close brace -- checks for a slash feature, and adds in default values.
Method _read_partial Undocumented
Method _read_partial_featdict Undocumented
Method _read_partial_featlist Undocumented
Method _read_seq_value Helper function used by read_tuple_value and read_set_value.
Method _read_value Undocumented
Constant _ASSIGN_RE Undocumented
Constant _BARE_PREFIX_RE Undocumented
Constant _COMMA_RE Undocumented
Constant _END_FSTRUCT_RE Undocumented
Constant _FEATURE_NAME_RE Undocumented
Constant _REENTRANCE_RE Undocumented
Constant _SLASH_RE Undocumented
Constant _START_FDICT_RE Undocumented
Constant _START_FSTRUCT_RE Undocumented
Constant _SYM_CONSTS Undocumented
Constant _TARGET_RE Undocumented
Instance Variable _fdict_class Undocumented
Instance Variable _features Undocumented
Instance Variable _features_with_defaults Undocumented
Instance Variable _flist_class Undocumented
Instance Variable _logic_parser Undocumented
Instance Variable _prefix_feature Undocumented
Instance Variable _slash_feature Undocumented
def __init__(self, features=(SLASH, TYPE), fdict_class=FeatStruct, flist_class=FeatList, logic_parser=None): (source)

Undocumented

def fromstring(self, s, fstruct=None): (source)

Convert a string representation of a feature structure (as displayed by repr) into a FeatStruct. This process imposes the following restrictions on the string representation:

  • Feature names cannot contain any of the following: whitespace, parentheses, quote marks, equals signs, dashes, commas, and square brackets. Feature names may not begin with plus signs or minus signs.
  • Only the following basic feature value are supported: strings, integers, variables, None, and unquoted alphanumeric strings.
  • For reentrant values, the first mention must specify a reentrance identifier and a value; and any subsequent mentions must use arrows ('->') to reference the reentrance identifier.
def read_app_value(self, s, position, reentrances, match): (source)

Mainly included for backwards compat.

def read_fstruct_value(self, s, position, reentrances, match): (source)

Undocumented

def read_int_value(self, s, position, reentrances, match): (source)

Undocumented

def read_logic_value(self, s, position, reentrances, match): (source)

Undocumented

def read_partial(self, s, position=0, reentrances=None, fstruct=None): (source)

Helper function that reads in a feature structure.

Parameters
sThe string to read.
positionThe position in the string to start parsing.
reentrancesA dictionary from reentrance ids to values. Defaults to an empty dictionary.
fstructUndocumented
Returns
boolA tuple (val, pos) of the feature structure created by parsing and the position where the parsed feature structure ends.
def read_set_value(self, s, position, reentrances, match): (source)

Undocumented

def read_str_value(self, s, position, reentrances, match): (source)

Undocumented

def read_sym_value(self, s, position, reentrances, match): (source)

Undocumented

def read_tuple_value(self, s, position, reentrances, match): (source)

Undocumented

def read_value(self, s, position, reentrances): (source)

Undocumented

def read_var_value(self, s, position, reentrances, match): (source)

Undocumented

VALUE_HANDLERS = (source)

Undocumented

Value
[('read_fstruct_value', _START_FSTRUCT_RE),
 ('read_var_value', re.compile(r'\?[a-zA-Z_][a-zA-Z0-9_]*')),
 ('read_str_value', re.compile(r'[uU]?[rR]?([\'"])')),
 ('read_int_value', re.compile(r'-?\d+')),
 ('read_sym_value', re.compile(r'[a-zA-Z_][a-zA-Z0-9_]*')),
 ('read_app_value',
  re.compile(r'<(app)\((\?[a-z][a-z]*)\s*,\s*(\?[a-z][a-z]*)\)>')),
...
def _error(self, s, expected, position): (source)

Undocumented

def _finalize(self, s, pos, reentrances, fstruct): (source)

Called when we see the close brace -- checks for a slash feature, and adds in default values.

def _read_partial(self, s, position, reentrances, fstruct=None): (source)

Undocumented

def _read_partial_featdict(self, s, position, match, reentrances, fstruct): (source)

Undocumented

def _read_partial_featlist(self, s, position, match, reentrances, fstruct): (source)

Undocumented

def _read_seq_value(self, s, position, reentrances, match, close_paren, seq_class, plus_class): (source)

Helper function used by read_tuple_value and read_set_value.

def _read_value(self, name, s, position, reentrances): (source)

Undocumented

_ASSIGN_RE = (source)

Undocumented

Value
re.compile(r'\s*=\s*')
_BARE_PREFIX_RE = (source)

Undocumented

Value
re.compile(r'\s*(?:\((\d+)\)\s*)?(\??[\w-]+\s*)()')
_COMMA_RE = (source)

Undocumented

Value
re.compile(r'\s*,\s*')
_END_FSTRUCT_RE = (source)

Undocumented

Value
re.compile(r'\s*\]\s*')
_FEATURE_NAME_RE = (source)

Undocumented

Value
re.compile(r'\s*([\+-]?)([^\s\(\)<>"\'-=\[\],]+)\s*')
_REENTRANCE_RE = (source)

Undocumented

Value
re.compile(r'\s*->\s*')
_SLASH_RE = (source)

Undocumented

Value
re.compile(r'/')
_START_FDICT_RE = (source)

Undocumented

Value
re.compile(('(%s)|(%s\\s*(%s\\s*(=|->)|[+-]%s|\\]))' % (_BARE_PREFIX_RE.pattern,
                                                       _START_FSTRUCT_RE.pattern
,
                                                       _FEATURE_NAME_RE.pattern,
                                                       _FEATURE_NAME_RE.pattern)))
_START_FSTRUCT_RE = (source)

Undocumented

Value
re.compile(r'\s*(?:\((\d+)\)\s*)?(\??[\w-]+)?(\[)')
_SYM_CONSTS: dict = (source)

Undocumented

Value
{'None': None, 'True': True, 'False': False}
_TARGET_RE = (source)

Undocumented

Value
re.compile(r'\s*\((\d+)\)\s*')
_fdict_class = (source)

Undocumented

_features = (source)

Undocumented

_features_with_defaults = (source)

Undocumented

_flist_class = (source)

Undocumented

_logic_parser = (source)

Undocumented

_prefix_feature = (source)

Undocumented

_slash_feature = (source)

Undocumented