pytext.data.data_structures package

Submodules

pytext.data.data_structures.annotation module

class pytext.data.data_structures.annotation.Annotation(annotation_string: str, utterance: str = '', brackets: str = '[]', combination_labels: bool = True, add_dict_feat: bool = False, accept_flat_intents_slots: bool = False)[source]

Bases: object

build_tree(accept_flat_intents_slots: bool = False)[source]
class pytext.data.data_structures.annotation.Intent(label)[source]

Bases: pytext.data.data_structures.annotation.Node

validate_node()[source]
class pytext.data.data_structures.annotation.Node(label)[source]

Bases: object

children_flat_str_spans()[source]
flat_str()[source]
get_info()[source]
get_token_span()[source]

0 indexed Like array slicing: For the first 3 tokens, returns 0, 3

list_ancestors()[source]
list_nonTerminals()[source]

Returns all Intent and Slot nodes subordinate to this node

list_terminals()[source]

Returns all Token nodes

list_tokens()[source]
validate_node()[source]
class pytext.data.data_structures.annotation.Node_Info(node)[source]

Bases: object

This class extracts the essential information for a mode, for use in rules.

get_parent(node)[source]
get_same_span(node)[source]
class pytext.data.data_structures.annotation.Root[source]

Bases: pytext.data.data_structures.annotation.Node

validate_node()[source]
class pytext.data.data_structures.annotation.Slot(label)[source]

Bases: pytext.data.data_structures.annotation.Node

validate_node()[source]
class pytext.data.data_structures.annotation.Token(label, index)[source]

Bases: pytext.data.data_structures.annotation.Node

remove()[source]

Removes this token from the tree

validate_node()[source]
class pytext.data.data_structures.annotation.Token_Info(node)[source]

Bases: object

This class extracts the essential information for a token for use in rules.

get_parent(node)[source]
class pytext.data.data_structures.annotation.Tree(root: pytext.data.data_structures.annotation.Root, combination_labels: bool, utterance: str = '')[source]

Bases: object

depth()[source]
flat_str()[source]
list_tokens()[source]
print_tree()[source]
recursive_validation(node)[source]
to_actions()[source]
validate_tree()[source]

This is a method for checking that roots/intents/slots are nested correctly. Root( Intent( Slot( Intent( Slot, etc.) ) ) )

class pytext.data.data_structures.annotation.TreeBuilder(combination_labels: bool = True)[source]

Bases: object

finalize_tree()[source]
update_tree(action, label)[source]
pytext.data.data_structures.annotation.escape_brackets(string: str) → str[source]
pytext.data.data_structures.annotation.is_intent_nonterminal(node_label: str) → bool[source]
pytext.data.data_structures.annotation.is_slot_nonterminal(node_label: str) → bool[source]
pytext.data.data_structures.annotation.is_unsupported(node_label: str) → bool[source]
pytext.data.data_structures.annotation.is_valid_nonterminal(node_label: str) → bool[source]
pytext.data.data_structures.annotation.list_from_actions(tokens_str: List[str], actions_vocab: List[str], actions_indices: List[int])[source]

Module contents