repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
estnltk/estnltk
estnltk/syntax/utils.py
Tree.add_child_to_subtree
def add_child_to_subtree( self, parent_word_id, tree ): ''' Searches for the tree with *parent_word_id* from the current subtree (from this tree and from all of its subtrees). If the parent tree is found, attaches the given *tree* as its child. If the parent tree is not fou...
python
def add_child_to_subtree( self, parent_word_id, tree ): ''' Searches for the tree with *parent_word_id* from the current subtree (from this tree and from all of its subtrees). If the parent tree is found, attaches the given *tree* as its child. If the parent tree is not fou...
[ "def", "add_child_to_subtree", "(", "self", ",", "parent_word_id", ",", "tree", ")", ":", "if", "(", "self", ".", "word_id", "==", "parent_word_id", ")", ":", "self", ".", "add_child_to_self", "(", "tree", ")", "elif", "(", "self", ".", "children", ")", ...
Searches for the tree with *parent_word_id* from the current subtree (from this tree and from all of its subtrees). If the parent tree is found, attaches the given *tree* as its child. If the parent tree is not found, the current tree is not changed.
[ "Searches", "for", "the", "tree", "with", "*", "parent_word_id", "*", "from", "the", "current", "subtree", "(", "from", "this", "tree", "and", "from", "all", "of", "its", "subtrees", ")", ".", "If", "the", "parent", "tree", "is", "found", "attaches", "th...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/utils.py#L583-L593
estnltk/estnltk
estnltk/syntax/utils.py
Tree.get_root
def get_root( self, **kwargs ): ''' Returns this tree if it has no parents, or, alternatively, moves up via the parent links of this tree until reaching the tree with no parents, and returnes the parentless tree as the root. ''' if self.parent == None: return ...
python
def get_root( self, **kwargs ): ''' Returns this tree if it has no parents, or, alternatively, moves up via the parent links of this tree until reaching the tree with no parents, and returnes the parentless tree as the root. ''' if self.parent == None: return ...
[ "def", "get_root", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "parent", "==", "None", ":", "return", "self", "else", ":", "return", "self", ".", "parent", ".", "get_root", "(", "*", "*", "kwargs", ")" ]
Returns this tree if it has no parents, or, alternatively, moves up via the parent links of this tree until reaching the tree with no parents, and returnes the parentless tree as the root.
[ "Returns", "this", "tree", "if", "it", "has", "no", "parents", "or", "alternatively", "moves", "up", "via", "the", "parent", "links", "of", "this", "tree", "until", "reaching", "the", "tree", "with", "no", "parents", "and", "returnes", "the", "parentless", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/utils.py#L596-L604
estnltk/estnltk
estnltk/syntax/utils.py
Tree._satisfies_conditions
def _satisfies_conditions( self, tree_node, **kwargs ): ''' Check whether given *tree_node* satisfies the conditions given as arguments in *kwargs*. By default (if no conditions are given in *kwargs*), returns True. If there are multiple...
python
def _satisfies_conditions( self, tree_node, **kwargs ): ''' Check whether given *tree_node* satisfies the conditions given as arguments in *kwargs*. By default (if no conditions are given in *kwargs*), returns True. If there are multiple...
[ "def", "_satisfies_conditions", "(", "self", ",", "tree_node", ",", "*", "*", "kwargs", ")", ":", "matches", "=", "[", "]", "# A) Check syntactic label by matching a string", "syntactic_label", "=", "kwargs", ".", "get", "(", "'label'", ",", "None", ")", "if", ...
Check whether given *tree_node* satisfies the conditions given as arguments in *kwargs*. By default (if no conditions are given in *kwargs*), returns True. If there are multiple conditions listed (e.g. 'label_regexp' and 'word_temp...
[ "Check", "whether", "given", "*", "tree_node", "*", "satisfies", "the", "conditions", "given", "as", "arguments", "in", "*", "kwargs", "*", ".", "By", "default", "(", "if", "no", "conditions", "are", "given", "in", "*", "kwargs", "*", ")", "returns", "Tr...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/utils.py#L607-L666
estnltk/estnltk
estnltk/syntax/utils.py
Tree.get_children
def get_children( self, **kwargs ): ''' Recursively collects and returns all subtrees of given tree (if no arguments are given), or, alternatively, collects and returns subtrees satisfying some specific criteria (pre-specified in the arguments); Parameters ...
python
def get_children( self, **kwargs ): ''' Recursively collects and returns all subtrees of given tree (if no arguments are given), or, alternatively, collects and returns subtrees satisfying some specific criteria (pre-specified in the arguments); Parameters ...
[ "def", "get_children", "(", "self", ",", "*", "*", "kwargs", ")", ":", "depth_limit", "=", "kwargs", ".", "get", "(", "'depth_limit'", ",", "922337203685477580", ")", "# Just a nice big number to", "# assure that by default, ", "# there is no depth limit ...", "include_...
Recursively collects and returns all subtrees of given tree (if no arguments are given), or, alternatively, collects and returns subtrees satisfying some specific criteria (pre-specified in the arguments); Parameters ----------- depth_limit : in...
[ "Recursively", "collects", "and", "returns", "all", "subtrees", "of", "given", "tree", "(", "if", "no", "arguments", "are", "given", ")", "or", "alternatively", "collects", "and", "returns", "subtrees", "satisfying", "some", "specific", "criteria", "(", "pre", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/utils.py#L669-L743
estnltk/estnltk
estnltk/syntax/utils.py
Tree.as_dependencygraph
def as_dependencygraph( self, keep_dummy_root=False, add_morph=True ): ''' Returns this tree as NLTK's DependencyGraph object. Note that this method constructs 'zero_based' graph, where counting of the words starts from 0 and the root index is -1 (not 0, as in M...
python
def as_dependencygraph( self, keep_dummy_root=False, add_morph=True ): ''' Returns this tree as NLTK's DependencyGraph object. Note that this method constructs 'zero_based' graph, where counting of the words starts from 0 and the root index is -1 (not 0, as in M...
[ "def", "as_dependencygraph", "(", "self", ",", "keep_dummy_root", "=", "False", ",", "add_morph", "=", "True", ")", ":", "from", "nltk", ".", "parse", ".", "dependencygraph", "import", "DependencyGraph", "graph", "=", "DependencyGraph", "(", "zero_based", "=", ...
Returns this tree as NLTK's DependencyGraph object. Note that this method constructs 'zero_based' graph, where counting of the words starts from 0 and the root index is -1 (not 0, as in Malt-TAB format); Parameters ----------- ...
[ "Returns", "this", "tree", "as", "NLTK", "s", "DependencyGraph", "object", ".", "Note", "that", "this", "method", "constructs", "zero_based", "graph", "where", "counting", "of", "the", "words", "starts", "from", "0", "and", "the", "root", "index", "is", "-",...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/utils.py#L746-L838
estnltk/estnltk
estnltk/syntax/utils.py
Tree.get_tree_depth
def get_tree_depth( self ): ''' Finds depth of this tree. ''' if (self.children): depth = 1 childDepths = [] for child in self.children: childDepths.append( child.get_tree_depth() ) return depth + max(childDepths) else: ...
python
def get_tree_depth( self ): ''' Finds depth of this tree. ''' if (self.children): depth = 1 childDepths = [] for child in self.children: childDepths.append( child.get_tree_depth() ) return depth + max(childDepths) else: ...
[ "def", "get_tree_depth", "(", "self", ")", ":", "if", "(", "self", ".", "children", ")", ":", "depth", "=", "1", "childDepths", "=", "[", "]", "for", "child", "in", "self", ".", "children", ":", "childDepths", ".", "append", "(", "child", ".", "get_t...
Finds depth of this tree.
[ "Finds", "depth", "of", "this", "tree", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/utils.py#L851-L860
estnltk/estnltk
estnltk/syntax/utils.py
Tree.debug_print_tree
def debug_print_tree( self, spacing='' ): ''' *Debug only* method for outputting the tree. ''' print (spacing+" "+str(self.word_id)+" "+str(self.text)) if (self.children): spacing=spacing+" " for child in self.children: child.debug_print_tree(spacing)
python
def debug_print_tree( self, spacing='' ): ''' *Debug only* method for outputting the tree. ''' print (spacing+" "+str(self.word_id)+" "+str(self.text)) if (self.children): spacing=spacing+" " for child in self.children: child.debug_print_tree(spacing)
[ "def", "debug_print_tree", "(", "self", ",", "spacing", "=", "''", ")", ":", "print", "(", "spacing", "+", "\" \"", "+", "str", "(", "self", ".", "word_id", ")", "+", "\" \"", "+", "str", "(", "self", ".", "text", ")", ")", "if", "(", "self", "."...
*Debug only* method for outputting the tree.
[ "*", "Debug", "only", "*", "method", "for", "outputting", "the", "tree", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/utils.py#L863-L869
estnltk/estnltk
estnltk/mw_verbs/utils.py
WordTemplate.addRule
def addRule(self, field, regExpPattern): '''Adds new rule for checking whether a value of the field matches given regular expression regExpPattern; Parameters ---------- field: str keyword, e.g. 'partofspeech', 'root', 'text' etc ...
python
def addRule(self, field, regExpPattern): '''Adds new rule for checking whether a value of the field matches given regular expression regExpPattern; Parameters ---------- field: str keyword, e.g. 'partofspeech', 'root', 'text' etc ...
[ "def", "addRule", "(", "self", ",", "field", ",", "regExpPattern", ")", ":", "compiled", "=", "re", ".", "compile", "(", "regExpPattern", ")", "if", "field", "in", "self", ".", "analysisFields", ":", "if", "self", ".", "analysisRules", "==", "None", ":",...
Adds new rule for checking whether a value of the field matches given regular expression regExpPattern; Parameters ---------- field: str keyword, e.g. 'partofspeech', 'root', 'text' etc regExpPattern: str a regular ...
[ "Adds", "new", "rule", "for", "checking", "whether", "a", "value", "of", "the", "field", "matches", "given", "regular", "expression", "regExpPattern", ";", "Parameters", "----------", "field", ":", "str", "keyword", "e", ".", "g", ".", "partofspeech", "root", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/utils.py#L101-L121
estnltk/estnltk
estnltk/mw_verbs/utils.py
WordTemplate.matches
def matches(self, tokenJson): '''Determines whether given token (tokenJson) satisfies all the rules listed in the WordTemplate. If the rules describe tokenJson[ANALYSIS], it is required that at least one item in the list tokenJson[ANALYSIS] satisfies all the rules (but it...
python
def matches(self, tokenJson): '''Determines whether given token (tokenJson) satisfies all the rules listed in the WordTemplate. If the rules describe tokenJson[ANALYSIS], it is required that at least one item in the list tokenJson[ANALYSIS] satisfies all the rules (but it...
[ "def", "matches", "(", "self", ",", "tokenJson", ")", ":", "if", "self", ".", "otherRules", "!=", "None", ":", "otherMatches", "=", "[", "]", "for", "field", "in", "self", ".", "otherRules", ":", "match", "=", "field", "in", "tokenJson", "and", "(", ...
Determines whether given token (tokenJson) satisfies all the rules listed in the WordTemplate. If the rules describe tokenJson[ANALYSIS], it is required that at least one item in the list tokenJson[ANALYSIS] satisfies all the rules (but it is not required that all the items should...
[ "Determines", "whether", "given", "token", "(", "tokenJson", ")", "satisfies", "all", "the", "rules", "listed", "in", "the", "WordTemplate", ".", "If", "the", "rules", "describe", "tokenJson", "[", "ANALYSIS", "]", "it", "is", "required", "that", "at", "leas...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/utils.py#L127-L164
estnltk/estnltk
estnltk/mw_verbs/utils.py
WordTemplate.matchingAnalyses
def matchingAnalyses(self, tokenJson): '''Determines whether given token (tokenJson) satisfies all the rules listed in the WordTemplate and returns a list of analyses (elements of tokenJson[ANALYSIS]) that are matching all the rules. An empty list is returned if none of t...
python
def matchingAnalyses(self, tokenJson): '''Determines whether given token (tokenJson) satisfies all the rules listed in the WordTemplate and returns a list of analyses (elements of tokenJson[ANALYSIS]) that are matching all the rules. An empty list is returned if none of t...
[ "def", "matchingAnalyses", "(", "self", ",", "tokenJson", ")", ":", "matchingResults", "=", "[", "]", "if", "self", ".", "otherRules", "!=", "None", ":", "otherMatches", "=", "[", "]", "for", "field", "in", "self", ".", "otherRules", ":", "match", "=", ...
Determines whether given token (tokenJson) satisfies all the rules listed in the WordTemplate and returns a list of analyses (elements of tokenJson[ANALYSIS]) that are matching all the rules. An empty list is returned if none of the analyses match (all the rules), or (!) if none o...
[ "Determines", "whether", "given", "token", "(", "tokenJson", ")", "satisfies", "all", "the", "rules", "listed", "in", "the", "WordTemplate", "and", "returns", "a", "list", "of", "analyses", "(", "elements", "of", "tokenJson", "[", "ANALYSIS", "]", ")", "that...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/utils.py#L166-L200
estnltk/estnltk
estnltk/mw_verbs/utils.py
WordTemplate.matchingAnalyseIndexes
def matchingAnalyseIndexes(self, tokenJson): '''Determines whether given token (tokenJson) satisfies all the rules listed in the WordTemplate and returns a list of analyse indexes that correspond to tokenJson[ANALYSIS] elements that are matching all the rules. An empty li...
python
def matchingAnalyseIndexes(self, tokenJson): '''Determines whether given token (tokenJson) satisfies all the rules listed in the WordTemplate and returns a list of analyse indexes that correspond to tokenJson[ANALYSIS] elements that are matching all the rules. An empty li...
[ "def", "matchingAnalyseIndexes", "(", "self", ",", "tokenJson", ")", ":", "matchingResults", "=", "self", ".", "matchingAnalyses", "(", "tokenJson", ")", "if", "matchingResults", ":", "indexes", "=", "[", "tokenJson", "[", "ANALYSIS", "]", ".", "index", "(", ...
Determines whether given token (tokenJson) satisfies all the rules listed in the WordTemplate and returns a list of analyse indexes that correspond to tokenJson[ANALYSIS] elements that are matching all the rules. An empty list is returned if none of the analyses match (all the rul...
[ "Determines", "whether", "given", "token", "(", "tokenJson", ")", "satisfies", "all", "the", "rules", "listed", "in", "the", "WordTemplate", "and", "returns", "a", "list", "of", "analyse", "indexes", "that", "correspond", "to", "tokenJson", "[", "ANALYSIS", "]...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/utils.py#L202-L218
estnltk/estnltk
estnltk/mw_verbs/utils.py
WordTemplate.matchingPositions
def matchingPositions(self, tokenArray): '''Returns a list of positions (indexes) in the tokenArray where this WordTemplate matches (the method self.matches(token) returns True). Returns an empty list if no matching tokens appear in the input list. Parameters -...
python
def matchingPositions(self, tokenArray): '''Returns a list of positions (indexes) in the tokenArray where this WordTemplate matches (the method self.matches(token) returns True). Returns an empty list if no matching tokens appear in the input list. Parameters -...
[ "def", "matchingPositions", "(", "self", ",", "tokenArray", ")", ":", "assert", "isinstance", "(", "tokenArray", ",", "list", ")", ",", "\"tokenArray should be list \"", "+", "str", "(", "tokenArray", ")", "matchingPos", "=", "[", "]", "for", "i", "in", "ran...
Returns a list of positions (indexes) in the tokenArray where this WordTemplate matches (the method self.matches(token) returns True). Returns an empty list if no matching tokens appear in the input list. Parameters ---------- tokenArray: list of word tokens...
[ "Returns", "a", "list", "of", "positions", "(", "indexes", ")", "in", "the", "tokenArray", "where", "this", "WordTemplate", "matches", "(", "the", "method", "self", ".", "matches", "(", "token", ")", "returns", "True", ")", ".", "Returns", "an", "empty", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/utils.py#L224-L240
estnltk/estnltk
estnltk/mw_verbs/utils.py
WordTemplate.matchingTokens
def matchingTokens(self, tokenArray): '''Returns a list of tokens in the tokenArray that match this WordTemplate (the method self.matches(token) returns True). Returns an empty list if no matching tokens appear in the input list. Parameters ---------- ...
python
def matchingTokens(self, tokenArray): '''Returns a list of tokens in the tokenArray that match this WordTemplate (the method self.matches(token) returns True). Returns an empty list if no matching tokens appear in the input list. Parameters ---------- ...
[ "def", "matchingTokens", "(", "self", ",", "tokenArray", ")", ":", "assert", "isinstance", "(", "tokenArray", ",", "list", ")", ",", "\"tokenArray should be list \"", "+", "str", "(", "tokenArray", ")", "matchingTok", "=", "[", "]", "for", "i", "in", "range"...
Returns a list of tokens in the tokenArray that match this WordTemplate (the method self.matches(token) returns True). Returns an empty list if no matching tokens appear in the input list. Parameters ---------- tokenArray: list of word tokens; ...
[ "Returns", "a", "list", "of", "tokens", "in", "the", "tokenArray", "that", "match", "this", "WordTemplate", "(", "the", "method", "self", ".", "matches", "(", "token", ")", "returns", "True", ")", ".", "Returns", "an", "empty", "list", "if", "no", "match...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/utils.py#L242-L258
estnltk/estnltk
estnltk/mw_verbs/utils.py
WordTemplate.annotateText
def annotateText(self, text, layer, addEmptyAnnotations = True): ''' Applies this WordTemplate ( more specifically: its method self.matchingTokens() ) on all words of given text, and adds results of the matching to the text as a new annotation layer. Returns the input text (which is ...
python
def annotateText(self, text, layer, addEmptyAnnotations = True): ''' Applies this WordTemplate ( more specifically: its method self.matchingTokens() ) on all words of given text, and adds results of the matching to the text as a new annotation layer. Returns the input text (which is ...
[ "def", "annotateText", "(", "self", ",", "text", ",", "layer", ",", "addEmptyAnnotations", "=", "True", ")", ":", "from", "estnltk", ".", "text", "import", "Text", "assert", "isinstance", "(", "text", ",", "Text", ")", ",", "\"the input should be Text, but it ...
Applies this WordTemplate ( more specifically: its method self.matchingTokens() ) on all words of given text, and adds results of the matching to the text as a new annotation layer. Returns the input text (which is augmented with a new layer). Parameters ...
[ "Applies", "this", "WordTemplate", "(", "more", "specifically", ":", "its", "method", "self", ".", "matchingTokens", "()", ")", "on", "all", "words", "of", "given", "text", "and", "adds", "results", "of", "the", "matching", "to", "the", "text", "as", "a", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/utils.py#L265-L295
estnltk/estnltk
estnltk/grammar/grammar.py
Symbol.get_matches
def get_matches(self, text, cache=None, conflict_resolver=resolve_using_maximal_coverage): """Get the matches of the symbol on given text.""" is_root_node = False if cache is None: cache = {} is_root_node = True if id(self) in cache: return cache[id(se...
python
def get_matches(self, text, cache=None, conflict_resolver=resolve_using_maximal_coverage): """Get the matches of the symbol on given text.""" is_root_node = False if cache is None: cache = {} is_root_node = True if id(self) in cache: return cache[id(se...
[ "def", "get_matches", "(", "self", ",", "text", ",", "cache", "=", "None", ",", "conflict_resolver", "=", "resolve_using_maximal_coverage", ")", ":", "is_root_node", "=", "False", "if", "cache", "is", "None", ":", "cache", "=", "{", "}", "is_root_node", "=",...
Get the matches of the symbol on given text.
[ "Get", "the", "matches", "of", "the", "symbol", "on", "given", "text", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/grammar/grammar.py#L45-L59
estnltk/estnltk
estnltk/wiki/references.py
reffinder
def reffinder(sectionObj): """ add reference indeces to sectionobj['references'] :param sectionObj :return: a section obj w references: field """ text = sectionObj['text'] reftags = [x for x in refTagRegEx.finditer(text)] if reftags: references = [] for tag in reftags: ...
python
def reffinder(sectionObj): """ add reference indeces to sectionobj['references'] :param sectionObj :return: a section obj w references: field """ text = sectionObj['text'] reftags = [x for x in refTagRegEx.finditer(text)] if reftags: references = [] for tag in reftags: ...
[ "def", "reffinder", "(", "sectionObj", ")", ":", "text", "=", "sectionObj", "[", "'text'", "]", "reftags", "=", "[", "x", "for", "x", "in", "refTagRegEx", ".", "finditer", "(", "text", ")", "]", "if", "reftags", ":", "references", "=", "[", "]", "for...
add reference indeces to sectionobj['references'] :param sectionObj :return: a section obj w references: field
[ "add", "reference", "indeces", "to", "sectionobj", "[", "references", "]", ":", "param", "sectionObj", ":", "return", ":", "a", "section", "obj", "w", "references", ":", "field" ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/wiki/references.py#L42-L60
estnltk/estnltk
estnltk/wiki/references.py
referencesFinder
def referencesFinder(text): """ :param text: takes the whole text of an article, searches for references, cleans the text, marks the reference indeces from zero inside the text. :return: the tagged text and a tag:reference dictionary to be used in sectionParser """ references = referencesRegEx.f...
python
def referencesFinder(text): """ :param text: takes the whole text of an article, searches for references, cleans the text, marks the reference indeces from zero inside the text. :return: the tagged text and a tag:reference dictionary to be used in sectionParser """ references = referencesRegEx.f...
[ "def", "referencesFinder", "(", "text", ")", ":", "references", "=", "referencesRegEx", ".", "finditer", "(", "text", ")", "count", "=", "0", "refs", "=", "[", "]", "spans", "=", "[", "]", "for", "i", "in", "references", ":", "refs", ".", "append", "...
:param text: takes the whole text of an article, searches for references, cleans the text, marks the reference indeces from zero inside the text. :return: the tagged text and a tag:reference dictionary to be used in sectionParser
[ ":", "param", "text", ":", "takes", "the", "whole", "text", "of", "an", "article", "searches", "for", "references", "cleans", "the", "text", "marks", "the", "reference", "indeces", "from", "zero", "inside", "the", "text", ".", ":", "return", ":", "the", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/wiki/references.py#L62-L142
estnltk/estnltk
estnltk/wiki/images.py
imageParser
def imageParser(sectionObj): """return a sectionObj with image data added [ { image_url = "http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/R%C3%B5uge_Suurj%C3%A4rv_2011_10.jpg/1024px-R%C3%B5uge_Suurj%C3%A4rv_2011_10.jpg" text: "Rõuge Suurjärv on Eesti sügavaim järv...
python
def imageParser(sectionObj): """return a sectionObj with image data added [ { image_url = "http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/R%C3%B5uge_Suurj%C3%A4rv_2011_10.jpg/1024px-R%C3%B5uge_Suurj%C3%A4rv_2011_10.jpg" text: "Rõuge Suurjärv on Eesti sügavaim järv...
[ "def", "imageParser", "(", "sectionObj", ")", ":", "text", "=", "''", "lastEnd", "=", "0", "ends", "=", "[", "]", "text", "=", "sectionObj", "[", "'text'", "]", "imageStarts", "=", "[", "x", ".", "start", "(", ")", "for", "x", "in", "imageRegEx", "...
return a sectionObj with image data added [ { image_url = "http://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/R%C3%B5uge_Suurj%C3%A4rv_2011_10.jpg/1024px-R%C3%B5uge_Suurj%C3%A4rv_2011_10.jpg" text: "Rõuge Suurjärv on Eesti sügavaim järv (38 m)." links: [ ...]...
[ "return", "a", "sectionObj", "with", "image", "data", "added", "[", "{", "image_url", "=", "http", ":", "//", "upload", ".", "wikimedia", ".", "org", "/", "wikipedia", "/", "commons", "/", "thumb", "/", "e", "/", "e0", "/", "R%C3%B5uge_Suurj%C3%A4rv_2011_1...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/wiki/images.py#L13-L63
estnltk/estnltk
estnltk/text.py
Text.is_tagged
def is_tagged(self, layer): """Is the given element tokenized/tagged?""" # we have a number of special names that are not layers but instead # attributes of "words" layer if layer == ANALYSIS: if WORDS in self and len(self[WORDS]) > 0: return ANALYSIS in self[...
python
def is_tagged(self, layer): """Is the given element tokenized/tagged?""" # we have a number of special names that are not layers but instead # attributes of "words" layer if layer == ANALYSIS: if WORDS in self and len(self[WORDS]) > 0: return ANALYSIS in self[...
[ "def", "is_tagged", "(", "self", ",", "layer", ")", ":", "# we have a number of special names that are not layers but instead", "# attributes of \"words\" layer", "if", "layer", "==", "ANALYSIS", ":", "if", "WORDS", "in", "self", "and", "len", "(", "self", "[", "WORDS...
Is the given element tokenized/tagged?
[ "Is", "the", "given", "element", "tokenized", "/", "tagged?" ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L168-L193
estnltk/estnltk
estnltk/text.py
Text.texts
def texts(self, layer, sep=' '): """Retrieve texts for given layer. Parameters ---------- sep: str Separator for multilayer elements (default: ' '). Returns ------- list of str List of strings that make up given layer. """ ...
python
def texts(self, layer, sep=' '): """Retrieve texts for given layer. Parameters ---------- sep: str Separator for multilayer elements (default: ' '). Returns ------- list of str List of strings that make up given layer. """ ...
[ "def", "texts", "(", "self", ",", "layer", ",", "sep", "=", "' '", ")", ":", "return", "self", ".", "texts_from_spans", "(", "self", ".", "spans", "(", "layer", ")", ",", "sep", ")" ]
Retrieve texts for given layer. Parameters ---------- sep: str Separator for multilayer elements (default: ' '). Returns ------- list of str List of strings that make up given layer.
[ "Retrieve", "texts", "for", "given", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L199-L213
estnltk/estnltk
estnltk/text.py
Text.texts_from_spans
def texts_from_spans(self, spans, sep=' '): """Retrieve texts from a list of (start, end) position spans. Parameters ---------- sep: str Separator for multilayer elements (default: ' '). Returns ------- list of str List of strings that c...
python
def texts_from_spans(self, spans, sep=' '): """Retrieve texts from a list of (start, end) position spans. Parameters ---------- sep: str Separator for multilayer elements (default: ' '). Returns ------- list of str List of strings that c...
[ "def", "texts_from_spans", "(", "self", ",", "spans", ",", "sep", "=", "' '", ")", ":", "text", "=", "self", ".", "text", "texts", "=", "[", "]", "for", "start", ",", "end", "in", "spans", ":", "if", "isinstance", "(", "start", ",", "list", ")", ...
Retrieve texts from a list of (start, end) position spans. Parameters ---------- sep: str Separator for multilayer elements (default: ' '). Returns ------- list of str List of strings that correspond to given spans.
[ "Retrieve", "texts", "from", "a", "list", "of", "(", "start", "end", ")", "position", "spans", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L215-L236
estnltk/estnltk
estnltk/text.py
Text.spans
def spans(self, layer): """Retrieve (start, end) tuples denoting the spans of given layer elements. Returns ------- list of (int, int) List of (start, end) tuples. """ spans = [] for data in self[layer]: spans.append((data[START], data[END...
python
def spans(self, layer): """Retrieve (start, end) tuples denoting the spans of given layer elements. Returns ------- list of (int, int) List of (start, end) tuples. """ spans = [] for data in self[layer]: spans.append((data[START], data[END...
[ "def", "spans", "(", "self", ",", "layer", ")", ":", "spans", "=", "[", "]", "for", "data", "in", "self", "[", "layer", "]", ":", "spans", ".", "append", "(", "(", "data", "[", "START", "]", ",", "data", "[", "END", "]", ")", ")", "return", "...
Retrieve (start, end) tuples denoting the spans of given layer elements. Returns ------- list of (int, int) List of (start, end) tuples.
[ "Retrieve", "(", "start", "end", ")", "tuples", "denoting", "the", "spans", "of", "given", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L238-L249
estnltk/estnltk
estnltk/text.py
Text.starts
def starts(self, layer): """Retrieve start positions of elements if given layer.""" starts = [] for data in self[layer]: starts.append(data[START]) return starts
python
def starts(self, layer): """Retrieve start positions of elements if given layer.""" starts = [] for data in self[layer]: starts.append(data[START]) return starts
[ "def", "starts", "(", "self", ",", "layer", ")", ":", "starts", "=", "[", "]", "for", "data", "in", "self", "[", "layer", "]", ":", "starts", ".", "append", "(", "data", "[", "START", "]", ")", "return", "starts" ]
Retrieve start positions of elements if given layer.
[ "Retrieve", "start", "positions", "of", "elements", "if", "given", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L251-L256
estnltk/estnltk
estnltk/text.py
Text.ends
def ends(self, layer): """Retrieve end positions of elements if given layer.""" ends = [] for data in self[layer]: ends.append(data[END]) return ends
python
def ends(self, layer): """Retrieve end positions of elements if given layer.""" ends = [] for data in self[layer]: ends.append(data[END]) return ends
[ "def", "ends", "(", "self", ",", "layer", ")", ":", "ends", "=", "[", "]", "for", "data", "in", "self", "[", "layer", "]", ":", "ends", ".", "append", "(", "data", "[", "END", "]", ")", "return", "ends" ]
Retrieve end positions of elements if given layer.
[ "Retrieve", "end", "positions", "of", "elements", "if", "given", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L258-L263
estnltk/estnltk
estnltk/text.py
Text.layer_tagger_mapping
def layer_tagger_mapping(self): """Dictionary that maps layer names to taggers that can create that layer.""" return { PARAGRAPHS: self.tokenize_paragraphs, SENTENCES: self.tokenize_sentences, WORDS: self.tokenize_words, ANALYSIS: self.tag_analysis, ...
python
def layer_tagger_mapping(self): """Dictionary that maps layer names to taggers that can create that layer.""" return { PARAGRAPHS: self.tokenize_paragraphs, SENTENCES: self.tokenize_sentences, WORDS: self.tokenize_words, ANALYSIS: self.tag_analysis, ...
[ "def", "layer_tagger_mapping", "(", "self", ")", ":", "return", "{", "PARAGRAPHS", ":", "self", ".", "tokenize_paragraphs", ",", "SENTENCES", ":", "self", ".", "tokenize_sentences", ",", "WORDS", ":", "self", ".", "tokenize_words", ",", "ANALYSIS", ":", "self"...
Dictionary that maps layer names to taggers that can create that layer.
[ "Dictionary", "that", "maps", "layer", "names", "to", "taggers", "that", "can", "create", "that", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L346-L360
estnltk/estnltk
estnltk/text.py
Text.tag
def tag(self, layer): """Tag the annotations of given layer. It can automatically tag any built-in layer type.""" mapping = self.layer_tagger_mapping if layer in mapping: mapping[layer]() return self
python
def tag(self, layer): """Tag the annotations of given layer. It can automatically tag any built-in layer type.""" mapping = self.layer_tagger_mapping if layer in mapping: mapping[layer]() return self
[ "def", "tag", "(", "self", ",", "layer", ")", ":", "mapping", "=", "self", ".", "layer_tagger_mapping", "if", "layer", "in", "mapping", ":", "mapping", "[", "layer", "]", "(", ")", "return", "self" ]
Tag the annotations of given layer. It can automatically tag any built-in layer type.
[ "Tag", "the", "annotations", "of", "given", "layer", ".", "It", "can", "automatically", "tag", "any", "built", "-", "in", "layer", "type", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L362-L367
estnltk/estnltk
estnltk/text.py
Text.tokenize_paragraphs
def tokenize_paragraphs(self): """Apply paragraph tokenization to this Text instance. Creates ``paragraphs`` layer.""" tok = self.__paragraph_tokenizer spans = tok.span_tokenize(self.text) dicts = [] for start, end in spans: dicts.append({'start': start, 'end': end}) ...
python
def tokenize_paragraphs(self): """Apply paragraph tokenization to this Text instance. Creates ``paragraphs`` layer.""" tok = self.__paragraph_tokenizer spans = tok.span_tokenize(self.text) dicts = [] for start, end in spans: dicts.append({'start': start, 'end': end}) ...
[ "def", "tokenize_paragraphs", "(", "self", ")", ":", "tok", "=", "self", ".", "__paragraph_tokenizer", "spans", "=", "tok", ".", "span_tokenize", "(", "self", ".", "text", ")", "dicts", "=", "[", "]", "for", "start", ",", "end", "in", "spans", ":", "di...
Apply paragraph tokenization to this Text instance. Creates ``paragraphs`` layer.
[ "Apply", "paragraph", "tokenization", "to", "this", "Text", "instance", ".", "Creates", "paragraphs", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L369-L377
estnltk/estnltk
estnltk/text.py
Text.paragraph_texts
def paragraph_texts(self): """The list of texts representing ``paragraphs`` layer elements.""" if not self.is_tagged(PARAGRAPHS): self.tokenize_paragraphs() return self.texts(PARAGRAPHS)
python
def paragraph_texts(self): """The list of texts representing ``paragraphs`` layer elements.""" if not self.is_tagged(PARAGRAPHS): self.tokenize_paragraphs() return self.texts(PARAGRAPHS)
[ "def", "paragraph_texts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "PARAGRAPHS", ")", ":", "self", ".", "tokenize_paragraphs", "(", ")", "return", "self", ".", "texts", "(", "PARAGRAPHS", ")" ]
The list of texts representing ``paragraphs`` layer elements.
[ "The", "list", "of", "texts", "representing", "paragraphs", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L387-L391
estnltk/estnltk
estnltk/text.py
Text.paragraph_spans
def paragraph_spans(self): """The list of spans representing ``paragraphs`` layer elements.""" if not self.is_tagged(PARAGRAPHS): self.tokenize_paragraphs() return self.spans(PARAGRAPHS)
python
def paragraph_spans(self): """The list of spans representing ``paragraphs`` layer elements.""" if not self.is_tagged(PARAGRAPHS): self.tokenize_paragraphs() return self.spans(PARAGRAPHS)
[ "def", "paragraph_spans", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "PARAGRAPHS", ")", ":", "self", ".", "tokenize_paragraphs", "(", ")", "return", "self", ".", "spans", "(", "PARAGRAPHS", ")" ]
The list of spans representing ``paragraphs`` layer elements.
[ "The", "list", "of", "spans", "representing", "paragraphs", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L394-L398
estnltk/estnltk
estnltk/text.py
Text.paragraph_starts
def paragraph_starts(self): """The start positions of ``paragraphs`` layer elements.""" if not self.is_tagged(PARAGRAPHS): self.tokenize_paragraphs() return self.starts(PARAGRAPHS)
python
def paragraph_starts(self): """The start positions of ``paragraphs`` layer elements.""" if not self.is_tagged(PARAGRAPHS): self.tokenize_paragraphs() return self.starts(PARAGRAPHS)
[ "def", "paragraph_starts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "PARAGRAPHS", ")", ":", "self", ".", "tokenize_paragraphs", "(", ")", "return", "self", ".", "starts", "(", "PARAGRAPHS", ")" ]
The start positions of ``paragraphs`` layer elements.
[ "The", "start", "positions", "of", "paragraphs", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L401-L405
estnltk/estnltk
estnltk/text.py
Text.paragraph_ends
def paragraph_ends(self): """The end positions of ``paragraphs`` layer elements.""" if not self.is_tagged(PARAGRAPHS): self.tokenize_paragraphs() return self.ends(PARAGRAPHS)
python
def paragraph_ends(self): """The end positions of ``paragraphs`` layer elements.""" if not self.is_tagged(PARAGRAPHS): self.tokenize_paragraphs() return self.ends(PARAGRAPHS)
[ "def", "paragraph_ends", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "PARAGRAPHS", ")", ":", "self", ".", "tokenize_paragraphs", "(", ")", "return", "self", ".", "ends", "(", "PARAGRAPHS", ")" ]
The end positions of ``paragraphs`` layer elements.
[ "The", "end", "positions", "of", "paragraphs", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L408-L412
estnltk/estnltk
estnltk/text.py
Text.tokenize_sentences
def tokenize_sentences(self): """Apply sentence tokenization to this Text instance. Creates ``sentences`` layer. Automatically tokenizes paragraphs, if they are not already tokenized. Also, if word tokenization has already been performed, tries to fit the sentence tokenization ...
python
def tokenize_sentences(self): """Apply sentence tokenization to this Text instance. Creates ``sentences`` layer. Automatically tokenizes paragraphs, if they are not already tokenized. Also, if word tokenization has already been performed, tries to fit the sentence tokenization ...
[ "def", "tokenize_sentences", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "PARAGRAPHS", ")", ":", "self", ".", "tokenize_paragraphs", "(", ")", "tok", "=", "self", ".", "__sentence_tokenizer", "text", "=", "self", ".", "text", "dicts"...
Apply sentence tokenization to this Text instance. Creates ``sentences`` layer. Automatically tokenizes paragraphs, if they are not already tokenized. Also, if word tokenization has already been performed, tries to fit the sentence tokenization into the existing word tokenization;
[ "Apply", "sentence", "tokenization", "to", "this", "Text", "instance", ".", "Creates", "sentences", "layer", ".", "Automatically", "tokenizes", "paragraphs", "if", "they", "are", "not", "already", "tokenized", ".", "Also", "if", "word", "tokenization", "has", "a...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L414-L480
estnltk/estnltk
estnltk/text.py
Text.sentence_texts
def sentence_texts(self): """The list of texts representing ``sentences`` layer elements.""" if not self.is_tagged(SENTENCES): self.tokenize_sentences() return self.texts(SENTENCES)
python
def sentence_texts(self): """The list of texts representing ``sentences`` layer elements.""" if not self.is_tagged(SENTENCES): self.tokenize_sentences() return self.texts(SENTENCES)
[ "def", "sentence_texts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "SENTENCES", ")", ":", "self", ".", "tokenize_sentences", "(", ")", "return", "self", ".", "texts", "(", "SENTENCES", ")" ]
The list of texts representing ``sentences`` layer elements.
[ "The", "list", "of", "texts", "representing", "sentences", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L490-L494
estnltk/estnltk
estnltk/text.py
Text.sentence_spans
def sentence_spans(self): """The list of spans representing ``sentences`` layer elements.""" if not self.is_tagged(SENTENCES): self.tokenize_sentences() return self.spans(SENTENCES)
python
def sentence_spans(self): """The list of spans representing ``sentences`` layer elements.""" if not self.is_tagged(SENTENCES): self.tokenize_sentences() return self.spans(SENTENCES)
[ "def", "sentence_spans", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "SENTENCES", ")", ":", "self", ".", "tokenize_sentences", "(", ")", "return", "self", ".", "spans", "(", "SENTENCES", ")" ]
The list of spans representing ``sentences`` layer elements.
[ "The", "list", "of", "spans", "representing", "sentences", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L497-L501
estnltk/estnltk
estnltk/text.py
Text.sentence_starts
def sentence_starts(self): """The list of start positions representing ``sentences`` layer elements.""" if not self.is_tagged(SENTENCES): self.tokenize_sentences() return self.starts(SENTENCES)
python
def sentence_starts(self): """The list of start positions representing ``sentences`` layer elements.""" if not self.is_tagged(SENTENCES): self.tokenize_sentences() return self.starts(SENTENCES)
[ "def", "sentence_starts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "SENTENCES", ")", ":", "self", ".", "tokenize_sentences", "(", ")", "return", "self", ".", "starts", "(", "SENTENCES", ")" ]
The list of start positions representing ``sentences`` layer elements.
[ "The", "list", "of", "start", "positions", "representing", "sentences", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L504-L508
estnltk/estnltk
estnltk/text.py
Text.sentence_ends
def sentence_ends(self): """The list of end positions representing ``sentences`` layer elements.""" if not self.is_tagged(SENTENCES): self.tokenize_sentences() return self.ends(SENTENCES)
python
def sentence_ends(self): """The list of end positions representing ``sentences`` layer elements.""" if not self.is_tagged(SENTENCES): self.tokenize_sentences() return self.ends(SENTENCES)
[ "def", "sentence_ends", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "SENTENCES", ")", ":", "self", ".", "tokenize_sentences", "(", ")", "return", "self", ".", "ends", "(", "SENTENCES", ")" ]
The list of end positions representing ``sentences`` layer elements.
[ "The", "list", "of", "end", "positions", "representing", "sentences", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L511-L515
estnltk/estnltk
estnltk/text.py
Text.tokenize_words
def tokenize_words(self): """Apply word tokenization and create ``words`` layer. Automatically creates ``paragraphs`` and ``sentences`` layers. """ if not self.is_tagged(SENTENCES): self.tokenize_sentences() tok = self.__word_tokenizer text = self.text ...
python
def tokenize_words(self): """Apply word tokenization and create ``words`` layer. Automatically creates ``paragraphs`` and ``sentences`` layers. """ if not self.is_tagged(SENTENCES): self.tokenize_sentences() tok = self.__word_tokenizer text = self.text ...
[ "def", "tokenize_words", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "SENTENCES", ")", ":", "self", ".", "tokenize_sentences", "(", ")", "tok", "=", "self", ".", "__word_tokenizer", "text", "=", "self", ".", "text", "dicts", "=", ...
Apply word tokenization and create ``words`` layer. Automatically creates ``paragraphs`` and ``sentences`` layers.
[ "Apply", "word", "tokenization", "and", "create", "words", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L517-L534
estnltk/estnltk
estnltk/text.py
Text.tag_analysis
def tag_analysis(self): """Tag ``words`` layer with morphological analysis attributes.""" if not self.is_tagged(WORDS): self.tokenize_words() sentences = self.divide(WORDS, SENTENCES) for sentence in sentences: texts = [word[TEXT] for word in sentence] ...
python
def tag_analysis(self): """Tag ``words`` layer with morphological analysis attributes.""" if not self.is_tagged(WORDS): self.tokenize_words() sentences = self.divide(WORDS, SENTENCES) for sentence in sentences: texts = [word[TEXT] for word in sentence] ...
[ "def", "tag_analysis", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "sentences", "=", "self", ".", "divide", "(", "WORDS", ",", "SENTENCES", ")", "for", "sentence", "in",...
Tag ``words`` layer with morphological analysis attributes.
[ "Tag", "words", "layer", "with", "morphological", "analysis", "attributes", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L536-L547
estnltk/estnltk
estnltk/text.py
Text.word_texts
def word_texts(self): """The list of words representing ``words`` layer elements.""" if not self.is_tagged(WORDS): self.tokenize_words() return [word[TEXT] for word in self[WORDS]]
python
def word_texts(self): """The list of words representing ``words`` layer elements.""" if not self.is_tagged(WORDS): self.tokenize_words() return [word[TEXT] for word in self[WORDS]]
[ "def", "word_texts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "return", "[", "word", "[", "TEXT", "]", "for", "word", "in", "self", "[", "WORDS", "]", "]" ]
The list of words representing ``words`` layer elements.
[ "The", "list", "of", "words", "representing", "words", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L557-L561
estnltk/estnltk
estnltk/text.py
Text.word_spans
def word_spans(self): """The list of spans representing ``words`` layer elements.""" if not self.is_tagged(WORDS): self.tokenize_words() return self.spans(WORDS)
python
def word_spans(self): """The list of spans representing ``words`` layer elements.""" if not self.is_tagged(WORDS): self.tokenize_words() return self.spans(WORDS)
[ "def", "word_spans", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "return", "self", ".", "spans", "(", "WORDS", ")" ]
The list of spans representing ``words`` layer elements.
[ "The", "list", "of", "spans", "representing", "words", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L564-L568
estnltk/estnltk
estnltk/text.py
Text.word_starts
def word_starts(self): """The list of start positions representing ``words`` layer elements.""" if not self.is_tagged(WORDS): self.tokenize_words() return self.starts(WORDS)
python
def word_starts(self): """The list of start positions representing ``words`` layer elements.""" if not self.is_tagged(WORDS): self.tokenize_words() return self.starts(WORDS)
[ "def", "word_starts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "return", "self", ".", "starts", "(", "WORDS", ")" ]
The list of start positions representing ``words`` layer elements.
[ "The", "list", "of", "start", "positions", "representing", "words", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L571-L575
estnltk/estnltk
estnltk/text.py
Text.word_ends
def word_ends(self): """The list of end positions representing ``words`` layer elements.""" if not self.is_tagged(WORDS): self.tokenize_words() return self.ends(WORDS)
python
def word_ends(self): """The list of end positions representing ``words`` layer elements.""" if not self.is_tagged(WORDS): self.tokenize_words() return self.ends(WORDS)
[ "def", "word_ends", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "return", "self", ".", "ends", "(", "WORDS", ")" ]
The list of end positions representing ``words`` layer elements.
[ "The", "list", "of", "end", "positions", "representing", "words", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L578-L582
estnltk/estnltk
estnltk/text.py
Text.analysis
def analysis(self): """The list of analysis of ``words`` layer elements.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() return [word[ANALYSIS] for word in self.words]
python
def analysis(self): """The list of analysis of ``words`` layer elements.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() return [word[ANALYSIS] for word in self.words]
[ "def", "analysis", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "return", "[", "word", "[", "ANALYSIS", "]", "for", "word", "in", "self", ".", "words", "]" ]
The list of analysis of ``words`` layer elements.
[ "The", "list", "of", "analysis", "of", "words", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L585-L589
estnltk/estnltk
estnltk/text.py
Text.get_analysis_element
def get_analysis_element(self, element, sep='|'): """The list of analysis elements of ``words`` layer. Parameters ---------- element: str The name of the element, for example "lemma", "postag". sep: str The separator for ambiguous analysis (default: "|")....
python
def get_analysis_element(self, element, sep='|'): """The list of analysis elements of ``words`` layer. Parameters ---------- element: str The name of the element, for example "lemma", "postag". sep: str The separator for ambiguous analysis (default: "|")....
[ "def", "get_analysis_element", "(", "self", ",", "element", ",", "sep", "=", "'|'", ")", ":", "return", "[", "self", ".", "__get_key", "(", "word", "[", "ANALYSIS", "]", ",", "element", ",", "sep", ")", "for", "word", "in", "self", ".", "words", "]" ...
The list of analysis elements of ``words`` layer. Parameters ---------- element: str The name of the element, for example "lemma", "postag". sep: str The separator for ambiguous analysis (default: "|"). As morphological analysis cannot always yield un...
[ "The", "list", "of", "analysis", "elements", "of", "words", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L603-L615
estnltk/estnltk
estnltk/text.py
Text.roots
def roots(self): """The list of word roots. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): self.tag_analysis(...
python
def roots(self): """The list of word roots. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): self.tag_analysis(...
[ "def", "roots", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "return", "self", ".", "get_analysis_element", "(", "ROOT", ")" ]
The list of word roots. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries.
[ "The", "list", "of", "word", "roots", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L618-L626
estnltk/estnltk
estnltk/text.py
Text.lemmas
def lemmas(self): """The list of lemmas. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): self.tag_analysis() ...
python
def lemmas(self): """The list of lemmas. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): self.tag_analysis() ...
[ "def", "lemmas", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "return", "self", ".", "get_analysis_element", "(", "LEMMA", ")" ]
The list of lemmas. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries.
[ "The", "list", "of", "lemmas", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L629-L637
estnltk/estnltk
estnltk/text.py
Text.lemma_lists
def lemma_lists(self): """Lemma lists. Ambiguous cases are separate list elements. """ if not self.is_tagged(ANALYSIS): self.tag_analysis() return [[an[LEMMA] for an in word[ANALYSIS]] for word in self[WORDS]]
python
def lemma_lists(self): """Lemma lists. Ambiguous cases are separate list elements. """ if not self.is_tagged(ANALYSIS): self.tag_analysis() return [[an[LEMMA] for an in word[ANALYSIS]] for word in self[WORDS]]
[ "def", "lemma_lists", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "return", "[", "[", "an", "[", "LEMMA", "]", "for", "an", "in", "word", "[", "ANALYSIS", "]", "]",...
Lemma lists. Ambiguous cases are separate list elements.
[ "Lemma", "lists", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L640-L647
estnltk/estnltk
estnltk/text.py
Text.endings
def endings(self): """The list of word endings. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): self.tag_analy...
python
def endings(self): """The list of word endings. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): self.tag_analy...
[ "def", "endings", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "return", "self", ".", "get_analysis_element", "(", "ENDING", ")" ]
The list of word endings. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries.
[ "The", "list", "of", "word", "endings", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L650-L658
estnltk/estnltk
estnltk/text.py
Text.forms
def forms(self): """Tthe list of word forms. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): self.tag_analysis...
python
def forms(self): """Tthe list of word forms. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): self.tag_analysis...
[ "def", "forms", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "return", "self", ".", "get_analysis_element", "(", "FORM", ")" ]
Tthe list of word forms. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries.
[ "Tthe", "list", "of", "word", "forms", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L661-L669
estnltk/estnltk
estnltk/text.py
Text.postags
def postags(self): """The list of word part-of-speech tags. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): se...
python
def postags(self): """The list of word part-of-speech tags. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries. """ if not self.is_tagged(ANALYSIS): se...
[ "def", "postags", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "return", "self", ".", "get_analysis_element", "(", "POSTAG", ")" ]
The list of word part-of-speech tags. Ambiguous cases are separated with pipe character by default. Use :py:meth:`~estnltk.text.Text.get_analysis_element` to specify custom separator for ambiguous entries.
[ "The", "list", "of", "word", "part", "-", "of", "-", "speech", "tags", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L672-L680
estnltk/estnltk
estnltk/text.py
Text.postag_descriptions
def postag_descriptions(self): """Human-readable POS-tag descriptions.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() return [POSTAG_DESCRIPTIONS.get(tag, '') for tag in self.get_analysis_element(POSTAG)]
python
def postag_descriptions(self): """Human-readable POS-tag descriptions.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() return [POSTAG_DESCRIPTIONS.get(tag, '') for tag in self.get_analysis_element(POSTAG)]
[ "def", "postag_descriptions", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "return", "[", "POSTAG_DESCRIPTIONS", ".", "get", "(", "tag", ",", "''", ")", "for", "tag", "i...
Human-readable POS-tag descriptions.
[ "Human", "-", "readable", "POS", "-", "tag", "descriptions", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L689-L693
estnltk/estnltk
estnltk/text.py
Text.root_tokens
def root_tokens(self): """Root tokens of word roots.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() return self.get_analysis_element(ROOT_TOKENS)
python
def root_tokens(self): """Root tokens of word roots.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() return self.get_analysis_element(ROOT_TOKENS)
[ "def", "root_tokens", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "return", "self", ".", "get_analysis_element", "(", "ROOT_TOKENS", ")" ]
Root tokens of word roots.
[ "Root", "tokens", "of", "word", "roots", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L696-L700
estnltk/estnltk
estnltk/text.py
Text.descriptions
def descriptions(self): """Human readable word descriptions.""" descs = [] for postag, form in zip(self.postags, self.forms): desc = VERB_TYPES.get(form, '') if len(desc) == 0: toks = form.split(' ') if len(toks) == 2: p...
python
def descriptions(self): """Human readable word descriptions.""" descs = [] for postag, form in zip(self.postags, self.forms): desc = VERB_TYPES.get(form, '') if len(desc) == 0: toks = form.split(' ') if len(toks) == 2: p...
[ "def", "descriptions", "(", "self", ")", ":", "descs", "=", "[", "]", "for", "postag", ",", "form", "in", "zip", "(", "self", ".", "postags", ",", "self", ".", "forms", ")", ":", "desc", "=", "VERB_TYPES", ".", "get", "(", "form", ",", "''", ")",...
Human readable word descriptions.
[ "Human", "readable", "word", "descriptions", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L703-L720
estnltk/estnltk
estnltk/text.py
Text.tag_syntax_vislcg3
def tag_syntax_vislcg3(self): """ Changes default syntactic parser to VISLCG3Parser, performs syntactic analysis, and stores the results in the layer named LAYER_VISLCG3.""" if not self.__syntactic_parser or not isinstance(self.__syntactic_parser, VISLCG3Parser): self.__syntactic...
python
def tag_syntax_vislcg3(self): """ Changes default syntactic parser to VISLCG3Parser, performs syntactic analysis, and stores the results in the layer named LAYER_VISLCG3.""" if not self.__syntactic_parser or not isinstance(self.__syntactic_parser, VISLCG3Parser): self.__syntactic...
[ "def", "tag_syntax_vislcg3", "(", "self", ")", ":", "if", "not", "self", ".", "__syntactic_parser", "or", "not", "isinstance", "(", "self", ".", "__syntactic_parser", ",", "VISLCG3Parser", ")", ":", "self", ".", "__syntactic_parser", "=", "VISLCG3Parser", "(", ...
Changes default syntactic parser to VISLCG3Parser, performs syntactic analysis, and stores the results in the layer named LAYER_VISLCG3.
[ "Changes", "default", "syntactic", "parser", "to", "VISLCG3Parser", "performs", "syntactic", "analysis", "and", "stores", "the", "results", "in", "the", "layer", "named", "LAYER_VISLCG3", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L722-L727
estnltk/estnltk
estnltk/text.py
Text.tag_syntax_maltparser
def tag_syntax_maltparser(self): """ Changes default syntactic parser to MaltParser, performs syntactic analysis, and stores the results in the layer named LAYER_CONLL.""" if not self.__syntactic_parser or not isinstance(self.__syntactic_parser, MaltParser): self.__syntactic_pars...
python
def tag_syntax_maltparser(self): """ Changes default syntactic parser to MaltParser, performs syntactic analysis, and stores the results in the layer named LAYER_CONLL.""" if not self.__syntactic_parser or not isinstance(self.__syntactic_parser, MaltParser): self.__syntactic_pars...
[ "def", "tag_syntax_maltparser", "(", "self", ")", ":", "if", "not", "self", ".", "__syntactic_parser", "or", "not", "isinstance", "(", "self", ".", "__syntactic_parser", ",", "MaltParser", ")", ":", "self", ".", "__syntactic_parser", "=", "MaltParser", "(", ")...
Changes default syntactic parser to MaltParser, performs syntactic analysis, and stores the results in the layer named LAYER_CONLL.
[ "Changes", "default", "syntactic", "parser", "to", "MaltParser", "performs", "syntactic", "analysis", "and", "stores", "the", "results", "in", "the", "layer", "named", "LAYER_CONLL", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L729-L734
estnltk/estnltk
estnltk/text.py
Text.tag_syntax
def tag_syntax(self): """ Parses this text with the syntactic analyzer (``self.__syntactic_parser``), and stores the found syntactic analyses: into the layer LAYER_CONLL (if MaltParser is used, default), or into the layer LAYER_VISLCG3 (if VISLCG3Parser is used). """ # ...
python
def tag_syntax(self): """ Parses this text with the syntactic analyzer (``self.__syntactic_parser``), and stores the found syntactic analyses: into the layer LAYER_CONLL (if MaltParser is used, default), or into the layer LAYER_VISLCG3 (if VISLCG3Parser is used). """ # ...
[ "def", "tag_syntax", "(", "self", ")", ":", "# Load default Syntactic tagger:", "if", "self", ".", "__syntactic_parser", "is", "None", ":", "self", ".", "__syntactic_parser", "=", "load_default_syntactic_parser", "(", ")", "if", "not", "self", ".", "is_tagged", "(...
Parses this text with the syntactic analyzer (``self.__syntactic_parser``), and stores the found syntactic analyses: into the layer LAYER_CONLL (if MaltParser is used, default), or into the layer LAYER_VISLCG3 (if VISLCG3Parser is used).
[ "Parses", "this", "text", "with", "the", "syntactic", "analyzer", "(", "self", ".", "__syntactic_parser", ")", "and", "stores", "the", "found", "syntactic", "analyses", ":", "into", "the", "layer", "LAYER_CONLL", "(", "if", "MaltParser", "is", "used", "default...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L736-L756
estnltk/estnltk
estnltk/text.py
Text.syntax_trees
def syntax_trees( self, layer=None ): """ Builds syntactic trees (estnltk.syntax.utils.Tree objects) from syntactic annotations and returns as a list. If the input argument *layer* is not specified, the type of the syntactic parser is used to decide, which synt...
python
def syntax_trees( self, layer=None ): """ Builds syntactic trees (estnltk.syntax.utils.Tree objects) from syntactic annotations and returns as a list. If the input argument *layer* is not specified, the type of the syntactic parser is used to decide, which synt...
[ "def", "syntax_trees", "(", "self", ",", "layer", "=", "None", ")", ":", "# If no layer specified, decide the layer based on the type of syntactic", "# analyzer used:", "if", "not", "layer", "and", "self", ".", "__syntactic_parser", ":", "if", "isinstance", "(", "self",...
Builds syntactic trees (estnltk.syntax.utils.Tree objects) from syntactic annotations and returns as a list. If the input argument *layer* is not specified, the type of the syntactic parser is used to decide, which syntactic analysis layer should be produc...
[ "Builds", "syntactic", "trees", "(", "estnltk", ".", "syntax", ".", "utils", ".", "Tree", "objects", ")", "from", "syntactic", "annotations", "and", "returns", "as", "a", "list", ".", "If", "the", "input", "argument", "*", "layer", "*", "is", "not", "spe...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L758-L798
estnltk/estnltk
estnltk/text.py
Text.tag_labels
def tag_labels(self): """Tag named entity labels in the ``words`` layer.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() if self.__ner_tagger is None: self.__ner_tagger = load_default_ner_tagger() self.__ner_tagger.tag_document(self) return self
python
def tag_labels(self): """Tag named entity labels in the ``words`` layer.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() if self.__ner_tagger is None: self.__ner_tagger = load_default_ner_tagger() self.__ner_tagger.tag_document(self) return self
[ "def", "tag_labels", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "if", "self", ".", "__ner_tagger", "is", "None", ":", "self", ".", "__ner_tagger", "=", "load_default_ner...
Tag named entity labels in the ``words`` layer.
[ "Tag", "named", "entity", "labels", "in", "the", "words", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L812-L819
estnltk/estnltk
estnltk/text.py
Text.labels
def labels(self): """Named entity labels.""" if not self.is_tagged(LABEL): self.tag_labels() return [word[LABEL] for word in self.words]
python
def labels(self): """Named entity labels.""" if not self.is_tagged(LABEL): self.tag_labels() return [word[LABEL] for word in self.words]
[ "def", "labels", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "LABEL", ")", ":", "self", ".", "tag_labels", "(", ")", "return", "[", "word", "[", "LABEL", "]", "for", "word", "in", "self", ".", "words", "]" ]
Named entity labels.
[ "Named", "entity", "labels", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L822-L826
estnltk/estnltk
estnltk/text.py
Text.tag_named_entities
def tag_named_entities(self): """Tag ``named_entities`` layer. This automatically performs morphological analysis along with all dependencies. """ if not self.is_tagged(LABEL): self.tag_labels() nes = [] word_start = -1 labels = self.labels + ['O'] # ...
python
def tag_named_entities(self): """Tag ``named_entities`` layer. This automatically performs morphological analysis along with all dependencies. """ if not self.is_tagged(LABEL): self.tag_labels() nes = [] word_start = -1 labels = self.labels + ['O'] # ...
[ "def", "tag_named_entities", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "LABEL", ")", ":", "self", ".", "tag_labels", "(", ")", "nes", "=", "[", "]", "word_start", "=", "-", "1", "labels", "=", "self", ".", "labels", "+", "[...
Tag ``named_entities`` layer. This automatically performs morphological analysis along with all dependencies.
[ "Tag", "named_entities", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L828-L852
estnltk/estnltk
estnltk/text.py
Text.named_entities
def named_entities(self): """The elements of ``named_entities`` layer.""" if not self.is_tagged(NAMED_ENTITIES): self.tag_named_entities() phrases = self.split_by(NAMED_ENTITIES) return [' '.join(phrase.lemmas) for phrase in phrases]
python
def named_entities(self): """The elements of ``named_entities`` layer.""" if not self.is_tagged(NAMED_ENTITIES): self.tag_named_entities() phrases = self.split_by(NAMED_ENTITIES) return [' '.join(phrase.lemmas) for phrase in phrases]
[ "def", "named_entities", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "NAMED_ENTITIES", ")", ":", "self", ".", "tag_named_entities", "(", ")", "phrases", "=", "self", ".", "split_by", "(", "NAMED_ENTITIES", ")", "return", "[", "' '", ...
The elements of ``named_entities`` layer.
[ "The", "elements", "of", "named_entities", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L855-L860
estnltk/estnltk
estnltk/text.py
Text.named_entity_texts
def named_entity_texts(self): """The texts representing named entities.""" if not self.is_tagged(NAMED_ENTITIES): self.tag_named_entities() return self.texts(NAMED_ENTITIES)
python
def named_entity_texts(self): """The texts representing named entities.""" if not self.is_tagged(NAMED_ENTITIES): self.tag_named_entities() return self.texts(NAMED_ENTITIES)
[ "def", "named_entity_texts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "NAMED_ENTITIES", ")", ":", "self", ".", "tag_named_entities", "(", ")", "return", "self", ".", "texts", "(", "NAMED_ENTITIES", ")" ]
The texts representing named entities.
[ "The", "texts", "representing", "named", "entities", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L863-L867
estnltk/estnltk
estnltk/text.py
Text.named_entity_spans
def named_entity_spans(self): """The spans of named entities.""" if not self.is_tagged(NAMED_ENTITIES): self.tag_named_entities() return self.spans(NAMED_ENTITIES)
python
def named_entity_spans(self): """The spans of named entities.""" if not self.is_tagged(NAMED_ENTITIES): self.tag_named_entities() return self.spans(NAMED_ENTITIES)
[ "def", "named_entity_spans", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "NAMED_ENTITIES", ")", ":", "self", ".", "tag_named_entities", "(", ")", "return", "self", ".", "spans", "(", "NAMED_ENTITIES", ")" ]
The spans of named entities.
[ "The", "spans", "of", "named", "entities", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L870-L874
estnltk/estnltk
estnltk/text.py
Text.named_entity_labels
def named_entity_labels(self): """The named entity labels without BIO prefixes.""" if not self.is_tagged(NAMED_ENTITIES): self.tag_named_entities() return [ne[LABEL] for ne in self[NAMED_ENTITIES]]
python
def named_entity_labels(self): """The named entity labels without BIO prefixes.""" if not self.is_tagged(NAMED_ENTITIES): self.tag_named_entities() return [ne[LABEL] for ne in self[NAMED_ENTITIES]]
[ "def", "named_entity_labels", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "NAMED_ENTITIES", ")", ":", "self", ".", "tag_named_entities", "(", ")", "return", "[", "ne", "[", "LABEL", "]", "for", "ne", "in", "self", "[", "NAMED_ENTIT...
The named entity labels without BIO prefixes.
[ "The", "named", "entity", "labels", "without", "BIO", "prefixes", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L877-L881
estnltk/estnltk
estnltk/text.py
Text.tag_timexes
def tag_timexes(self): """Create ``timexes`` layer. Depends on morphological analysis data in ``words`` layer and tags it automatically, if it is not present.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() if not self.is_tagged(TIMEXES): if self._...
python
def tag_timexes(self): """Create ``timexes`` layer. Depends on morphological analysis data in ``words`` layer and tags it automatically, if it is not present.""" if not self.is_tagged(ANALYSIS): self.tag_analysis() if not self.is_tagged(TIMEXES): if self._...
[ "def", "tag_timexes", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "if", "not", "self", ".", "is_tagged", "(", "TIMEXES", ")", ":", "if", "self", ".", "__timex_tagger", ...
Create ``timexes`` layer. Depends on morphological analysis data in ``words`` layer and tags it automatically, if it is not present.
[ "Create", "timexes", "layer", ".", "Depends", "on", "morphological", "analysis", "data", "in", "words", "layer", "and", "tags", "it", "automatically", "if", "it", "is", "not", "present", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L883-L893
estnltk/estnltk
estnltk/text.py
Text.timex_starts
def timex_starts(self): """The list of start positions of ``timexes`` layer elements.""" if not self.is_tagged(TIMEXES): self.tag_timexes() return self.starts(TIMEXES)
python
def timex_starts(self): """The list of start positions of ``timexes`` layer elements.""" if not self.is_tagged(TIMEXES): self.tag_timexes() return self.starts(TIMEXES)
[ "def", "timex_starts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "TIMEXES", ")", ":", "self", ".", "tag_timexes", "(", ")", "return", "self", ".", "starts", "(", "TIMEXES", ")" ]
The list of start positions of ``timexes`` layer elements.
[ "The", "list", "of", "start", "positions", "of", "timexes", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L923-L927
estnltk/estnltk
estnltk/text.py
Text.timex_ends
def timex_ends(self): """The list of end positions of ``timexes`` layer elements.""" if not self.is_tagged(TIMEXES): self.tag_timexes() return self.ends(TIMEXES)
python
def timex_ends(self): """The list of end positions of ``timexes`` layer elements.""" if not self.is_tagged(TIMEXES): self.tag_timexes() return self.ends(TIMEXES)
[ "def", "timex_ends", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "TIMEXES", ")", ":", "self", ".", "tag_timexes", "(", ")", "return", "self", ".", "ends", "(", "TIMEXES", ")" ]
The list of end positions of ``timexes`` layer elements.
[ "The", "list", "of", "end", "positions", "of", "timexes", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L930-L934
estnltk/estnltk
estnltk/text.py
Text.timex_spans
def timex_spans(self): """The list of spans of ``timexes`` layer elements.""" if not self.is_tagged(TIMEXES): self.tag_timexes() return self.spans(TIMEXES)
python
def timex_spans(self): """The list of spans of ``timexes`` layer elements.""" if not self.is_tagged(TIMEXES): self.tag_timexes() return self.spans(TIMEXES)
[ "def", "timex_spans", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "TIMEXES", ")", ":", "self", ".", "tag_timexes", "(", ")", "return", "self", ".", "spans", "(", "TIMEXES", ")" ]
The list of spans of ``timexes`` layer elements.
[ "The", "list", "of", "spans", "of", "timexes", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L937-L941
estnltk/estnltk
estnltk/text.py
Text.tag_clause_annotations
def tag_clause_annotations(self): """Tag clause annotations in ``words`` layer. Depends on morphological analysis. """ if not self.is_tagged(ANALYSIS): self.tag_analysis() if self.__clause_segmenter is None: self.__clause_segmenter = load_default_clauseseg...
python
def tag_clause_annotations(self): """Tag clause annotations in ``words`` layer. Depends on morphological analysis. """ if not self.is_tagged(ANALYSIS): self.tag_analysis() if self.__clause_segmenter is None: self.__clause_segmenter = load_default_clauseseg...
[ "def", "tag_clause_annotations", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "ANALYSIS", ")", ":", "self", ".", "tag_analysis", "(", ")", "if", "self", ".", "__clause_segmenter", "is", "None", ":", "self", ".", "__clause_segmenter", ...
Tag clause annotations in ``words`` layer. Depends on morphological analysis.
[ "Tag", "clause", "annotations", "in", "words", "layer", ".", "Depends", "on", "morphological", "analysis", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L943-L951
estnltk/estnltk
estnltk/text.py
Text.clause_annotations
def clause_annotations(self): """The list of clause annotations in ``words`` layer.""" if not self.is_tagged(CLAUSE_ANNOTATION): self.tag_clause_annotations() return [word.get(CLAUSE_ANNOTATION, None) for word in self[WORDS]]
python
def clause_annotations(self): """The list of clause annotations in ``words`` layer.""" if not self.is_tagged(CLAUSE_ANNOTATION): self.tag_clause_annotations() return [word.get(CLAUSE_ANNOTATION, None) for word in self[WORDS]]
[ "def", "clause_annotations", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "CLAUSE_ANNOTATION", ")", ":", "self", ".", "tag_clause_annotations", "(", ")", "return", "[", "word", ".", "get", "(", "CLAUSE_ANNOTATION", ",", "None", ")", "...
The list of clause annotations in ``words`` layer.
[ "The", "list", "of", "clause", "annotations", "in", "words", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L954-L958
estnltk/estnltk
estnltk/text.py
Text.clause_indices
def clause_indices(self): """The list of clause indices in ``words`` layer. The indices are unique only in the boundary of a single sentence. """ if not self.is_tagged(CLAUSE_ANNOTATION): self.tag_clause_annotations() return [word.get(CLAUSE_IDX, None) for word in sel...
python
def clause_indices(self): """The list of clause indices in ``words`` layer. The indices are unique only in the boundary of a single sentence. """ if not self.is_tagged(CLAUSE_ANNOTATION): self.tag_clause_annotations() return [word.get(CLAUSE_IDX, None) for word in sel...
[ "def", "clause_indices", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "CLAUSE_ANNOTATION", ")", ":", "self", ".", "tag_clause_annotations", "(", ")", "return", "[", "word", ".", "get", "(", "CLAUSE_IDX", ",", "None", ")", "for", "wo...
The list of clause indices in ``words`` layer. The indices are unique only in the boundary of a single sentence.
[ "The", "list", "of", "clause", "indices", "in", "words", "layer", ".", "The", "indices", "are", "unique", "only", "in", "the", "boundary", "of", "a", "single", "sentence", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L961-L967
estnltk/estnltk
estnltk/text.py
Text.tag_clauses
def tag_clauses(self): """Create ``clauses`` multilayer. Depends on clause annotations.""" if not self.is_tagged(CLAUSE_ANNOTATION): self.tag_clause_annotations() def from_sentence(words): """Function that extracts clauses from a signle sentence.""" ...
python
def tag_clauses(self): """Create ``clauses`` multilayer. Depends on clause annotations.""" if not self.is_tagged(CLAUSE_ANNOTATION): self.tag_clause_annotations() def from_sentence(words): """Function that extracts clauses from a signle sentence.""" ...
[ "def", "tag_clauses", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "CLAUSE_ANNOTATION", ")", ":", "self", ".", "tag_clause_annotations", "(", ")", "def", "from_sentence", "(", "words", ")", ":", "\"\"\"Function that extracts clauses from a si...
Create ``clauses`` multilayer. Depends on clause annotations.
[ "Create", "clauses", "multilayer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L969-L997
estnltk/estnltk
estnltk/text.py
Text.clause_texts
def clause_texts(self): """The texts of ``clauses`` multilayer elements. Non-consequent spans are concatenated with space character by default. Use :py:meth:`~estnltk.text.Text.texts` method to supply custom separators. """ if not self.is_tagged(CLAUSES): self.tag_cla...
python
def clause_texts(self): """The texts of ``clauses`` multilayer elements. Non-consequent spans are concatenated with space character by default. Use :py:meth:`~estnltk.text.Text.texts` method to supply custom separators. """ if not self.is_tagged(CLAUSES): self.tag_cla...
[ "def", "clause_texts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "CLAUSES", ")", ":", "self", ".", "tag_clauses", "(", ")", "return", "self", ".", "texts", "(", "CLAUSES", ")" ]
The texts of ``clauses`` multilayer elements. Non-consequent spans are concatenated with space character by default. Use :py:meth:`~estnltk.text.Text.texts` method to supply custom separators.
[ "The", "texts", "of", "clauses", "multilayer", "elements", ".", "Non", "-", "consequent", "spans", "are", "concatenated", "with", "space", "character", "by", "default", ".", "Use", ":", "py", ":", "meth", ":", "~estnltk", ".", "text", ".", "Text", ".", "...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1007-L1014
estnltk/estnltk
estnltk/text.py
Text.tag_verb_chains
def tag_verb_chains(self): """Create ``verb_chains`` layer. Depends on ``clauses`` layer. """ if not self.is_tagged(CLAUSES): self.tag_clauses() if self.__verbchain_detector is None: self.__verbchain_detector = load_default_verbchain_detector() ...
python
def tag_verb_chains(self): """Create ``verb_chains`` layer. Depends on ``clauses`` layer. """ if not self.is_tagged(CLAUSES): self.tag_clauses() if self.__verbchain_detector is None: self.__verbchain_detector = load_default_verbchain_detector() ...
[ "def", "tag_verb_chains", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "CLAUSES", ")", ":", "self", ".", "tag_clauses", "(", ")", "if", "self", ".", "__verbchain_detector", "is", "None", ":", "self", ".", "__verbchain_detector", "=", ...
Create ``verb_chains`` layer. Depends on ``clauses`` layer.
[ "Create", "verb_chains", "layer", ".", "Depends", "on", "clauses", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1016-L1037
estnltk/estnltk
estnltk/text.py
Text.verb_chain_texts
def verb_chain_texts(self): """The list of texts of ``verb_chains`` layer elements.""" if not self.is_tagged(VERB_CHAINS): self.tag_verb_chains() return self.texts(VERB_CHAINS)
python
def verb_chain_texts(self): """The list of texts of ``verb_chains`` layer elements.""" if not self.is_tagged(VERB_CHAINS): self.tag_verb_chains() return self.texts(VERB_CHAINS)
[ "def", "verb_chain_texts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "VERB_CHAINS", ")", ":", "self", ".", "tag_verb_chains", "(", ")", "return", "self", ".", "texts", "(", "VERB_CHAINS", ")" ]
The list of texts of ``verb_chains`` layer elements.
[ "The", "list", "of", "texts", "of", "verb_chains", "layer", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1047-L1051
estnltk/estnltk
estnltk/text.py
Text.verb_chain_starts
def verb_chain_starts(self): """The start positions of ``verb_chains`` elements.""" if not self.is_tagged(VERB_CHAINS): self.tag_verb_chains() return self.starts(VERB_CHAINS)
python
def verb_chain_starts(self): """The start positions of ``verb_chains`` elements.""" if not self.is_tagged(VERB_CHAINS): self.tag_verb_chains() return self.starts(VERB_CHAINS)
[ "def", "verb_chain_starts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "VERB_CHAINS", ")", ":", "self", ".", "tag_verb_chains", "(", ")", "return", "self", ".", "starts", "(", "VERB_CHAINS", ")" ]
The start positions of ``verb_chains`` elements.
[ "The", "start", "positions", "of", "verb_chains", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1094-L1098
estnltk/estnltk
estnltk/text.py
Text.verb_chain_ends
def verb_chain_ends(self): """The end positions of ``verb_chains`` elements.""" if not self.is_tagged(VERB_CHAINS): self.tag_verb_chains() return self.ends(VERB_CHAINS)
python
def verb_chain_ends(self): """The end positions of ``verb_chains`` elements.""" if not self.is_tagged(VERB_CHAINS): self.tag_verb_chains() return self.ends(VERB_CHAINS)
[ "def", "verb_chain_ends", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "VERB_CHAINS", ")", ":", "self", ".", "tag_verb_chains", "(", ")", "return", "self", ".", "ends", "(", "VERB_CHAINS", ")" ]
The end positions of ``verb_chains`` elements.
[ "The", "end", "positions", "of", "verb_chains", "elements", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1101-L1105
estnltk/estnltk
estnltk/text.py
Text.tag_wordnet
def tag_wordnet(self, **kwargs): """Create wordnet attribute in ``words`` layer. See :py:meth:`~estnltk.text.wordnet_tagger.WordnetTagger.tag_text` method for applicable keyword arguments. """ global wordnet_tagger if wordnet_tagger is None: # cached wn tagger ...
python
def tag_wordnet(self, **kwargs): """Create wordnet attribute in ``words`` layer. See :py:meth:`~estnltk.text.wordnet_tagger.WordnetTagger.tag_text` method for applicable keyword arguments. """ global wordnet_tagger if wordnet_tagger is None: # cached wn tagger ...
[ "def", "tag_wordnet", "(", "self", ",", "*", "*", "kwargs", ")", ":", "global", "wordnet_tagger", "if", "wordnet_tagger", "is", "None", ":", "# cached wn tagger", "wordnet_tagger", "=", "WordnetTagger", "(", ")", "self", ".", "__wordnet_tagger", "=", "wordnet_ta...
Create wordnet attribute in ``words`` layer. See :py:meth:`~estnltk.text.wordnet_tagger.WordnetTagger.tag_text` method for applicable keyword arguments.
[ "Create", "wordnet", "attribute", "in", "words", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1112-L1124
estnltk/estnltk
estnltk/text.py
Text.wordnet_annotations
def wordnet_annotations(self): """The list of wordnet annotations of ``words`` layer.""" if not self.is_tagged(WORDNET): self.tag_wordnet() return [[a[WORDNET] for a in analysis] for analysis in self.analysis]
python
def wordnet_annotations(self): """The list of wordnet annotations of ``words`` layer.""" if not self.is_tagged(WORDNET): self.tag_wordnet() return [[a[WORDNET] for a in analysis] for analysis in self.analysis]
[ "def", "wordnet_annotations", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDNET", ")", ":", "self", ".", "tag_wordnet", "(", ")", "return", "[", "[", "a", "[", "WORDNET", "]", "for", "a", "in", "analysis", "]", "for", "analy...
The list of wordnet annotations of ``words`` layer.
[ "The", "list", "of", "wordnet", "annotations", "of", "words", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1127-L1131
estnltk/estnltk
estnltk/text.py
Text.synsets
def synsets(self): """The list of annotated synsets of ``words`` layer.""" synsets = [] for wn_annots in self.wordnet_annotations: word_synsets = [] for wn_annot in wn_annots: for synset in wn_annot.get(SYNSETS, []): word_synsets.append...
python
def synsets(self): """The list of annotated synsets of ``words`` layer.""" synsets = [] for wn_annots in self.wordnet_annotations: word_synsets = [] for wn_annot in wn_annots: for synset in wn_annot.get(SYNSETS, []): word_synsets.append...
[ "def", "synsets", "(", "self", ")", ":", "synsets", "=", "[", "]", "for", "wn_annots", "in", "self", ".", "wordnet_annotations", ":", "word_synsets", "=", "[", "]", "for", "wn_annot", "in", "wn_annots", ":", "for", "synset", "in", "wn_annot", ".", "get",...
The list of annotated synsets of ``words`` layer.
[ "The", "list", "of", "annotated", "synsets", "of", "words", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1134-L1143
estnltk/estnltk
estnltk/text.py
Text.word_literals
def word_literals(self): """The list of literals per word in ``words`` layer.""" literals = [] for word_synsets in self.synsets: word_literals = set() for synset in word_synsets: for variant in synset.get(SYN_VARIANTS): if LITERAL in va...
python
def word_literals(self): """The list of literals per word in ``words`` layer.""" literals = [] for word_synsets in self.synsets: word_literals = set() for synset in word_synsets: for variant in synset.get(SYN_VARIANTS): if LITERAL in va...
[ "def", "word_literals", "(", "self", ")", ":", "literals", "=", "[", "]", "for", "word_synsets", "in", "self", ".", "synsets", ":", "word_literals", "=", "set", "(", ")", "for", "synset", "in", "word_synsets", ":", "for", "variant", "in", "synset", ".", ...
The list of literals per word in ``words`` layer.
[ "The", "list", "of", "literals", "per", "word", "in", "words", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1146-L1156
estnltk/estnltk
estnltk/text.py
Text.spelling
def spelling(self): """Flag incorrectly spelled words. Returns a list of booleans, where element at each position denotes, if the word at the same position is spelled correctly. """ if not self.is_tagged(WORDS): self.tokenize_words() return [data[SPELLING] for...
python
def spelling(self): """Flag incorrectly spelled words. Returns a list of booleans, where element at each position denotes, if the word at the same position is spelled correctly. """ if not self.is_tagged(WORDS): self.tokenize_words() return [data[SPELLING] for...
[ "def", "spelling", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "return", "[", "data", "[", "SPELLING", "]", "for", "data", "in", "vabamorf", ".", "spellcheck", "(", "s...
Flag incorrectly spelled words. Returns a list of booleans, where element at each position denotes, if the word at the same position is spelled correctly.
[ "Flag", "incorrectly", "spelled", "words", ".", "Returns", "a", "list", "of", "booleans", "where", "element", "at", "each", "position", "denotes", "if", "the", "word", "at", "the", "same", "position", "is", "spelled", "correctly", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1163-L1170
estnltk/estnltk
estnltk/text.py
Text.spelling_suggestions
def spelling_suggestions(self): """The list of spelling suggestions per misspelled word.""" if not self.is_tagged(WORDS): self.tokenize_words() return [data[SUGGESTIONS] for data in vabamorf.spellcheck(self.word_texts, suggestions=True)]
python
def spelling_suggestions(self): """The list of spelling suggestions per misspelled word.""" if not self.is_tagged(WORDS): self.tokenize_words() return [data[SUGGESTIONS] for data in vabamorf.spellcheck(self.word_texts, suggestions=True)]
[ "def", "spelling_suggestions", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "return", "[", "data", "[", "SUGGESTIONS", "]", "for", "data", "in", "vabamorf", ".", "spellchec...
The list of spelling suggestions per misspelled word.
[ "The", "list", "of", "spelling", "suggestions", "per", "misspelled", "word", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1173-L1177
estnltk/estnltk
estnltk/text.py
Text.spellcheck_results
def spellcheck_results(self): """The list of True/False values denoting the correct spelling of words.""" if not self.is_tagged(WORDS): self.tokenize_words() return vabamorf.spellcheck(self.word_texts, suggestions=True)
python
def spellcheck_results(self): """The list of True/False values denoting the correct spelling of words.""" if not self.is_tagged(WORDS): self.tokenize_words() return vabamorf.spellcheck(self.word_texts, suggestions=True)
[ "def", "spellcheck_results", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "return", "vabamorf", ".", "spellcheck", "(", "self", ".", "word_texts", ",", "suggestions", "=", ...
The list of True/False values denoting the correct spelling of words.
[ "The", "list", "of", "True", "/", "False", "values", "denoting", "the", "correct", "spelling", "of", "words", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1180-L1184
estnltk/estnltk
estnltk/text.py
Text.fix_spelling
def fix_spelling(self): """Fix spelling of the text. Note that this method uses the first suggestion that is given for each misspelled word. It does not perform any sophisticated analysis to determine which one of the suggestions fits best into the context. Returns ----...
python
def fix_spelling(self): """Fix spelling of the text. Note that this method uses the first suggestion that is given for each misspelled word. It does not perform any sophisticated analysis to determine which one of the suggestions fits best into the context. Returns ----...
[ "def", "fix_spelling", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "WORDS", ")", ":", "self", ".", "tokenize_words", "(", ")", "text", "=", "self", ".", "text", "fixed", "=", "vabamorf", ".", "fix_spelling", "(", "self", ".", "...
Fix spelling of the text. Note that this method uses the first suggestion that is given for each misspelled word. It does not perform any sophisticated analysis to determine which one of the suggestions fits best into the context. Returns ------- Text A copy...
[ "Fix", "spelling", "of", "the", "text", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1186-L1213
estnltk/estnltk
estnltk/text.py
Text.clean
def clean(self): """Return a copy of this Text instance with invalid characters removed.""" return Text(self.__text_cleaner.clean(self[TEXT]), **self.__kwargs)
python
def clean(self): """Return a copy of this Text instance with invalid characters removed.""" return Text(self.__text_cleaner.clean(self[TEXT]), **self.__kwargs)
[ "def", "clean", "(", "self", ")", ":", "return", "Text", "(", "self", ".", "__text_cleaner", ".", "clean", "(", "self", "[", "TEXT", "]", ")", ",", "*", "*", "self", ".", "__kwargs", ")" ]
Return a copy of this Text instance with invalid characters removed.
[ "Return", "a", "copy", "of", "this", "Text", "instance", "with", "invalid", "characters", "removed", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1230-L1232
estnltk/estnltk
estnltk/text.py
Text.split_given_spans
def split_given_spans(self, spans, sep=' '): """Split the text into several pieces. Resulting texts have all the layers that are present in the text instance that is splitted. The elements are copied to resulting pieces that are covered by their spans. However, this can result in empty ...
python
def split_given_spans(self, spans, sep=' '): """Split the text into several pieces. Resulting texts have all the layers that are present in the text instance that is splitted. The elements are copied to resulting pieces that are covered by their spans. However, this can result in empty ...
[ "def", "split_given_spans", "(", "self", ",", "spans", ",", "sep", "=", "' '", ")", ":", "N", "=", "len", "(", "spans", ")", "results", "=", "[", "{", "TEXT", ":", "text", "}", "for", "text", "in", "self", ".", "texts_from_spans", "(", "spans", ","...
Split the text into several pieces. Resulting texts have all the layers that are present in the text instance that is splitted. The elements are copied to resulting pieces that are covered by their spans. However, this can result in empty layers if no element of a splitted layer fits into ...
[ "Split", "the", "text", "into", "several", "pieces", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1262-L1294
estnltk/estnltk
estnltk/text.py
Text.split_by
def split_by(self, layer, sep=' '): """Split the text into multiple instances defined by elements of given layer. The spans for layer elements are extracted and feed to :py:meth:`~estnltk.text.Text.split_given_spans` method. Parameters ---------- layer: str ...
python
def split_by(self, layer, sep=' '): """Split the text into multiple instances defined by elements of given layer. The spans for layer elements are extracted and feed to :py:meth:`~estnltk.text.Text.split_given_spans` method. Parameters ---------- layer: str ...
[ "def", "split_by", "(", "self", ",", "layer", ",", "sep", "=", "' '", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "layer", ")", ":", "self", ".", "tag", "(", "layer", ")", "return", "self", ".", "split_given_spans", "(", "self", ".", "spa...
Split the text into multiple instances defined by elements of given layer. The spans for layer elements are extracted and feed to :py:meth:`~estnltk.text.Text.split_given_spans` method. Parameters ---------- layer: str String determining the layer that is used to de...
[ "Split", "the", "text", "into", "multiple", "instances", "defined", "by", "elements", "of", "given", "layer", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1296-L1315
estnltk/estnltk
estnltk/text.py
Text.split_by_regex
def split_by_regex(self, regex_or_pattern, flags=re.U, gaps=True): """Split the text into multiple instances using a regex. Parameters ---------- regex_or_pattern: str or compiled pattern The regular expression to use for splitting. flags: int (default: re.U) ...
python
def split_by_regex(self, regex_or_pattern, flags=re.U, gaps=True): """Split the text into multiple instances using a regex. Parameters ---------- regex_or_pattern: str or compiled pattern The regular expression to use for splitting. flags: int (default: re.U) ...
[ "def", "split_by_regex", "(", "self", ",", "regex_or_pattern", ",", "flags", "=", "re", ".", "U", ",", "gaps", "=", "True", ")", ":", "text", "=", "self", "[", "TEXT", "]", "regex", "=", "regex_or_pattern", "if", "isinstance", "(", "regex", ",", "six",...
Split the text into multiple instances using a regex. Parameters ---------- regex_or_pattern: str or compiled pattern The regular expression to use for splitting. flags: int (default: re.U) The regular expression flags (only used, when user has not supplied compi...
[ "Split", "the", "text", "into", "multiple", "instances", "using", "a", "regex", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1325-L1362
estnltk/estnltk
estnltk/text.py
Text.divide
def divide(self, layer=WORDS, by=SENTENCES): """Divide the Text into pieces by keeping references to original elements, when possible. This is not possible only, if the _element_ is a multispan. Parameters ---------- element: str The element to collect and distribut...
python
def divide(self, layer=WORDS, by=SENTENCES): """Divide the Text into pieces by keeping references to original elements, when possible. This is not possible only, if the _element_ is a multispan. Parameters ---------- element: str The element to collect and distribut...
[ "def", "divide", "(", "self", ",", "layer", "=", "WORDS", ",", "by", "=", "SENTENCES", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "layer", ")", ":", "self", ".", "tag", "(", "layer", ")", "if", "not", "self", ".", "is_tagged", "(", "by...
Divide the Text into pieces by keeping references to original elements, when possible. This is not possible only, if the _element_ is a multispan. Parameters ---------- element: str The element to collect and distribute in resulting bins. by: str Each re...
[ "Divide", "the", "Text", "into", "pieces", "by", "keeping", "references", "to", "original", "elements", "when", "possible", ".", "This", "is", "not", "possible", "only", "if", "the", "_element_", "is", "a", "multispan", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1368-L1388
estnltk/estnltk
estnltk/prettyprinter/marker.py
create_tags_with_concatenated_css_classes
def create_tags_with_concatenated_css_classes(tags): """Function that creates <mark> tags such that they are not overlapping. In order to do this, it concatenates the css classes and stores the concatenated result in new tags. """ current_classes = set() result = [] for pos, group in group_t...
python
def create_tags_with_concatenated_css_classes(tags): """Function that creates <mark> tags such that they are not overlapping. In order to do this, it concatenates the css classes and stores the concatenated result in new tags. """ current_classes = set() result = [] for pos, group in group_t...
[ "def", "create_tags_with_concatenated_css_classes", "(", "tags", ")", ":", "current_classes", "=", "set", "(", ")", "result", "=", "[", "]", "for", "pos", ",", "group", "in", "group_tags_at_same_position", "(", "tags", ")", ":", "opening", ",", "closing", "=",...
Function that creates <mark> tags such that they are not overlapping. In order to do this, it concatenates the css classes and stores the concatenated result in new tags.
[ "Function", "that", "creates", "<mark", ">", "tags", "such", "that", "they", "are", "not", "overlapping", ".", "In", "order", "to", "do", "this", "it", "concatenates", "the", "css", "classes", "and", "stores", "the", "concatenated", "result", "in", "new", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/prettyprinter/marker.py#L100-L132
estnltk/estnltk
estnltk/grammar/conflictresolver.py
resolve_using_maximal_coverage
def resolve_using_maximal_coverage(matches): """Given a list of matches, select a subset of matches such that there are no overlaps and the total number of covered characters is maximal. Parameters ---------- matches: list of Match Returns -------- list of Match """ if len(...
python
def resolve_using_maximal_coverage(matches): """Given a list of matches, select a subset of matches such that there are no overlaps and the total number of covered characters is maximal. Parameters ---------- matches: list of Match Returns -------- list of Match """ if len(...
[ "def", "resolve_using_maximal_coverage", "(", "matches", ")", ":", "if", "len", "(", "matches", ")", "==", "0", ":", "return", "matches", "matches", ".", "sort", "(", ")", "N", "=", "len", "(", "matches", ")", "scores", "=", "[", "len", "(", "match", ...
Given a list of matches, select a subset of matches such that there are no overlaps and the total number of covered characters is maximal. Parameters ---------- matches: list of Match Returns -------- list of Match
[ "Given", "a", "list", "of", "matches", "select", "a", "subset", "of", "matches", "such", "that", "there", "are", "no", "overlaps", "and", "the", "total", "number", "of", "covered", "characters", "is", "maximal", "." ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/grammar/conflictresolver.py#L6-L55
estnltk/estnltk
estnltk/mw_verbs/basic_verbchain_detection.py
_isSeparatedByPossibleClauseBreakers
def _isSeparatedByPossibleClauseBreakers( tokens, wordID1, wordID2, punctForbidden = True, \ commaForbidden = True, \ conjWordsForbidden = True ): ''' Teeb kindlaks, k...
python
def _isSeparatedByPossibleClauseBreakers( tokens, wordID1, wordID2, punctForbidden = True, \ commaForbidden = True, \ conjWordsForbidden = True ): ''' Teeb kindlaks, k...
[ "def", "_isSeparatedByPossibleClauseBreakers", "(", "tokens", ",", "wordID1", ",", "wordID2", ",", "punctForbidden", "=", "True", ",", "commaForbidden", "=", "True", ",", "conjWordsForbidden", "=", "True", ")", ":", "global", "_breakerJaNingEgaVoi", ",", "_breakerAg...
Teeb kindlaks, kas j2rjendi tokens s6naindeksite vahemikus [wordID1, wordID2) (vahemiku algus on inklusiivne) leidub sides6nu (ja/ning/ega/v6i), punktuatsiooni (koma, sidekriipsud, koolon, kolm j2rjestikkust punkti) v6i adverbe-sidendeid aga/kuid/vaid; Lippudega saab kontrolli l6dvendada: ...
[ "Teeb", "kindlaks", "kas", "j2rjendi", "tokens", "s6naindeksite", "vahemikus", "[", "wordID1", "wordID2", ")", "(", "vahemiku", "algus", "on", "inklusiivne", ")", "leidub", "sides6nu", "(", "ja", "/", "ning", "/", "ega", "/", "v6i", ")", "punktuatsiooni", "(...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/basic_verbchain_detection.py#L35-L68
estnltk/estnltk
estnltk/mw_verbs/basic_verbchain_detection.py
_isClauseFinal
def _isClauseFinal( wordID, clauseTokens ): ''' Teeb kindlaks, kas etteantud ID-ga s6na on osalause l6pus: -- s6nale ei j2rgne ykski teine s6na; -- s6nale j2rgnevad vaid punktuatsioonim2rgid ja/v6i sidendid JA/NING/EGA/VÕI; Tagastab True, kui eeltoodud tingimused on t2idetud...
python
def _isClauseFinal( wordID, clauseTokens ): ''' Teeb kindlaks, kas etteantud ID-ga s6na on osalause l6pus: -- s6nale ei j2rgne ykski teine s6na; -- s6nale j2rgnevad vaid punktuatsioonim2rgid ja/v6i sidendid JA/NING/EGA/VÕI; Tagastab True, kui eeltoodud tingimused on t2idetud...
[ "def", "_isClauseFinal", "(", "wordID", ",", "clauseTokens", ")", ":", "jaNingEgaVoi", "=", "WordTemplate", "(", "{", "ROOT", ":", "'^(ja|ning|ega|v[\\u014D\\u00F5]i)$'", ",", "POSTAG", ":", "'[DJ]'", "}", ")", "punktuatsioon", "=", "WordTemplate", "(", "{", "PO...
Teeb kindlaks, kas etteantud ID-ga s6na on osalause l6pus: -- s6nale ei j2rgne ykski teine s6na; -- s6nale j2rgnevad vaid punktuatsioonim2rgid ja/v6i sidendid JA/NING/EGA/VÕI; Tagastab True, kui eeltoodud tingimused on t2idetud, vastasel juhul False;
[ "Teeb", "kindlaks", "kas", "etteantud", "ID", "-", "ga", "s6na", "on", "osalause", "l6pus", ":", "--", "s6nale", "ei", "j2rgne", "ykski", "teine", "s6na", ";", "--", "s6nale", "j2rgnevad", "vaid", "punktuatsioonim2rgid", "ja", "/", "v6i", "sidendid", "JA", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/basic_verbchain_detection.py#L70-L90
estnltk/estnltk
estnltk/mw_verbs/basic_verbchain_detection.py
_isFollowedByComma
def _isFollowedByComma( wordID, clauseTokens ): ''' Teeb kindlaks, kas etteantud ID-ga s6nale j2rgneb vahetult koma; Tagastab True, kui eeltoodud tingimus on t2idetud, vastasel juhul False; ''' koma = WordTemplate({ROOT:'^,+$', POSTAG:'Z'}) for i in range(len(clauseTokens)): ...
python
def _isFollowedByComma( wordID, clauseTokens ): ''' Teeb kindlaks, kas etteantud ID-ga s6nale j2rgneb vahetult koma; Tagastab True, kui eeltoodud tingimus on t2idetud, vastasel juhul False; ''' koma = WordTemplate({ROOT:'^,+$', POSTAG:'Z'}) for i in range(len(clauseTokens)): ...
[ "def", "_isFollowedByComma", "(", "wordID", ",", "clauseTokens", ")", ":", "koma", "=", "WordTemplate", "(", "{", "ROOT", ":", "'^,+$'", ",", "POSTAG", ":", "'Z'", "}", ")", "for", "i", "in", "range", "(", "len", "(", "clauseTokens", ")", ")", ":", "...
Teeb kindlaks, kas etteantud ID-ga s6nale j2rgneb vahetult koma; Tagastab True, kui eeltoodud tingimus on t2idetud, vastasel juhul False;
[ "Teeb", "kindlaks", "kas", "etteantud", "ID", "-", "ga", "s6nale", "j2rgneb", "vahetult", "koma", ";", "Tagastab", "True", "kui", "eeltoodud", "tingimus", "on", "t2idetud", "vastasel", "juhul", "False", ";" ]
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/basic_verbchain_detection.py#L92-L106
estnltk/estnltk
estnltk/mw_verbs/basic_verbchain_detection.py
_canFormAraPhrase
def _canFormAraPhrase( araVerb, otherVerb ): ''' Teeb kindlaks, kas etteantud 'ära' verb (araVerb) yhildub teise verbiga; Arvestab järgimisi ühilduvusi: ains 2. pööre: ära_neg.o + V_o ains 3. pööre: ära_neg.gu + V_gu mitm 1. pööre: ära_neg.me + V_me...
python
def _canFormAraPhrase( araVerb, otherVerb ): ''' Teeb kindlaks, kas etteantud 'ära' verb (araVerb) yhildub teise verbiga; Arvestab järgimisi ühilduvusi: ains 2. pööre: ära_neg.o + V_o ains 3. pööre: ära_neg.gu + V_gu mitm 1. pööre: ära_neg.me + V_me...
[ "def", "_canFormAraPhrase", "(", "araVerb", ",", "otherVerb", ")", ":", "global", "_verbAraAgreements", "for", "i", "in", "range", "(", "0", ",", "len", "(", "_verbAraAgreements", ")", ",", "2", ")", ":", "araVerbTemplate", "=", "_verbAraAgreements", "[", "i...
Teeb kindlaks, kas etteantud 'ära' verb (araVerb) yhildub teise verbiga; Arvestab järgimisi ühilduvusi: ains 2. pööre: ära_neg.o + V_o ains 3. pööre: ära_neg.gu + V_gu mitm 1. pööre: ära_neg.me + V_me ära_neg.me + V_o ...
[ "Teeb", "kindlaks", "kas", "etteantud", "ära", "verb", "(", "araVerb", ")", "yhildub", "teise", "verbiga", ";", "Arvestab", "järgimisi", "ühilduvusi", ":", "ains", "2", ".", "pööre", ":", "ära_neg", ".", "o", "+", "V_o", "ains", "3", ".", "pööre", ":", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/basic_verbchain_detection.py#L133-L161
estnltk/estnltk
estnltk/mw_verbs/basic_verbchain_detection.py
_extractBasicPredicateFromClause
def _extractBasicPredicateFromClause( clauseTokens, clauseID ): ''' Meetod, mis tuvastab antud osalausest kesksed verbid + nendega otseselt seotud esmased verbifraasid: 1) predikaadiga seotud eituse(d): (ei/ära/pole) + sobiv verb; 2) olema-verbifraasid: olema; olema + so...
python
def _extractBasicPredicateFromClause( clauseTokens, clauseID ): ''' Meetod, mis tuvastab antud osalausest kesksed verbid + nendega otseselt seotud esmased verbifraasid: 1) predikaadiga seotud eituse(d): (ei/ära/pole) + sobiv verb; 2) olema-verbifraasid: olema; olema + so...
[ "def", "_extractBasicPredicateFromClause", "(", "clauseTokens", ",", "clauseID", ")", ":", "global", "_phraseBreakerAdvs", "# Verbieituse indikaatorid\r", "verbEi", "=", "WordTemplate", "(", "{", "ROOT", ":", "'^ei$'", ",", "FORM", ":", "'neg'", ",", "POSTAG", ":", ...
Meetod, mis tuvastab antud osalausest kesksed verbid + nendega otseselt seotud esmased verbifraasid: 1) predikaadiga seotud eituse(d): (ei/ära/pole) + sobiv verb; 2) olema-verbifraasid: olema; olema + sobiv verb; 3) tavalised (mitte-olema) verbid, mis peaksid olema osalause...
[ "Meetod", "mis", "tuvastab", "antud", "osalausest", "kesksed", "verbid", "+", "nendega", "otseselt", "seotud", "esmased", "verbifraasid", ":", "1", ")", "predikaadiga", "seotud", "eituse", "(", "d", ")", ":", "(", "ei", "/", "ära", "/", "pole", ")", "+", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/basic_verbchain_detection.py#L170-L835
estnltk/estnltk
estnltk/mw_verbs/basic_verbchain_detection.py
_expandOlemaVerbChains
def _expandOlemaVerbChains( clauseTokens, clauseID, foundChains ): ''' Meetod, mis proovib laiendada 'olema'-l6pulisi (predikaadi) verbiahelaid, lisades võimalusel nende otsa teisi verbe, nt "on olnud" + "tehtud", "ei olnud" + "tehtud", "ei oleks" + "arvatud"; Vastavalt l...
python
def _expandOlemaVerbChains( clauseTokens, clauseID, foundChains ): ''' Meetod, mis proovib laiendada 'olema'-l6pulisi (predikaadi) verbiahelaid, lisades võimalusel nende otsa teisi verbe, nt "on olnud" + "tehtud", "ei olnud" + "tehtud", "ei oleks" + "arvatud"; Vastavalt l...
[ "def", "_expandOlemaVerbChains", "(", "clauseTokens", ",", "clauseID", ",", "foundChains", ")", ":", "verbOle", "=", "WordTemplate", "(", "{", "ROOT", ":", "'^ole$'", ",", "POSTAG", ":", "'V'", "}", ")", "verbOleJarel1", "=", "WordTemplate", "(", "{", "POSTA...
Meetod, mis proovib laiendada 'olema'-l6pulisi (predikaadi) verbiahelaid, lisades võimalusel nende otsa teisi verbe, nt "on olnud" + "tehtud", "ei olnud" + "tehtud", "ei oleks" + "arvatud"; Vastavalt leitud laiendustele t2iendab andmeid sisendlistis foundChains;
[ "Meetod", "mis", "proovib", "laiendada", "olema", "-", "l6pulisi", "(", "predikaadi", ")", "verbiahelaid", "lisades", "võimalusel", "nende", "otsa", "teisi", "verbe", "nt", "on", "olnud", "+", "tehtud", "ei", "olnud", "+", "tehtud", "ei", "oleks", "+", "arva...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/basic_verbchain_detection.py#L838-L987
estnltk/estnltk
estnltk/mw_verbs/basic_verbchain_detection.py
_loadVerbSubcatRelations
def _loadVerbSubcatRelations(infile): ''' Meetod, mis loeb failist sisse verbide rektsiooniseosed infiniitverbidega; Eeldab, et rektsiooniseosed on tekstifailis, kujul: häbene da mast igatse da St rea alguses on verbilemma ning TAB-iga on sellest eraldatud võimal...
python
def _loadVerbSubcatRelations(infile): ''' Meetod, mis loeb failist sisse verbide rektsiooniseosed infiniitverbidega; Eeldab, et rektsiooniseosed on tekstifailis, kujul: häbene da mast igatse da St rea alguses on verbilemma ning TAB-iga on sellest eraldatud võimal...
[ "def", "_loadVerbSubcatRelations", "(", "infile", ")", ":", "relations", "=", "dict", "(", ")", "in_f", "=", "codecs", ".", "open", "(", "infile", ",", "mode", "=", "'r'", ",", "encoding", "=", "'utf-8'", ")", "for", "line", "in", "in_f", ":", "line", ...
Meetod, mis loeb failist sisse verbide rektsiooniseosed infiniitverbidega; Eeldab, et rektsiooniseosed on tekstifailis, kujul: häbene da mast igatse da St rea alguses on verbilemma ning TAB-iga on sellest eraldatud võimalike rektsioonide (käändeliste verbide vormitunnu...
[ "Meetod", "mis", "loeb", "failist", "sisse", "verbide", "rektsiooniseosed", "infiniitverbidega", ";", "Eeldab", "et", "rektsiooniseosed", "on", "tekstifailis", "kujul", ":", "häbene", "da", "mast", "igatse", "da", "St", "rea", "alguses", "on", "verbilemma", "ning"...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/basic_verbchain_detection.py#L990-L1011
estnltk/estnltk
estnltk/mw_verbs/basic_verbchain_detection.py
_isVerbExpansible
def _isVerbExpansible( verbObj, clauseTokens, clauseID ): ''' Kontrollib, kas tavaline verb on laiendatav etteantud osalauses: *) verbi kontekstis (osalauses) on veel teisi verbe; *) verb kuulub etteantud osalausesse; *) tegemist ei ole olema-verbiga (neid vaatame mujal e...
python
def _isVerbExpansible( verbObj, clauseTokens, clauseID ): ''' Kontrollib, kas tavaline verb on laiendatav etteantud osalauses: *) verbi kontekstis (osalauses) on veel teisi verbe; *) verb kuulub etteantud osalausesse; *) tegemist ei ole olema-verbiga (neid vaatame mujal e...
[ "def", "_isVerbExpansible", "(", "verbObj", ",", "clauseTokens", ",", "clauseID", ")", ":", "global", "_verbInfNonExpansible", "# Leiame, kas fraas kuulub antud osalausesse ning on laiendatav\r", "if", "verbObj", "[", "OTHER_VERBS", "]", "and", "verbObj", "[", "CLAUSE_IDX",...
Kontrollib, kas tavaline verb on laiendatav etteantud osalauses: *) verbi kontekstis (osalauses) on veel teisi verbe; *) verb kuulub etteantud osalausesse; *) tegemist ei ole olema-verbiga (neid vaatame mujal eraldi); *) tegemist pole maks|mas|mast|mata-verbiga; *)...
[ "Kontrollib", "kas", "tavaline", "verb", "on", "laiendatav", "etteantud", "osalauses", ":", "*", ")", "verbi", "kontekstis", "(", "osalauses", ")", "on", "veel", "teisi", "verbe", ";", "*", ")", "verb", "kuulub", "etteantud", "osalausesse", ";", "*", ")", ...
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/basic_verbchain_detection.py#L1015-L1050