Package nltk_lite :: Package contrib :: Package toolbox :: Module data
[hide private]
[frames] | no frames]

Module data

source code

module for reading Toolbox data files

Classes [hide private]
  ToolboxData
Functions [hide private]
ElementTree._ElementInterface
indent(elem, level=0)
Recursive function to indent an ElementTree._ElementInterface used for pretty printing.
source code
string
to_sfm_string(tree, encoding=None, errors='strict', unicode_fields=None)
Return a string with a standard format representation of the toolbox data in tree (tree can be a toolbox database or a single record).
source code
 
_to_sfm_string(node, l, **kwargs) source code
 
demo_flat() source code
Variables [hide private]
  _is_value = re.compile(r'\S')
Function Details [hide private]

indent(elem, level=0)

source code 

Recursive function to indent an ElementTree._ElementInterface used for pretty printing. Code from http://www.effbot.org/zone/element-lib.htm. To use run indent on elem and then output in the normal way.

Parameters:
  • elem (ElementTree._ElementInterface) - element to be indented. will be modified.
  • level (nonnegative integer) - level of indentation for this element
Returns: ElementTree._ElementInterface
Contents of elem indented to reflect its structure

to_sfm_string(tree, encoding=None, errors='strict', unicode_fields=None)

source code 

Return a string with a standard format representation of the toolbox data in tree (tree can be a toolbox database or a single record). Should work for trees parsed by grammar_parse too.

Parameters:
  • tree (ElementTree._ElementInterface) - flat representation of toolbox data (whole database or single record)
  • encoding (string) - Name of an encoding to use.
  • errors (string) - Error handling scheme for codec. Same as the encode inbuilt string method.
  • unicode_fields (string) -
Returns: string
string using standard format markup