Search is not available for this dataset
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 list | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens list | split_name stringclasses 1
value | func_code_url stringlengths 85 339 | parameters list | question stringlengths 9 114 | answer list |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.addidsuffix | def addidsuffix(self, idsuffix, recursive = True):
"""Appends a suffix to this element's ID, and optionally to all child IDs as well. There is sually no need to call this directly, invoked implicitly by :meth:`copy`"""
if self.id: self.id += idsuffix
if recursive:
for e in self:
... | python | def addidsuffix(self, idsuffix, recursive = True):
"""Appends a suffix to this element's ID, and optionally to all child IDs as well. There is sually no need to call this directly, invoked implicitly by :meth:`copy`"""
if self.id: self.id += idsuffix
if recursive:
for e in self:
... | [
"def",
"addidsuffix",
"(",
"self",
",",
"idsuffix",
",",
"recursive",
"=",
"True",
")",
":",
"if",
"self",
".",
"id",
":",
"self",
".",
"id",
"+=",
"idsuffix",
"if",
"recursive",
":",
"for",
"e",
"in",
"self",
":",
"try",
":",
"e",
".",
"addidsuffi... | Appends a suffix to this element's ID, and optionally to all child IDs as well. There is sually no need to call this directly, invoked implicitly by :meth:`copy` | [
"Appends",
"a",
"suffix",
"to",
"this",
"element",
"s",
"ID",
"and",
"optionally",
"to",
"all",
"child",
"IDs",
"as",
"well",
".",
"There",
"is",
"sually",
"no",
"need",
"to",
"call",
"this",
"directly",
"invoked",
"implicitly",
"by",
":",
"meth",
":",
... | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1263-L1271 | [
"idsuffix",
"recursive"
] | What does this function do? | [
"Appends",
"a",
"suffix",
"to",
"this",
"element",
"s",
"ID",
"and",
"optionally",
"to",
"all",
"child",
"IDs",
"as",
"well",
".",
"There",
"is",
"sually",
"no",
"need",
"to",
"call",
"this",
"directly",
"invoked",
"implicitly",
"by",
":",
"meth",
":",
... |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.setparents | def setparents(self):
"""Correct all parent relations for elements within the scop. There is sually no need to call this directly, invoked implicitly by :meth:`copy`"""
for c in self:
if isinstance(c, AbstractElement):
c.parent = self
c.setparents() | python | def setparents(self):
"""Correct all parent relations for elements within the scop. There is sually no need to call this directly, invoked implicitly by :meth:`copy`"""
for c in self:
if isinstance(c, AbstractElement):
c.parent = self
c.setparents() | [
"def",
"setparents",
"(",
"self",
")",
":",
"for",
"c",
"in",
"self",
":",
"if",
"isinstance",
"(",
"c",
",",
"AbstractElement",
")",
":",
"c",
".",
"parent",
"=",
"self",
"c",
".",
"setparents",
"(",
")"
] | Correct all parent relations for elements within the scop. There is sually no need to call this directly, invoked implicitly by :meth:`copy` | [
"Correct",
"all",
"parent",
"relations",
"for",
"elements",
"within",
"the",
"scop",
".",
"There",
"is",
"sually",
"no",
"need",
"to",
"call",
"this",
"directly",
"invoked",
"implicitly",
"by",
":",
"meth",
":",
"copy"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1273-L1278 | [] | What does this function do? | [
"Correct",
"all",
"parent",
"relations",
"for",
"elements",
"within",
"the",
"scop",
".",
"There",
"is",
"sually",
"no",
"need",
"to",
"call",
"this",
"directly",
"invoked",
"implicitly",
"by",
":",
"meth",
":",
"copy"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.setdoc | def setdoc(self,newdoc):
"""Set a different document. Usually no need to call this directly, invoked implicitly by :meth:`copy`"""
self.doc = newdoc
if self.doc and self.id:
self.doc.index[self.id] = self
for c in self:
if isinstance(c, AbstractElement):
... | python | def setdoc(self,newdoc):
"""Set a different document. Usually no need to call this directly, invoked implicitly by :meth:`copy`"""
self.doc = newdoc
if self.doc and self.id:
self.doc.index[self.id] = self
for c in self:
if isinstance(c, AbstractElement):
... | [
"def",
"setdoc",
"(",
"self",
",",
"newdoc",
")",
":",
"self",
".",
"doc",
"=",
"newdoc",
"if",
"self",
".",
"doc",
"and",
"self",
".",
"id",
":",
"self",
".",
"doc",
".",
"index",
"[",
"self",
".",
"id",
"]",
"=",
"self",
"for",
"c",
"in",
"... | Set a different document. Usually no need to call this directly, invoked implicitly by :meth:`copy` | [
"Set",
"a",
"different",
"document",
".",
"Usually",
"no",
"need",
"to",
"call",
"this",
"directly",
"invoked",
"implicitly",
"by",
":",
"meth",
":",
"copy"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1280-L1287 | [
"newdoc"
] | What does this function do? | [
"Set",
"a",
"different",
"document",
".",
"Usually",
"no",
"need",
"to",
"call",
"this",
"directly",
"invoked",
"implicitly",
"by",
":",
"meth",
":",
"copy"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.hastext | def hastext(self,cls='current',strict=True, correctionhandling=CorrectionHandling.CURRENT): #pylint: disable=too-many-return-statements
"""Does this element have text (of the specified class)
By default, and unlike :meth:`text`, this checks strictly, i.e. the element itself must have the text and it is... | python | def hastext(self,cls='current',strict=True, correctionhandling=CorrectionHandling.CURRENT): #pylint: disable=too-many-return-statements
"""Does this element have text (of the specified class)
By default, and unlike :meth:`text`, this checks strictly, i.e. the element itself must have the text and it is... | [
"def",
"hastext",
"(",
"self",
",",
"cls",
"=",
"'current'",
",",
"strict",
"=",
"True",
",",
"correctionhandling",
"=",
"CorrectionHandling",
".",
"CURRENT",
")",
":",
"#pylint: disable=too-many-return-statements",
"if",
"not",
"self",
".",
"PRINTABLE",
":",
"#... | Does this element have text (of the specified class)
By default, and unlike :meth:`text`, this checks strictly, i.e. the element itself must have the text and it is not inherited from its children.
Parameters:
cls (str): The class of the text content to obtain, defaults to ``current``.
... | [
"Does",
"this",
"element",
"have",
"text",
"(",
"of",
"the",
"specified",
"class",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1289-L1321 | [
"cls",
"strict",
"correctionhandling"
] | What does this function do? | [
"Does",
"this",
"element",
"have",
"text",
"(",
"of",
"the",
"specified",
"class",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.hasphon | def hasphon(self,cls='current',strict=True,correctionhandling=CorrectionHandling.CURRENT): #pylint: disable=too-many-return-statements
"""Does this element have phonetic content (of the specified class)
By default, and unlike :meth:`phon`, this checks strictly, i.e. the element itself must have the pho... | python | def hasphon(self,cls='current',strict=True,correctionhandling=CorrectionHandling.CURRENT): #pylint: disable=too-many-return-statements
"""Does this element have phonetic content (of the specified class)
By default, and unlike :meth:`phon`, this checks strictly, i.e. the element itself must have the pho... | [
"def",
"hasphon",
"(",
"self",
",",
"cls",
"=",
"'current'",
",",
"strict",
"=",
"True",
",",
"correctionhandling",
"=",
"CorrectionHandling",
".",
"CURRENT",
")",
":",
"#pylint: disable=too-many-return-statements",
"if",
"not",
"self",
".",
"SPEAKABLE",
":",
"#... | Does this element have phonetic content (of the specified class)
By default, and unlike :meth:`phon`, this checks strictly, i.e. the element itself must have the phonetic content and it is not inherited from its children.
Parameters:
cls (str): The class of the phonetic content to obtain, ... | [
"Does",
"this",
"element",
"have",
"phonetic",
"content",
"(",
"of",
"the",
"specified",
"class",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1323-L1355 | [
"cls",
"strict",
"correctionhandling"
] | What does this function do? | [
"Does",
"this",
"element",
"have",
"phonetic",
"content",
"(",
"of",
"the",
"specified",
"class",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.settext | def settext(self, text, cls='current'):
"""Set the text for this element.
Arguments:
text (str): The text
cls (str): The class of the text, defaults to ``current`` (leave this unless you know what you are doing). There may be only one text content element of each class associate... | python | def settext(self, text, cls='current'):
"""Set the text for this element.
Arguments:
text (str): The text
cls (str): The class of the text, defaults to ``current`` (leave this unless you know what you are doing). There may be only one text content element of each class associate... | [
"def",
"settext",
"(",
"self",
",",
"text",
",",
"cls",
"=",
"'current'",
")",
":",
"self",
".",
"replace",
"(",
"TextContent",
",",
"value",
"=",
"text",
",",
"cls",
"=",
"cls",
")"
] | Set the text for this element.
Arguments:
text (str): The text
cls (str): The class of the text, defaults to ``current`` (leave this unless you know what you are doing). There may be only one text content element of each class associated with the element. | [
"Set",
"the",
"text",
"for",
"this",
"element",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1357-L1364 | [
"text",
"cls"
] | What does this function do? | [
"Set",
"the",
"text",
"for",
"this",
"element",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.setdocument | def setdocument(self, doc):
"""Associate a document with this element.
Arguments:
doc (:class:`Document`): A document
Each element must be associated with a FoLiA document.
"""
assert isinstance(doc, Document)
if not self.doc:
self.doc = doc
... | python | def setdocument(self, doc):
"""Associate a document with this element.
Arguments:
doc (:class:`Document`): A document
Each element must be associated with a FoLiA document.
"""
assert isinstance(doc, Document)
if not self.doc:
self.doc = doc
... | [
"def",
"setdocument",
"(",
"self",
",",
"doc",
")",
":",
"assert",
"isinstance",
"(",
"doc",
",",
"Document",
")",
"if",
"not",
"self",
".",
"doc",
":",
"self",
".",
"doc",
"=",
"doc",
"if",
"self",
".",
"id",
":",
"if",
"self",
".",
"id",
"in",
... | Associate a document with this element.
Arguments:
doc (:class:`Document`): A document
Each element must be associated with a FoLiA document. | [
"Associate",
"a",
"document",
"with",
"this",
"element",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1366-L1385 | [
"doc"
] | What does this function do? | [
"Associate",
"a",
"document",
"with",
"this",
"element",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.addable | def addable(Class, parent, set=None, raiseexceptions=True):
"""Tests whether a new element of this class can be added to the parent.
This method is mostly for internal use.
This will use the ``OCCURRENCES`` property, but may be overidden by subclasses for more customised behaviour.
Par... | python | def addable(Class, parent, set=None, raiseexceptions=True):
"""Tests whether a new element of this class can be added to the parent.
This method is mostly for internal use.
This will use the ``OCCURRENCES`` property, but may be overidden by subclasses for more customised behaviour.
Par... | [
"def",
"addable",
"(",
"Class",
",",
"parent",
",",
"set",
"=",
"None",
",",
"raiseexceptions",
"=",
"True",
")",
":",
"if",
"not",
"parent",
".",
"__class__",
".",
"accepts",
"(",
"Class",
",",
"raiseexceptions",
",",
"parent",
")",
":",
"return",
"Fa... | Tests whether a new element of this class can be added to the parent.
This method is mostly for internal use.
This will use the ``OCCURRENCES`` property, but may be overidden by subclasses for more customised behaviour.
Parameters:
parent (:class:`AbstractElement`): The element tha... | [
"Tests",
"whether",
"a",
"new",
"element",
"of",
"this",
"class",
"can",
"be",
"added",
"to",
"the",
"parent",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1406-L1455 | [
"Class",
"parent",
"set",
"raiseexceptions"
] | What does this function do? | [
"Tests",
"whether",
"a",
"new",
"element",
"of",
"this",
"class",
"can",
"be",
"added",
"to",
"the",
"parent",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.postappend | def postappend(self):
"""This method will be called after an element is added to another and does some checks.
It can do extra checks and if necessary raise exceptions to prevent addition. By default makes sure the right document is associated.
This method is mostly for internal use.
"... | python | def postappend(self):
"""This method will be called after an element is added to another and does some checks.
It can do extra checks and if necessary raise exceptions to prevent addition. By default makes sure the right document is associated.
This method is mostly for internal use.
"... | [
"def",
"postappend",
"(",
"self",
")",
":",
"#If the element was not associated with a document yet, do so now (and for all unassociated children:",
"if",
"not",
"self",
".",
"doc",
"and",
"self",
".",
"parent",
".",
"doc",
":",
"self",
".",
"setdocument",
"(",
"self",
... | This method will be called after an element is added to another and does some checks.
It can do extra checks and if necessary raise exceptions to prevent addition. By default makes sure the right document is associated.
This method is mostly for internal use. | [
"This",
"method",
"will",
"be",
"called",
"after",
"an",
"element",
"is",
"added",
"to",
"another",
"and",
"does",
"some",
"checks",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1458-L1471 | [] | What does this function do? | [
"This",
"method",
"will",
"be",
"called",
"after",
"an",
"element",
"is",
"added",
"to",
"another",
"and",
"does",
"some",
"checks",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.deepvalidation | def deepvalidation(self):
"""Perform deep validation of this element.
Raises:
:class:`DeepValidationError`
"""
if self.doc and self.doc.deepvalidation and self.set and self.set[0] != '_':
try:
self.doc.setdefinitions[self.set].testclass(self.cls)
... | python | def deepvalidation(self):
"""Perform deep validation of this element.
Raises:
:class:`DeepValidationError`
"""
if self.doc and self.doc.deepvalidation and self.set and self.set[0] != '_':
try:
self.doc.setdefinitions[self.set].testclass(self.cls)
... | [
"def",
"deepvalidation",
"(",
"self",
")",
":",
"if",
"self",
".",
"doc",
"and",
"self",
".",
"doc",
".",
"deepvalidation",
"and",
"self",
".",
"set",
"and",
"self",
".",
"set",
"[",
"0",
"]",
"!=",
"'_'",
":",
"try",
":",
"self",
".",
"doc",
"."... | Perform deep validation of this element.
Raises:
:class:`DeepValidationError` | [
"Perform",
"deep",
"validation",
"of",
"this",
"element",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1486-L1503 | [] | What does this function do? | [
"Perform",
"deep",
"validation",
"of",
"this",
"element",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.findreplaceables | def findreplaceables(Class, parent, set=None,**kwargs):
"""Internal method to find replaceable elements. Auxiliary function used by :meth:`AbstractElement.replace`. Can be overriden for more fine-grained control."""
return list(parent.select(Class,set,False)) | python | def findreplaceables(Class, parent, set=None,**kwargs):
"""Internal method to find replaceable elements. Auxiliary function used by :meth:`AbstractElement.replace`. Can be overriden for more fine-grained control."""
return list(parent.select(Class,set,False)) | [
"def",
"findreplaceables",
"(",
"Class",
",",
"parent",
",",
"set",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"list",
"(",
"parent",
".",
"select",
"(",
"Class",
",",
"set",
",",
"False",
")",
")"
] | Internal method to find replaceable elements. Auxiliary function used by :meth:`AbstractElement.replace`. Can be overriden for more fine-grained control. | [
"Internal",
"method",
"to",
"find",
"replaceable",
"elements",
".",
"Auxiliary",
"function",
"used",
"by",
":",
"meth",
":",
"AbstractElement",
".",
"replace",
".",
"Can",
"be",
"overriden",
"for",
"more",
"fine",
"-",
"grained",
"control",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1766-L1768 | [
"Class",
"parent",
"set",
"kwargs"
] | What does this function do? | [
"Internal",
"method",
"to",
"find",
"replaceable",
"elements",
".",
"Auxiliary",
"function",
"used",
"by",
":",
"meth",
":",
"AbstractElement",
".",
"replace",
".",
"Can",
"be",
"overriden",
"for",
"more",
"fine",
"-",
"grained",
"control",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.updatetext | def updatetext(self):
"""Recompute textual value based on the text content of the children. Only supported on elements that are a ``TEXTCONTAINER``"""
if self.TEXTCONTAINER:
s = ""
for child in self:
if isinstance(child, AbstractElement):
child... | python | def updatetext(self):
"""Recompute textual value based on the text content of the children. Only supported on elements that are a ``TEXTCONTAINER``"""
if self.TEXTCONTAINER:
s = ""
for child in self:
if isinstance(child, AbstractElement):
child... | [
"def",
"updatetext",
"(",
"self",
")",
":",
"if",
"self",
".",
"TEXTCONTAINER",
":",
"s",
"=",
"\"\"",
"for",
"child",
"in",
"self",
":",
"if",
"isinstance",
"(",
"child",
",",
"AbstractElement",
")",
":",
"child",
".",
"updatetext",
"(",
")",
"s",
"... | Recompute textual value based on the text content of the children. Only supported on elements that are a ``TEXTCONTAINER`` | [
"Recompute",
"textual",
"value",
"based",
"on",
"the",
"text",
"content",
"of",
"the",
"children",
".",
"Only",
"supported",
"on",
"elements",
"that",
"are",
"a",
"TEXTCONTAINER"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1772-L1782 | [] | What does this function do? | [
"Recompute",
"textual",
"value",
"based",
"on",
"the",
"text",
"content",
"of",
"the",
"children",
".",
"Only",
"supported",
"on",
"elements",
"that",
"are",
"a",
"TEXTCONTAINER"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.replace | def replace(self, child, *args, **kwargs):
"""Appends a child element like ``append()``, but replaces any existing child element of the same type and set. If no such child element exists, this will act the same as append()
Keyword arguments:
alternative (bool): If set to True, the *replaced... | python | def replace(self, child, *args, **kwargs):
"""Appends a child element like ``append()``, but replaces any existing child element of the same type and set. If no such child element exists, this will act the same as append()
Keyword arguments:
alternative (bool): If set to True, the *replaced... | [
"def",
"replace",
"(",
"self",
",",
"child",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'set'",
"in",
"kwargs",
":",
"set",
"=",
"kwargs",
"[",
"'set'",
"]",
"del",
"kwargs",
"[",
"'set'",
"]",
"else",
":",
"try",
":",
"set",
"... | Appends a child element like ``append()``, but replaces any existing child element of the same type and set. If no such child element exists, this will act the same as append()
Keyword arguments:
alternative (bool): If set to True, the *replaced* element will be made into an alternative. Simply use... | [
"Appends",
"a",
"child",
"element",
"like",
"append",
"()",
"but",
"replaces",
"any",
"existing",
"child",
"element",
"of",
"the",
"same",
"type",
"and",
"set",
".",
"If",
"no",
"such",
"child",
"element",
"exists",
"this",
"will",
"act",
"the",
"same",
... | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1784-L1838 | [
"child",
"args",
"kwargs"
] | What does this function do? | [
"Appends",
"a",
"child",
"element",
"like",
"append",
"()",
"but",
"replaces",
"any",
"existing",
"child",
"element",
"of",
"the",
"same",
"type",
"and",
"set",
".",
"If",
"no",
"such",
"child",
"element",
"exists",
"this",
"will",
"act",
"the",
"same",
... |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.ancestors | def ancestors(self, Class=None):
"""Generator yielding all ancestors of this element, effectively back-tracing its path to the root element. A tuple of multiple classes may be specified.
Arguments:
*Class: The class or classes (:class:`AbstractElement` or subclasses). Not instances!
... | python | def ancestors(self, Class=None):
"""Generator yielding all ancestors of this element, effectively back-tracing its path to the root element. A tuple of multiple classes may be specified.
Arguments:
*Class: The class or classes (:class:`AbstractElement` or subclasses). Not instances!
... | [
"def",
"ancestors",
"(",
"self",
",",
"Class",
"=",
"None",
")",
":",
"e",
"=",
"self",
"while",
"e",
":",
"if",
"e",
".",
"parent",
":",
"e",
"=",
"e",
".",
"parent",
"if",
"not",
"Class",
"or",
"isinstance",
"(",
"e",
",",
"Class",
")",
":",
... | Generator yielding all ancestors of this element, effectively back-tracing its path to the root element. A tuple of multiple classes may be specified.
Arguments:
*Class: The class or classes (:class:`AbstractElement` or subclasses). Not instances!
Yields:
elements (instances de... | [
"Generator",
"yielding",
"all",
"ancestors",
"of",
"this",
"element",
"effectively",
"back",
"-",
"tracing",
"its",
"path",
"to",
"the",
"root",
"element",
".",
"A",
"tuple",
"of",
"multiple",
"classes",
"may",
"be",
"specified",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1840-L1860 | [
"Class"
] | What does this function do? | [
"Generator",
"yielding",
"all",
"ancestors",
"of",
"this",
"element",
"effectively",
"back",
"-",
"tracing",
"its",
"path",
"to",
"the",
"root",
"element",
".",
"A",
"tuple",
"of",
"multiple",
"classes",
"may",
"be",
"specified",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.ancestor | def ancestor(self, *Classes):
"""Find the most immediate ancestor of the specified type, multiple classes may be specified.
Arguments:
*Classes: The possible classes (:class:`AbstractElement` or subclasses) to select from. Not instances!
Example::
paragraph = word.ance... | python | def ancestor(self, *Classes):
"""Find the most immediate ancestor of the specified type, multiple classes may be specified.
Arguments:
*Classes: The possible classes (:class:`AbstractElement` or subclasses) to select from. Not instances!
Example::
paragraph = word.ance... | [
"def",
"ancestor",
"(",
"self",
",",
"*",
"Classes",
")",
":",
"for",
"e",
"in",
"self",
".",
"ancestors",
"(",
"tuple",
"(",
"Classes",
")",
")",
":",
"return",
"e",
"raise",
"NoSuchAnnotation"
] | Find the most immediate ancestor of the specified type, multiple classes may be specified.
Arguments:
*Classes: The possible classes (:class:`AbstractElement` or subclasses) to select from. Not instances!
Example::
paragraph = word.ancestor(folia.Paragraph) | [
"Find",
"the",
"most",
"immediate",
"ancestor",
"of",
"the",
"specified",
"type",
"multiple",
"classes",
"may",
"be",
"specified",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1862-L1874 | [
"Classes"
] | What does this function do? | [
"Find",
"the",
"most",
"immediate",
"ancestor",
"of",
"the",
"specified",
"type",
"multiple",
"classes",
"may",
"be",
"specified",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.xml | def xml(self, attribs = None,elements = None, skipchildren = False):
"""Serialises the FoLiA element and all its contents to XML.
Arguments are mostly for internal use.
Returns:
an lxml.etree.Element
See also:
:meth:`AbstractElement.xmlstring` - for direct stri... | python | def xml(self, attribs = None,elements = None, skipchildren = False):
"""Serialises the FoLiA element and all its contents to XML.
Arguments are mostly for internal use.
Returns:
an lxml.etree.Element
See also:
:meth:`AbstractElement.xmlstring` - for direct stri... | [
"def",
"xml",
"(",
"self",
",",
"attribs",
"=",
"None",
",",
"elements",
"=",
"None",
",",
"skipchildren",
"=",
"False",
")",
":",
"E",
"=",
"ElementMaker",
"(",
"namespace",
"=",
"NSFOLIA",
",",
"nsmap",
"=",
"{",
"None",
":",
"NSFOLIA",
",",
"'xml'... | Serialises the FoLiA element and all its contents to XML.
Arguments are mostly for internal use.
Returns:
an lxml.etree.Element
See also:
:meth:`AbstractElement.xmlstring` - for direct string output | [
"Serialises",
"the",
"FoLiA",
"element",
"and",
"all",
"its",
"contents",
"to",
"XML",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L1877-L2047 | [
"attribs",
"elements",
"skipchildren"
] | What does this function do? | [
"Serialises",
"the",
"FoLiA",
"element",
"and",
"all",
"its",
"contents",
"to",
"XML",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.json | def json(self, attribs=None, recurse=True, ignorelist=False):
"""Serialises the FoLiA element and all its contents to a Python dictionary suitable for serialisation to JSON.
Example::
import json
json.dumps(word.json())
Returns:
dict
"""
jso... | python | def json(self, attribs=None, recurse=True, ignorelist=False):
"""Serialises the FoLiA element and all its contents to a Python dictionary suitable for serialisation to JSON.
Example::
import json
json.dumps(word.json())
Returns:
dict
"""
jso... | [
"def",
"json",
"(",
"self",
",",
"attribs",
"=",
"None",
",",
"recurse",
"=",
"True",
",",
"ignorelist",
"=",
"False",
")",
":",
"jsonnode",
"=",
"{",
"}",
"jsonnode",
"[",
"'type'",
"]",
"=",
"self",
".",
"XMLTAG",
"if",
"self",
".",
"id",
":",
... | Serialises the FoLiA element and all its contents to a Python dictionary suitable for serialisation to JSON.
Example::
import json
json.dumps(word.json())
Returns:
dict | [
"Serialises",
"the",
"FoLiA",
"element",
"and",
"all",
"its",
"contents",
"to",
"a",
"Python",
"dictionary",
"suitable",
"for",
"serialisation",
"to",
"JSON",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2050-L2110 | [
"attribs",
"recurse",
"ignorelist"
] | What does this function do? | [
"Serialises",
"the",
"FoLiA",
"element",
"and",
"all",
"its",
"contents",
"to",
"a",
"Python",
"dictionary",
"suitable",
"for",
"serialisation",
"to",
"JSON",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.xmlstring | def xmlstring(self, pretty_print=False):
"""Serialises this FoLiA element and all its contents to XML.
Returns:
str: a string with XML representation for this element and all its children"""
s = ElementTree.tostring(self.xml(), xml_declaration=False, pretty_print=pretty_print, encod... | python | def xmlstring(self, pretty_print=False):
"""Serialises this FoLiA element and all its contents to XML.
Returns:
str: a string with XML representation for this element and all its children"""
s = ElementTree.tostring(self.xml(), xml_declaration=False, pretty_print=pretty_print, encod... | [
"def",
"xmlstring",
"(",
"self",
",",
"pretty_print",
"=",
"False",
")",
":",
"s",
"=",
"ElementTree",
".",
"tostring",
"(",
"self",
".",
"xml",
"(",
")",
",",
"xml_declaration",
"=",
"False",
",",
"pretty_print",
"=",
"pretty_print",
",",
"encoding",
"=... | Serialises this FoLiA element and all its contents to XML.
Returns:
str: a string with XML representation for this element and all its children | [
"Serialises",
"this",
"FoLiA",
"element",
"and",
"all",
"its",
"contents",
"to",
"XML",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2114-L2129 | [
"pretty_print"
] | What does this function do? | [
"Serialises",
"this",
"FoLiA",
"element",
"and",
"all",
"its",
"contents",
"to",
"XML",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.select | def select(self, Class, set=None, recursive=True, ignore=True, node=None): #pylint: disable=bad-classmethod-argument,redefined-builtin
"""Select child elements of the specified class.
A further restriction can be made based on set.
Arguments:
Class (class): The class to select; an... | python | def select(self, Class, set=None, recursive=True, ignore=True, node=None): #pylint: disable=bad-classmethod-argument,redefined-builtin
"""Select child elements of the specified class.
A further restriction can be made based on set.
Arguments:
Class (class): The class to select; an... | [
"def",
"select",
"(",
"self",
",",
"Class",
",",
"set",
"=",
"None",
",",
"recursive",
"=",
"True",
",",
"ignore",
"=",
"True",
",",
"node",
"=",
"None",
")",
":",
"#pylint: disable=bad-classmethod-argument,redefined-builtin",
"#if ignorelist is True:",
"# igno... | Select child elements of the specified class.
A further restriction can be made based on set.
Arguments:
Class (class): The class to select; any python class (not instance) subclassed off :class:`AbstractElement`
Set (str): The set to match against, only elements pertaining to ... | [
"Select",
"child",
"elements",
"of",
"the",
"specified",
"class",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2132-L2201 | [
"Class",
"set",
"recursive",
"ignore",
"node"
] | What does this function do? | [
"Select",
"child",
"elements",
"of",
"the",
"specified",
"class",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.count | def count(self, Class, set=None, recursive=True, ignore=True, node=None):
"""Like :meth:`AbstractElement.select`, but instead of returning the elements, it merely counts them.
Returns:
int
"""
return sum(1 for i in self.select(Class,set,recursive,ignore,node) ) | python | def count(self, Class, set=None, recursive=True, ignore=True, node=None):
"""Like :meth:`AbstractElement.select`, but instead of returning the elements, it merely counts them.
Returns:
int
"""
return sum(1 for i in self.select(Class,set,recursive,ignore,node) ) | [
"def",
"count",
"(",
"self",
",",
"Class",
",",
"set",
"=",
"None",
",",
"recursive",
"=",
"True",
",",
"ignore",
"=",
"True",
",",
"node",
"=",
"None",
")",
":",
"return",
"sum",
"(",
"1",
"for",
"i",
"in",
"self",
".",
"select",
"(",
"Class",
... | Like :meth:`AbstractElement.select`, but instead of returning the elements, it merely counts them.
Returns:
int | [
"Like",
":",
"meth",
":",
"AbstractElement",
".",
"select",
"but",
"instead",
"of",
"returning",
"the",
"elements",
"it",
"merely",
"counts",
"them",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2203-L2209 | [
"Class",
"set",
"recursive",
"ignore",
"node"
] | What does this function do? | [
"Like",
":",
"meth",
":",
"AbstractElement",
".",
"select",
"but",
"instead",
"of",
"returning",
"the",
"elements",
"it",
"merely",
"counts",
"them",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.items | def items(self, founditems=[]): #pylint: disable=dangerous-default-value
"""Returns a depth-first flat list of *all* items below this element (not limited to AbstractElement)"""
l = []
for e in self.data:
if e not in founditems: #prevent going in recursive loops
l.ap... | python | def items(self, founditems=[]): #pylint: disable=dangerous-default-value
"""Returns a depth-first flat list of *all* items below this element (not limited to AbstractElement)"""
l = []
for e in self.data:
if e not in founditems: #prevent going in recursive loops
l.ap... | [
"def",
"items",
"(",
"self",
",",
"founditems",
"=",
"[",
"]",
")",
":",
"#pylint: disable=dangerous-default-value",
"l",
"=",
"[",
"]",
"for",
"e",
"in",
"self",
".",
"data",
":",
"if",
"e",
"not",
"in",
"founditems",
":",
"#prevent going in recursive loops... | Returns a depth-first flat list of *all* items below this element (not limited to AbstractElement) | [
"Returns",
"a",
"depth",
"-",
"first",
"flat",
"list",
"of",
"*",
"all",
"*",
"items",
"below",
"this",
"element",
"(",
"not",
"limited",
"to",
"AbstractElement",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2211-L2219 | [
"founditems"
] | What does this function do? | [
"Returns",
"a",
"depth",
"-",
"first",
"flat",
"list",
"of",
"*",
"all",
"*",
"items",
"below",
"this",
"element",
"(",
"not",
"limited",
"to",
"AbstractElement",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.getmetadata | def getmetadata(self, key=None):
"""Get the metadata that applies to this element, automatically inherited from parent elements"""
if self.metadata:
d = self.doc.submetadata[self.metadata]
elif self.parent:
d = self.parent.getmetadata()
elif self.doc:
... | python | def getmetadata(self, key=None):
"""Get the metadata that applies to this element, automatically inherited from parent elements"""
if self.metadata:
d = self.doc.submetadata[self.metadata]
elif self.parent:
d = self.parent.getmetadata()
elif self.doc:
... | [
"def",
"getmetadata",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"if",
"self",
".",
"metadata",
":",
"d",
"=",
"self",
".",
"doc",
".",
"submetadata",
"[",
"self",
".",
"metadata",
"]",
"elif",
"self",
".",
"parent",
":",
"d",
"=",
"self",
"... | Get the metadata that applies to this element, automatically inherited from parent elements | [
"Get",
"the",
"metadata",
"that",
"applies",
"to",
"this",
"element",
"automatically",
"inherited",
"from",
"parent",
"elements"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2221-L2234 | [
"key"
] | What does this function do? | [
"Get",
"the",
"metadata",
"that",
"applies",
"to",
"this",
"element",
"automatically",
"inherited",
"from",
"parent",
"elements"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.getindex | def getindex(self, child, recursive=True, ignore=True):
"""Get the index at which an element occurs, recursive by default!
Returns:
int
"""
#breadth first search
for i, c in enumerate(self.data):
if c is child:
return i
if recursi... | python | def getindex(self, child, recursive=True, ignore=True):
"""Get the index at which an element occurs, recursive by default!
Returns:
int
"""
#breadth first search
for i, c in enumerate(self.data):
if c is child:
return i
if recursi... | [
"def",
"getindex",
"(",
"self",
",",
"child",
",",
"recursive",
"=",
"True",
",",
"ignore",
"=",
"True",
")",
":",
"#breadth first search",
"for",
"i",
",",
"c",
"in",
"enumerate",
"(",
"self",
".",
"data",
")",
":",
"if",
"c",
"is",
"child",
":",
... | Get the index at which an element occurs, recursive by default!
Returns:
int | [
"Get",
"the",
"index",
"at",
"which",
"an",
"element",
"occurs",
"recursive",
"by",
"default!"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2238-L2278 | [
"child",
"recursive",
"ignore"
] | What does this function do? | [
"Get",
"the",
"index",
"at",
"which",
"an",
"element",
"occurs",
"recursive",
"by",
"default!"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.precedes | def precedes(self, other):
"""Returns a boolean indicating whether this element precedes the other element"""
try:
ancestor = next(commonancestors(AbstractElement, self, other))
except StopIteration:
raise Exception("Elements share no common ancestor")
#now we jus... | python | def precedes(self, other):
"""Returns a boolean indicating whether this element precedes the other element"""
try:
ancestor = next(commonancestors(AbstractElement, self, other))
except StopIteration:
raise Exception("Elements share no common ancestor")
#now we jus... | [
"def",
"precedes",
"(",
"self",
",",
"other",
")",
":",
"try",
":",
"ancestor",
"=",
"next",
"(",
"commonancestors",
"(",
"AbstractElement",
",",
"self",
",",
"other",
")",
")",
"except",
"StopIteration",
":",
"raise",
"Exception",
"(",
"\"Elements share no ... | Returns a boolean indicating whether this element precedes the other element | [
"Returns",
"a",
"boolean",
"indicating",
"whether",
"this",
"element",
"precedes",
"the",
"other",
"element"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2280-L2296 | [
"other"
] | What does this function do? | [
"Returns",
"a",
"boolean",
"indicating",
"whether",
"this",
"element",
"precedes",
"the",
"other",
"element"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.depthfirstsearch | def depthfirstsearch(self, function):
"""Generic depth first search algorithm using a callback function, continues as long as the callback function returns None"""
result = function(self)
if result is not None:
return result
for e in self:
result = e.depthfirstsea... | python | def depthfirstsearch(self, function):
"""Generic depth first search algorithm using a callback function, continues as long as the callback function returns None"""
result = function(self)
if result is not None:
return result
for e in self:
result = e.depthfirstsea... | [
"def",
"depthfirstsearch",
"(",
"self",
",",
"function",
")",
":",
"result",
"=",
"function",
"(",
"self",
")",
"if",
"result",
"is",
"not",
"None",
":",
"return",
"result",
"for",
"e",
"in",
"self",
":",
"result",
"=",
"e",
".",
"depthfirstsearch",
"(... | Generic depth first search algorithm using a callback function, continues as long as the callback function returns None | [
"Generic",
"depth",
"first",
"search",
"algorithm",
"using",
"a",
"callback",
"function",
"continues",
"as",
"long",
"as",
"the",
"callback",
"function",
"returns",
"None"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2299-L2308 | [
"function"
] | What does this function do? | [
"Generic",
"depth",
"first",
"search",
"algorithm",
"using",
"a",
"callback",
"function",
"continues",
"as",
"long",
"as",
"the",
"callback",
"function",
"returns",
"None"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.next | def next(self, Class=True, scope=True, reverse=False):
"""Returns the next element, if it is of the specified type and if it does not cross the boundary of the defined scope. Returns None if no next element is found. Non-authoritative elements are never returned.
Arguments:
* ``Class``: The... | python | def next(self, Class=True, scope=True, reverse=False):
"""Returns the next element, if it is of the specified type and if it does not cross the boundary of the defined scope. Returns None if no next element is found. Non-authoritative elements are never returned.
Arguments:
* ``Class``: The... | [
"def",
"next",
"(",
"self",
",",
"Class",
"=",
"True",
",",
"scope",
"=",
"True",
",",
"reverse",
"=",
"False",
")",
":",
"if",
"Class",
"is",
"True",
":",
"Class",
"=",
"self",
".",
"__class__",
"if",
"scope",
"is",
"True",
":",
"scope",
"=",
"S... | Returns the next element, if it is of the specified type and if it does not cross the boundary of the defined scope. Returns None if no next element is found. Non-authoritative elements are never returned.
Arguments:
* ``Class``: The class to select; any python class subclassed off `'AbstractElemen... | [
"Returns",
"the",
"next",
"element",
"if",
"it",
"is",
"of",
"the",
"specified",
"type",
"and",
"if",
"it",
"does",
"not",
"cross",
"the",
"boundary",
"of",
"the",
"defined",
"scope",
".",
"Returns",
"None",
"if",
"no",
"next",
"element",
"is",
"found",
... | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2310-L2367 | [
"Class",
"scope",
"reverse"
] | What does this function do? | [
"Returns",
"the",
"next",
"element",
"if",
"it",
"is",
"of",
"the",
"specified",
"type",
"and",
"if",
"it",
"does",
"not",
"cross",
"the",
"boundary",
"of",
"the",
"defined",
"scope",
".",
"Returns",
"None",
"if",
"no",
"next",
"element",
"is",
"found",
... |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.previous | def previous(self, Class=True, scope=True):
"""Returns the previous element, if it is of the specified type and if it does not cross the boundary of the defined scope. Returns None if no next element is found. Non-authoritative elements are never returned.
Arguments:
* ``Class``: The class ... | python | def previous(self, Class=True, scope=True):
"""Returns the previous element, if it is of the specified type and if it does not cross the boundary of the defined scope. Returns None if no next element is found. Non-authoritative elements are never returned.
Arguments:
* ``Class``: The class ... | [
"def",
"previous",
"(",
"self",
",",
"Class",
"=",
"True",
",",
"scope",
"=",
"True",
")",
":",
"return",
"self",
".",
"next",
"(",
"Class",
",",
"scope",
",",
"True",
")"
] | Returns the previous element, if it is of the specified type and if it does not cross the boundary of the defined scope. Returns None if no next element is found. Non-authoritative elements are never returned.
Arguments:
* ``Class``: The class to select; any python class subclassed off `'AbstractEl... | [
"Returns",
"the",
"previous",
"element",
"if",
"it",
"is",
"of",
"the",
"specified",
"type",
"and",
"if",
"it",
"does",
"not",
"cross",
"the",
"boundary",
"of",
"the",
"defined",
"scope",
".",
"Returns",
"None",
"if",
"no",
"next",
"element",
"is",
"foun... | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2371-L2379 | [
"Class",
"scope"
] | What does this function do? | [
"Returns",
"the",
"previous",
"element",
"if",
"it",
"is",
"of",
"the",
"specified",
"type",
"and",
"if",
"it",
"does",
"not",
"cross",
"the",
"boundary",
"of",
"the",
"defined",
"scope",
".",
"Returns",
"None",
"if",
"no",
"next",
"element",
"is",
"foun... |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.leftcontext | def leftcontext(self, size, placeholder=None, scope=None):
"""Returns the left context for an element, as a list. This method crosses sentence/paragraph boundaries by default, which can be restricted by setting scope"""
if size == 0: return [] #for efficiency
context = []
e = self
... | python | def leftcontext(self, size, placeholder=None, scope=None):
"""Returns the left context for an element, as a list. This method crosses sentence/paragraph boundaries by default, which can be restricted by setting scope"""
if size == 0: return [] #for efficiency
context = []
e = self
... | [
"def",
"leftcontext",
"(",
"self",
",",
"size",
",",
"placeholder",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"if",
"size",
"==",
"0",
":",
"return",
"[",
"]",
"#for efficiency",
"context",
"=",
"[",
"]",
"e",
"=",
"self",
"while",
"len",
"... | Returns the left context for an element, as a list. This method crosses sentence/paragraph boundaries by default, which can be restricted by setting scope | [
"Returns",
"the",
"left",
"context",
"for",
"an",
"element",
"as",
"a",
"list",
".",
"This",
"method",
"crosses",
"sentence",
"/",
"paragraph",
"boundaries",
"by",
"default",
"which",
"can",
"be",
"restricted",
"by",
"setting",
"scope"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2381-L2398 | [
"size",
"placeholder",
"scope"
] | What does this function do? | [
"Returns",
"the",
"left",
"context",
"for",
"an",
"element",
"as",
"a",
"list",
".",
"This",
"method",
"crosses",
"sentence",
"/",
"paragraph",
"boundaries",
"by",
"default",
"which",
"can",
"be",
"restricted",
"by",
"setting",
"scope"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.rightcontext | def rightcontext(self, size, placeholder=None, scope=None):
"""Returns the right context for an element, as a list. This method crosses sentence/paragraph boundaries by default, which can be restricted by setting scope"""
if size == 0: return [] #for efficiency
context = []
e = self
... | python | def rightcontext(self, size, placeholder=None, scope=None):
"""Returns the right context for an element, as a list. This method crosses sentence/paragraph boundaries by default, which can be restricted by setting scope"""
if size == 0: return [] #for efficiency
context = []
e = self
... | [
"def",
"rightcontext",
"(",
"self",
",",
"size",
",",
"placeholder",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"if",
"size",
"==",
"0",
":",
"return",
"[",
"]",
"#for efficiency",
"context",
"=",
"[",
"]",
"e",
"=",
"self",
"while",
"len",
... | Returns the right context for an element, as a list. This method crosses sentence/paragraph boundaries by default, which can be restricted by setting scope | [
"Returns",
"the",
"right",
"context",
"for",
"an",
"element",
"as",
"a",
"list",
".",
"This",
"method",
"crosses",
"sentence",
"/",
"paragraph",
"boundaries",
"by",
"default",
"which",
"can",
"be",
"restricted",
"by",
"setting",
"scope"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2401-L2417 | [
"size",
"placeholder",
"scope"
] | What does this function do? | [
"Returns",
"the",
"right",
"context",
"for",
"an",
"element",
"as",
"a",
"list",
".",
"This",
"method",
"crosses",
"sentence",
"/",
"paragraph",
"boundaries",
"by",
"default",
"which",
"can",
"be",
"restricted",
"by",
"setting",
"scope"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.context | def context(self, size, placeholder=None, scope=None):
"""Returns this word in context, {size} words to the left, the current word, and {size} words to the right"""
return self.leftcontext(size, placeholder,scope) + [self] + self.rightcontext(size, placeholder,scope) | python | def context(self, size, placeholder=None, scope=None):
"""Returns this word in context, {size} words to the left, the current word, and {size} words to the right"""
return self.leftcontext(size, placeholder,scope) + [self] + self.rightcontext(size, placeholder,scope) | [
"def",
"context",
"(",
"self",
",",
"size",
",",
"placeholder",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"return",
"self",
".",
"leftcontext",
"(",
"size",
",",
"placeholder",
",",
"scope",
")",
"+",
"[",
"self",
"]",
"+",
"self",
".",
"ri... | Returns this word in context, {size} words to the left, the current word, and {size} words to the right | [
"Returns",
"this",
"word",
"in",
"context",
"{",
"size",
"}",
"words",
"to",
"the",
"left",
"the",
"current",
"word",
"and",
"{",
"size",
"}",
"words",
"to",
"the",
"right"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2419-L2421 | [
"size",
"placeholder",
"scope"
] | What does this function do? | [
"Returns",
"this",
"word",
"in",
"context",
"{",
"size",
"}",
"words",
"to",
"the",
"left",
"the",
"current",
"word",
"and",
"{",
"size",
"}",
"words",
"to",
"the",
"right"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.relaxng | def relaxng(cls, includechildren=True,extraattribs = None, extraelements=None, origclass = None):
"""Returns a RelaxNG definition for this element (as an XML element (lxml.etree) rather than a string)"""
E = ElementMaker(namespace="http://relaxng.org/ns/structure/1.0",nsmap={None:'http://relaxng.org/ns... | python | def relaxng(cls, includechildren=True,extraattribs = None, extraelements=None, origclass = None):
"""Returns a RelaxNG definition for this element (as an XML element (lxml.etree) rather than a string)"""
E = ElementMaker(namespace="http://relaxng.org/ns/structure/1.0",nsmap={None:'http://relaxng.org/ns... | [
"def",
"relaxng",
"(",
"cls",
",",
"includechildren",
"=",
"True",
",",
"extraattribs",
"=",
"None",
",",
"extraelements",
"=",
"None",
",",
"origclass",
"=",
"None",
")",
":",
"E",
"=",
"ElementMaker",
"(",
"namespace",
"=",
"\"http://relaxng.org/ns/structure... | Returns a RelaxNG definition for this element (as an XML element (lxml.etree) rather than a string) | [
"Returns",
"a",
"RelaxNG",
"definition",
"for",
"this",
"element",
"(",
"as",
"an",
"XML",
"element",
"(",
"lxml",
".",
"etree",
")",
"rather",
"than",
"a",
"string",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2424-L2579 | [
"cls",
"includechildren",
"extraattribs",
"extraelements",
"origclass"
] | What does this function do? | [
"Returns",
"a",
"RelaxNG",
"definition",
"for",
"this",
"element",
"(",
"as",
"an",
"XML",
"element",
"(",
"lxml",
".",
"etree",
")",
"rather",
"than",
"a",
"string",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.parsexml | def parsexml(Class, node, doc, **kwargs): #pylint: disable=bad-classmethod-argument
"""Internal class method used for turning an XML element into an instance of the Class.
Args:
* ``node`` - XML Element
* ``doc`` - Document
Returns:
An instance of the curren... | python | def parsexml(Class, node, doc, **kwargs): #pylint: disable=bad-classmethod-argument
"""Internal class method used for turning an XML element into an instance of the Class.
Args:
* ``node`` - XML Element
* ``doc`` - Document
Returns:
An instance of the curren... | [
"def",
"parsexml",
"(",
"Class",
",",
"node",
",",
"doc",
",",
"*",
"*",
"kwargs",
")",
":",
"#pylint: disable=bad-classmethod-argument",
"assert",
"issubclass",
"(",
"Class",
",",
"AbstractElement",
")",
"if",
"doc",
".",
"preparsexmlcallback",
":",
"result",
... | Internal class method used for turning an XML element into an instance of the Class.
Args:
* ``node`` - XML Element
* ``doc`` - Document
Returns:
An instance of the current Class. | [
"Internal",
"class",
"method",
"used",
"for",
"turning",
"an",
"XML",
"element",
"into",
"an",
"instance",
"of",
"the",
"Class",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2582-L2724 | [
"Class",
"node",
"doc",
"kwargs"
] | What does this function do? | [
"Internal",
"class",
"method",
"used",
"for",
"turning",
"an",
"XML",
"element",
"into",
"an",
"instance",
"of",
"the",
"Class",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractElement.incorrection | def incorrection(self):
"""Is this element part of a correction? If it is, it returns the Correction element (evaluating to True), otherwise it returns None"""
e = self.parent
while e:
if isinstance(e, Correction):
return e
if isinstance(e, AbstractStruct... | python | def incorrection(self):
"""Is this element part of a correction? If it is, it returns the Correction element (evaluating to True), otherwise it returns None"""
e = self.parent
while e:
if isinstance(e, Correction):
return e
if isinstance(e, AbstractStruct... | [
"def",
"incorrection",
"(",
"self",
")",
":",
"e",
"=",
"self",
".",
"parent",
"while",
"e",
":",
"if",
"isinstance",
"(",
"e",
",",
"Correction",
")",
":",
"return",
"e",
"if",
"isinstance",
"(",
"e",
",",
"AbstractStructureElement",
")",
":",
"break"... | Is this element part of a correction? If it is, it returns the Correction element (evaluating to True), otherwise it returns None | [
"Is",
"this",
"element",
"part",
"of",
"a",
"correction?",
"If",
"it",
"is",
"it",
"returns",
"the",
"Correction",
"element",
"(",
"evaluating",
"to",
"True",
")",
"otherwise",
"it",
"returns",
"None"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2740-L2750 | [] | What does this function do? | [
"Is",
"this",
"element",
"part",
"of",
"a",
"correction?",
"If",
"it",
"is",
"it",
"returns",
"the",
"Correction",
"element",
"(",
"evaluating",
"to",
"True",
")",
"otherwise",
"it",
"returns",
"None"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AllowCorrections.correct | def correct(self, **kwargs):
"""Apply a correction (TODO: documentation to be written still)"""
if 'insertindex_offset' in kwargs:
del kwargs['insertindex_offset'] #dealt with in an earlier stage
if 'confidence' in kwargs and kwargs['confidence'] is None:
del kwargs['co... | python | def correct(self, **kwargs):
"""Apply a correction (TODO: documentation to be written still)"""
if 'insertindex_offset' in kwargs:
del kwargs['insertindex_offset'] #dealt with in an earlier stage
if 'confidence' in kwargs and kwargs['confidence'] is None:
del kwargs['co... | [
"def",
"correct",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'insertindex_offset'",
"in",
"kwargs",
":",
"del",
"kwargs",
"[",
"'insertindex_offset'",
"]",
"#dealt with in an earlier stage",
"if",
"'confidence'",
"in",
"kwargs",
"and",
"kwargs",
"[",... | Apply a correction (TODO: documentation to be written still) | [
"Apply",
"a",
"correction",
"(",
"TODO",
":",
"documentation",
"to",
"be",
"written",
"still",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L2856-L3007 | [
"kwargs"
] | What does this function do? | [
"Apply",
"a",
"correction",
"(",
"TODO",
":",
"documentation",
"to",
"be",
"written",
"still",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AllowTokenAnnotation.annotations | def annotations(self,Class,set=None):
"""Obtain child elements (annotations) of the specified class.
A further restriction can be made based on set.
Arguments:
Class (class): The class to select; any python class (not instance) subclassed off :class:`AbstractElement`
Se... | python | def annotations(self,Class,set=None):
"""Obtain child elements (annotations) of the specified class.
A further restriction can be made based on set.
Arguments:
Class (class): The class to select; any python class (not instance) subclassed off :class:`AbstractElement`
Se... | [
"def",
"annotations",
"(",
"self",
",",
"Class",
",",
"set",
"=",
"None",
")",
":",
"found",
"=",
"False",
"for",
"e",
"in",
"self",
".",
"select",
"(",
"Class",
",",
"set",
",",
"True",
",",
"default_ignore_annotations",
")",
":",
"found",
"=",
"Tru... | Obtain child elements (annotations) of the specified class.
A further restriction can be made based on set.
Arguments:
Class (class): The class to select; any python class (not instance) subclassed off :class:`AbstractElement`
Set (str): The set to match against, only elements ... | [
"Obtain",
"child",
"elements",
"(",
"annotations",
")",
"of",
"the",
"specified",
"class",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3015-L3044 | [
"Class",
"set"
] | What does this function do? | [
"Obtain",
"child",
"elements",
"(",
"annotations",
")",
"of",
"the",
"specified",
"class",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AllowTokenAnnotation.hasannotation | def hasannotation(self,Class,set=None):
"""Returns an integer indicating whether such as annotation exists, and if so, how many.
See :meth:`AllowTokenAnnotation.annotations`` for a description of the parameters."""
return sum( 1 for _ in self.select(Class,set,True,default_ignore_annotations)) | python | def hasannotation(self,Class,set=None):
"""Returns an integer indicating whether such as annotation exists, and if so, how many.
See :meth:`AllowTokenAnnotation.annotations`` for a description of the parameters."""
return sum( 1 for _ in self.select(Class,set,True,default_ignore_annotations)) | [
"def",
"hasannotation",
"(",
"self",
",",
"Class",
",",
"set",
"=",
"None",
")",
":",
"return",
"sum",
"(",
"1",
"for",
"_",
"in",
"self",
".",
"select",
"(",
"Class",
",",
"set",
",",
"True",
",",
"default_ignore_annotations",
")",
")"
] | Returns an integer indicating whether such as annotation exists, and if so, how many.
See :meth:`AllowTokenAnnotation.annotations`` for a description of the parameters. | [
"Returns",
"an",
"integer",
"indicating",
"whether",
"such",
"as",
"annotation",
"exists",
"and",
"if",
"so",
"how",
"many",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3046-L3050 | [
"Class",
"set"
] | What does this function do? | [
"Returns",
"an",
"integer",
"indicating",
"whether",
"such",
"as",
"annotation",
"exists",
"and",
"if",
"so",
"how",
"many",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AllowTokenAnnotation.annotation | def annotation(self, type, set=None):
"""Obtain a single annotation element.
A further restriction can be made based on set.
Arguments:
Class (class): The class to select; any python class (not instance) subclassed off :class:`AbstractElement`
Set (str): The set to matc... | python | def annotation(self, type, set=None):
"""Obtain a single annotation element.
A further restriction can be made based on set.
Arguments:
Class (class): The class to select; any python class (not instance) subclassed off :class:`AbstractElement`
Set (str): The set to matc... | [
"def",
"annotation",
"(",
"self",
",",
"type",
",",
"set",
"=",
"None",
")",
":",
"\"\"\"Will return a **single** annotation (even if there are multiple). Raises a ``NoSuchAnnotation`` exception if none was found\"\"\"",
"for",
"e",
"in",
"self",
".",
"select",
"(",
"type",
... | Obtain a single annotation element.
A further restriction can be made based on set.
Arguments:
Class (class): The class to select; any python class (not instance) subclassed off :class:`AbstractElement`
Set (str): The set to match against, only elements pertaining to this set w... | [
"Obtain",
"a",
"single",
"annotation",
"element",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3052-L3078 | [
"type",
"set"
] | What does this function do? | [
"Obtain",
"a",
"single",
"annotation",
"element",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractStructureElement.append | def append(self, child, *args, **kwargs):
"""See ``AbstractElement.append()``"""
e = super(AbstractStructureElement,self).append(child, *args, **kwargs)
self._setmaxid(e)
return e | python | def append(self, child, *args, **kwargs):
"""See ``AbstractElement.append()``"""
e = super(AbstractStructureElement,self).append(child, *args, **kwargs)
self._setmaxid(e)
return e | [
"def",
"append",
"(",
"self",
",",
"child",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"e",
"=",
"super",
"(",
"AbstractStructureElement",
",",
"self",
")",
".",
"append",
"(",
"child",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"s... | See ``AbstractElement.append()`` | [
"See",
"AbstractElement",
".",
"append",
"()"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3202-L3206 | [
"child",
"args",
"kwargs"
] | What does this function do? | [
"See",
"AbstractElement",
".",
"append",
"()"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractStructureElement.words | def words(self, index = None):
"""Returns a generator of Word elements found (recursively) under this element.
Arguments:
* ``index``: If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning the list of all
"""
if index is None:
... | python | def words(self, index = None):
"""Returns a generator of Word elements found (recursively) under this element.
Arguments:
* ``index``: If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning the list of all
"""
if index is None:
... | [
"def",
"words",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"return",
"self",
".",
"select",
"(",
"Word",
",",
"None",
",",
"True",
",",
"default_ignore_structure",
")",
"else",
":",
"if",
"index",
"<",
"0",
... | Returns a generator of Word elements found (recursively) under this element.
Arguments:
* ``index``: If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning the list of all | [
"Returns",
"a",
"generator",
"of",
"Word",
"elements",
"found",
"(",
"recursively",
")",
"under",
"this",
"element",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3214-L3228 | [
"index"
] | What does this function do? | [
"Returns",
"a",
"generator",
"of",
"Word",
"elements",
"found",
"(",
"recursively",
")",
"under",
"this",
"element",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractStructureElement.paragraphs | def paragraphs(self, index = None):
"""Returns a generator of Paragraph elements found (recursively) under this element.
Arguments:
index (int or None): If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning the generator of all
"""
... | python | def paragraphs(self, index = None):
"""Returns a generator of Paragraph elements found (recursively) under this element.
Arguments:
index (int or None): If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning the generator of all
"""
... | [
"def",
"paragraphs",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"return",
"self",
".",
"select",
"(",
"Paragraph",
",",
"None",
",",
"True",
",",
"default_ignore_structure",
")",
"else",
":",
"if",
"index",
"<",... | Returns a generator of Paragraph elements found (recursively) under this element.
Arguments:
index (int or None): If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning the generator of all | [
"Returns",
"a",
"generator",
"of",
"Paragraph",
"elements",
"found",
"(",
"recursively",
")",
"under",
"this",
"element",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3231-L3245 | [
"index"
] | What does this function do? | [
"Returns",
"a",
"generator",
"of",
"Paragraph",
"elements",
"found",
"(",
"recursively",
")",
"under",
"this",
"element",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractStructureElement.sentences | def sentences(self, index = None):
"""Returns a generator of Sentence elements found (recursively) under this element
Arguments:
index (int or None): If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning a generator of all
"""
i... | python | def sentences(self, index = None):
"""Returns a generator of Sentence elements found (recursively) under this element
Arguments:
index (int or None): If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning a generator of all
"""
i... | [
"def",
"sentences",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"return",
"self",
".",
"select",
"(",
"Sentence",
",",
"None",
",",
"True",
",",
"default_ignore_structure",
")",
"else",
":",
"if",
"index",
"<",
... | Returns a generator of Sentence elements found (recursively) under this element
Arguments:
index (int or None): If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning a generator of all | [
"Returns",
"a",
"generator",
"of",
"Sentence",
"elements",
"found",
"(",
"recursively",
")",
"under",
"this",
"element"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3247-L3261 | [
"index"
] | What does this function do? | [
"Returns",
"a",
"generator",
"of",
"Sentence",
"elements",
"found",
"(",
"recursively",
")",
"under",
"this",
"element"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractStructureElement.layers | def layers(self, annotationtype=None,set=None):
"""Returns a list of annotation layers found *directly* under this element, does not include alternative layers"""
if inspect.isclass(annotationtype): annotationtype = annotationtype.ANNOTATIONTYPE
return [ x for x in self.select(AbstractAnnotation... | python | def layers(self, annotationtype=None,set=None):
"""Returns a list of annotation layers found *directly* under this element, does not include alternative layers"""
if inspect.isclass(annotationtype): annotationtype = annotationtype.ANNOTATIONTYPE
return [ x for x in self.select(AbstractAnnotation... | [
"def",
"layers",
"(",
"self",
",",
"annotationtype",
"=",
"None",
",",
"set",
"=",
"None",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"annotationtype",
")",
":",
"annotationtype",
"=",
"annotationtype",
".",
"ANNOTATIONTYPE",
"return",
"[",
"x",
"for"... | Returns a list of annotation layers found *directly* under this element, does not include alternative layers | [
"Returns",
"a",
"list",
"of",
"annotation",
"layers",
"found",
"*",
"directly",
"*",
"under",
"this",
"element",
"does",
"not",
"include",
"alternative",
"layers"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3263-L3266 | [
"annotationtype",
"set"
] | What does this function do? | [
"Returns",
"a",
"list",
"of",
"annotation",
"layers",
"found",
"*",
"directly",
"*",
"under",
"this",
"element",
"does",
"not",
"include",
"alternative",
"layers"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractStructureElement.hasannotationlayer | def hasannotationlayer(self, annotationtype=None,set=None):
"""Does the specified annotation layer exist?"""
l = self.layers(annotationtype, set)
return (len(l) > 0) | python | def hasannotationlayer(self, annotationtype=None,set=None):
"""Does the specified annotation layer exist?"""
l = self.layers(annotationtype, set)
return (len(l) > 0) | [
"def",
"hasannotationlayer",
"(",
"self",
",",
"annotationtype",
"=",
"None",
",",
"set",
"=",
"None",
")",
":",
"l",
"=",
"self",
".",
"layers",
"(",
"annotationtype",
",",
"set",
")",
"return",
"(",
"len",
"(",
"l",
")",
">",
"0",
")"
] | Does the specified annotation layer exist? | [
"Does",
"the",
"specified",
"annotation",
"layer",
"exist?"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3268-L3271 | [
"annotationtype",
"set"
] | What does this function do? | [
"Does",
"the",
"specified",
"annotation",
"layer",
"exist?"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractTextMarkup.xml | def xml(self, attribs = None,elements = None, skipchildren = False):
"""See :meth:`AbstractElement.xml`"""
if not attribs: attribs = {}
if self.idref:
attribs['id'] = self.idref
return super(AbstractTextMarkup,self).xml(attribs,elements, skipchildren) | python | def xml(self, attribs = None,elements = None, skipchildren = False):
"""See :meth:`AbstractElement.xml`"""
if not attribs: attribs = {}
if self.idref:
attribs['id'] = self.idref
return super(AbstractTextMarkup,self).xml(attribs,elements, skipchildren) | [
"def",
"xml",
"(",
"self",
",",
"attribs",
"=",
"None",
",",
"elements",
"=",
"None",
",",
"skipchildren",
"=",
"False",
")",
":",
"if",
"not",
"attribs",
":",
"attribs",
"=",
"{",
"}",
"if",
"self",
".",
"idref",
":",
"attribs",
"[",
"'id'",
"]",
... | See :meth:`AbstractElement.xml` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"xml"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3336-L3341 | [
"attribs",
"elements",
"skipchildren"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"xml"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractTextMarkup.json | def json(self,attribs =None, recurse=True, ignorelist=False):
"""See :meth:`AbstractElement.json`"""
if not attribs: attribs = {}
if self.idref:
attribs['id'] = self.idref
return super(AbstractTextMarkup,self).json(attribs,recurse, ignorelist) | python | def json(self,attribs =None, recurse=True, ignorelist=False):
"""See :meth:`AbstractElement.json`"""
if not attribs: attribs = {}
if self.idref:
attribs['id'] = self.idref
return super(AbstractTextMarkup,self).json(attribs,recurse, ignorelist) | [
"def",
"json",
"(",
"self",
",",
"attribs",
"=",
"None",
",",
"recurse",
"=",
"True",
",",
"ignorelist",
"=",
"False",
")",
":",
"if",
"not",
"attribs",
":",
"attribs",
"=",
"{",
"}",
"if",
"self",
".",
"idref",
":",
"attribs",
"[",
"'id'",
"]",
... | See :meth:`AbstractElement.json` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"json"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3343-L3348 | [
"attribs",
"recurse",
"ignorelist"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"json"
] |
proycon/pynlpl | pynlpl/formats/folia.py | TextContent.text | def text(self, normalize_spaces=False):
"""Obtain the text (unicode instance)"""
return super(TextContent,self).text(normalize_spaces=normalize_spaces) | python | def text(self, normalize_spaces=False):
"""Obtain the text (unicode instance)"""
return super(TextContent,self).text(normalize_spaces=normalize_spaces) | [
"def",
"text",
"(",
"self",
",",
"normalize_spaces",
"=",
"False",
")",
":",
"return",
"super",
"(",
"TextContent",
",",
"self",
")",
".",
"text",
"(",
"normalize_spaces",
"=",
"normalize_spaces",
")"
] | Obtain the text (unicode instance) | [
"Obtain",
"the",
"text",
"(",
"unicode",
"instance",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3490-L3492 | [
"normalize_spaces"
] | What does this function do? | [
"Obtain",
"the",
"text",
"(",
"unicode",
"instance",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | TextContent.getreference | def getreference(self, validate=True):
"""Returns and validates the Text Content's reference. Raises UnresolvableTextContent when invalid"""
if self.offset is None: return None #nothing to test
if self.ref:
ref = self.doc[self.ref]
else:
ref = self.finddefaultref... | python | def getreference(self, validate=True):
"""Returns and validates the Text Content's reference. Raises UnresolvableTextContent when invalid"""
if self.offset is None: return None #nothing to test
if self.ref:
ref = self.doc[self.ref]
else:
ref = self.finddefaultref... | [
"def",
"getreference",
"(",
"self",
",",
"validate",
"=",
"True",
")",
":",
"if",
"self",
".",
"offset",
"is",
"None",
":",
"return",
"None",
"#nothing to test",
"if",
"self",
".",
"ref",
":",
"ref",
"=",
"self",
".",
"doc",
"[",
"self",
".",
"ref",
... | Returns and validates the Text Content's reference. Raises UnresolvableTextContent when invalid | [
"Returns",
"and",
"validates",
"the",
"Text",
"Content",
"s",
"reference",
".",
"Raises",
"UnresolvableTextContent",
"when",
"invalid"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3502-L3519 | [
"validate"
] | What does this function do? | [
"Returns",
"and",
"validates",
"the",
"Text",
"Content",
"s",
"reference",
".",
"Raises",
"UnresolvableTextContent",
"when",
"invalid"
] |
proycon/pynlpl | pynlpl/formats/folia.py | TextContent.xml | def xml(self, attribs = None,elements = None, skipchildren = False):
"""See :meth:`AbstractElement.xml`"""
attribs = {}
if not self.offset is None:
attribs['{' + NSFOLIA + '}offset'] = str(self.offset)
if self.parent and self.ref:
attribs['{' + NSFOLIA + '}ref'] =... | python | def xml(self, attribs = None,elements = None, skipchildren = False):
"""See :meth:`AbstractElement.xml`"""
attribs = {}
if not self.offset is None:
attribs['{' + NSFOLIA + '}offset'] = str(self.offset)
if self.parent and self.ref:
attribs['{' + NSFOLIA + '}ref'] =... | [
"def",
"xml",
"(",
"self",
",",
"attribs",
"=",
"None",
",",
"elements",
"=",
"None",
",",
"skipchildren",
"=",
"False",
")",
":",
"attribs",
"=",
"{",
"}",
"if",
"not",
"self",
".",
"offset",
"is",
"None",
":",
"attribs",
"[",
"'{'",
"+",
"NSFOLIA... | See :meth:`AbstractElement.xml` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"xml"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3596-L3616 | [
"attribs",
"elements",
"skipchildren"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"xml"
] |
proycon/pynlpl | pynlpl/formats/folia.py | PhonContent.getreference | def getreference(self, validate=True):
"""Return and validate the Phonetic Content's reference. Raises UnresolvableTextContent when invalid"""
if self.offset is None: return None #nothing to test
if self.ref:
ref = self.doc[self.ref]
else:
ref = self.finddefaultr... | python | def getreference(self, validate=True):
"""Return and validate the Phonetic Content's reference. Raises UnresolvableTextContent when invalid"""
if self.offset is None: return None #nothing to test
if self.ref:
ref = self.doc[self.ref]
else:
ref = self.finddefaultr... | [
"def",
"getreference",
"(",
"self",
",",
"validate",
"=",
"True",
")",
":",
"if",
"self",
".",
"offset",
"is",
"None",
":",
"return",
"None",
"#nothing to test",
"if",
"self",
".",
"ref",
":",
"ref",
"=",
"self",
".",
"doc",
"[",
"self",
".",
"ref",
... | Return and validate the Phonetic Content's reference. Raises UnresolvableTextContent when invalid | [
"Return",
"and",
"validate",
"the",
"Phonetic",
"Content",
"s",
"reference",
".",
"Raises",
"UnresolvableTextContent",
"when",
"invalid"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3715-L3732 | [
"validate"
] | What does this function do? | [
"Return",
"and",
"validate",
"the",
"Phonetic",
"Content",
"s",
"reference",
".",
"Raises",
"UnresolvableTextContent",
"when",
"invalid"
] |
proycon/pynlpl | pynlpl/formats/folia.py | PhonContent.finddefaultreference | def finddefaultreference(self):
"""Find the default reference for text offsets:
The parent of the current textcontent's parent (counting only Structure Elements and Subtoken Annotation Elements)
Note: This returns not a TextContent element, but its parent. Whether the textcontent actually e... | python | def finddefaultreference(self):
"""Find the default reference for text offsets:
The parent of the current textcontent's parent (counting only Structure Elements and Subtoken Annotation Elements)
Note: This returns not a TextContent element, but its parent. Whether the textcontent actually e... | [
"def",
"finddefaultreference",
"(",
"self",
")",
":",
"depth",
"=",
"0",
"e",
"=",
"self",
"while",
"True",
":",
"if",
"e",
".",
"parent",
":",
"e",
"=",
"e",
".",
"parent",
"#pylint: disable=redefined-variable-type",
"else",
":",
"#no parent, breaking",
"re... | Find the default reference for text offsets:
The parent of the current textcontent's parent (counting only Structure Elements and Subtoken Annotation Elements)
Note: This returns not a TextContent element, but its parent. Whether the textcontent actually exists is checked later/elsewhere | [
"Find",
"the",
"default",
"reference",
"for",
"text",
"offsets",
":",
"The",
"parent",
"of",
"the",
"current",
"textcontent",
"s",
"parent",
"(",
"counting",
"only",
"Structure",
"Elements",
"and",
"Subtoken",
"Annotation",
"Elements",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3765-L3787 | [] | What does this function do? | [
"Find",
"the",
"default",
"reference",
"for",
"text",
"offsets",
":",
"The",
"parent",
"of",
"the",
"current",
"textcontent",
"s",
"parent",
"(",
"counting",
"only",
"Structure",
"Elements",
"and",
"Subtoken",
"Annotation",
"Elements",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | PhonContent.findreplaceables | def findreplaceables(Class, parent, set, **kwargs):#pylint: disable=bad-classmethod-argument
"""(Method for internal usage, see AbstractElement)"""
#some extra behaviour for text content elements, replace also based on the 'corrected' attribute:
if 'cls' not in kwargs:
kwargs['cls'] ... | python | def findreplaceables(Class, parent, set, **kwargs):#pylint: disable=bad-classmethod-argument
"""(Method for internal usage, see AbstractElement)"""
#some extra behaviour for text content elements, replace also based on the 'corrected' attribute:
if 'cls' not in kwargs:
kwargs['cls'] ... | [
"def",
"findreplaceables",
"(",
"Class",
",",
"parent",
",",
"set",
",",
"*",
"*",
"kwargs",
")",
":",
"#pylint: disable=bad-classmethod-argument",
"#some extra behaviour for text content elements, replace also based on the 'corrected' attribute:",
"if",
"'cls'",
"not",
"in",
... | (Method for internal usage, see AbstractElement) | [
"(",
"Method",
"for",
"internal",
"usage",
"see",
"AbstractElement",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3796-L3804 | [
"Class",
"parent",
"set",
"kwargs"
] | What does this function do? | [
"(",
"Method",
"for",
"internal",
"usage",
"see",
"AbstractElement",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | PhonContent.parsexml | def parsexml(Class, node, doc, **kwargs):#pylint: disable=bad-classmethod-argument
"""(Method for internal usage, see AbstractElement)"""
if not kwargs: kwargs = {}
if 'offset' in node.attrib:
kwargs['offset'] = int(node.attrib['offset'])
if 'ref' in node.attrib:
... | python | def parsexml(Class, node, doc, **kwargs):#pylint: disable=bad-classmethod-argument
"""(Method for internal usage, see AbstractElement)"""
if not kwargs: kwargs = {}
if 'offset' in node.attrib:
kwargs['offset'] = int(node.attrib['offset'])
if 'ref' in node.attrib:
... | [
"def",
"parsexml",
"(",
"Class",
",",
"node",
",",
"doc",
",",
"*",
"*",
"kwargs",
")",
":",
"#pylint: disable=bad-classmethod-argument",
"if",
"not",
"kwargs",
":",
"kwargs",
"=",
"{",
"}",
"if",
"'offset'",
"in",
"node",
".",
"attrib",
":",
"kwargs",
"... | (Method for internal usage, see AbstractElement) | [
"(",
"Method",
"for",
"internal",
"usage",
"see",
"AbstractElement",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L3808-L3815 | [
"Class",
"node",
"doc",
"kwargs"
] | What does this function do? | [
"(",
"Method",
"for",
"internal",
"usage",
"see",
"AbstractElement",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Word.morphemes | def morphemes(self,set=None):
"""Generator yielding all morphemes (in a particular set if specified). For retrieving one specific morpheme by index, use morpheme() instead"""
for layer in self.select(MorphologyLayer):
for m in layer.select(Morpheme, set):
yield m | python | def morphemes(self,set=None):
"""Generator yielding all morphemes (in a particular set if specified). For retrieving one specific morpheme by index, use morpheme() instead"""
for layer in self.select(MorphologyLayer):
for m in layer.select(Morpheme, set):
yield m | [
"def",
"morphemes",
"(",
"self",
",",
"set",
"=",
"None",
")",
":",
"for",
"layer",
"in",
"self",
".",
"select",
"(",
"MorphologyLayer",
")",
":",
"for",
"m",
"in",
"layer",
".",
"select",
"(",
"Morpheme",
",",
"set",
")",
":",
"yield",
"m"
] | Generator yielding all morphemes (in a particular set if specified). For retrieving one specific morpheme by index, use morpheme() instead | [
"Generator",
"yielding",
"all",
"morphemes",
"(",
"in",
"a",
"particular",
"set",
"if",
"specified",
")",
".",
"For",
"retrieving",
"one",
"specific",
"morpheme",
"by",
"index",
"use",
"morpheme",
"()",
"instead"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4081-L4085 | [
"set"
] | What does this function do? | [
"Generator",
"yielding",
"all",
"morphemes",
"(",
"in",
"a",
"particular",
"set",
"if",
"specified",
")",
".",
"For",
"retrieving",
"one",
"specific",
"morpheme",
"by",
"index",
"use",
"morpheme",
"()",
"instead"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Word.phonemes | def phonemes(self,set=None):
"""Generator yielding all phonemes (in a particular set if specified). For retrieving one specific morpheme by index, use morpheme() instead"""
for layer in self.select(PhonologyLayer):
for p in layer.select(Phoneme, set):
yield p | python | def phonemes(self,set=None):
"""Generator yielding all phonemes (in a particular set if specified). For retrieving one specific morpheme by index, use morpheme() instead"""
for layer in self.select(PhonologyLayer):
for p in layer.select(Phoneme, set):
yield p | [
"def",
"phonemes",
"(",
"self",
",",
"set",
"=",
"None",
")",
":",
"for",
"layer",
"in",
"self",
".",
"select",
"(",
"PhonologyLayer",
")",
":",
"for",
"p",
"in",
"layer",
".",
"select",
"(",
"Phoneme",
",",
"set",
")",
":",
"yield",
"p"
] | Generator yielding all phonemes (in a particular set if specified). For retrieving one specific morpheme by index, use morpheme() instead | [
"Generator",
"yielding",
"all",
"phonemes",
"(",
"in",
"a",
"particular",
"set",
"if",
"specified",
")",
".",
"For",
"retrieving",
"one",
"specific",
"morpheme",
"by",
"index",
"use",
"morpheme",
"()",
"instead"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4087-L4091 | [
"set"
] | What does this function do? | [
"Generator",
"yielding",
"all",
"phonemes",
"(",
"in",
"a",
"particular",
"set",
"if",
"specified",
")",
".",
"For",
"retrieving",
"one",
"specific",
"morpheme",
"by",
"index",
"use",
"morpheme",
"()",
"instead"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Word.morpheme | def morpheme(self,index, set=None):
"""Returns a specific morpheme, the n'th morpheme (given the particular set if specified)."""
for layer in self.select(MorphologyLayer):
for i, m in enumerate(layer.select(Morpheme, set)):
if index == i:
return m
... | python | def morpheme(self,index, set=None):
"""Returns a specific morpheme, the n'th morpheme (given the particular set if specified)."""
for layer in self.select(MorphologyLayer):
for i, m in enumerate(layer.select(Morpheme, set)):
if index == i:
return m
... | [
"def",
"morpheme",
"(",
"self",
",",
"index",
",",
"set",
"=",
"None",
")",
":",
"for",
"layer",
"in",
"self",
".",
"select",
"(",
"MorphologyLayer",
")",
":",
"for",
"i",
",",
"m",
"in",
"enumerate",
"(",
"layer",
".",
"select",
"(",
"Morpheme",
"... | Returns a specific morpheme, the n'th morpheme (given the particular set if specified). | [
"Returns",
"a",
"specific",
"morpheme",
"the",
"n",
"th",
"morpheme",
"(",
"given",
"the",
"particular",
"set",
"if",
"specified",
")",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4093-L4099 | [
"index",
"set"
] | What does this function do? | [
"Returns",
"a",
"specific",
"morpheme",
"the",
"n",
"th",
"morpheme",
"(",
"given",
"the",
"particular",
"set",
"if",
"specified",
")",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | Word.phoneme | def phoneme(self,index, set=None):
"""Returns a specific phoneme, the n'th morpheme (given the particular set if specified)."""
for layer in self.select(PhonologyLayer):
for i, p in enumerate(layer.select(Phoneme, set)):
if index == i:
return p
rai... | python | def phoneme(self,index, set=None):
"""Returns a specific phoneme, the n'th morpheme (given the particular set if specified)."""
for layer in self.select(PhonologyLayer):
for i, p in enumerate(layer.select(Phoneme, set)):
if index == i:
return p
rai... | [
"def",
"phoneme",
"(",
"self",
",",
"index",
",",
"set",
"=",
"None",
")",
":",
"for",
"layer",
"in",
"self",
".",
"select",
"(",
"PhonologyLayer",
")",
":",
"for",
"i",
",",
"p",
"in",
"enumerate",
"(",
"layer",
".",
"select",
"(",
"Phoneme",
",",... | Returns a specific phoneme, the n'th morpheme (given the particular set if specified). | [
"Returns",
"a",
"specific",
"phoneme",
"the",
"n",
"th",
"morpheme",
"(",
"given",
"the",
"particular",
"set",
"if",
"specified",
")",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4102-L4108 | [
"index",
"set"
] | What does this function do? | [
"Returns",
"a",
"specific",
"phoneme",
"the",
"n",
"th",
"morpheme",
"(",
"given",
"the",
"particular",
"set",
"if",
"specified",
")",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | Word.findspans | def findspans(self, type,set=None):
"""Yields span annotation elements of the specified type that include this word.
Arguments:
type: The annotation type, can be passed as using any of the :class:`AnnotationType` member, or by passing the relevant :class:`AbstractSpanAnnotation` or :class:`... | python | def findspans(self, type,set=None):
"""Yields span annotation elements of the specified type that include this word.
Arguments:
type: The annotation type, can be passed as using any of the :class:`AnnotationType` member, or by passing the relevant :class:`AbstractSpanAnnotation` or :class:`... | [
"def",
"findspans",
"(",
"self",
",",
"type",
",",
"set",
"=",
"None",
")",
":",
"if",
"issubclass",
"(",
"type",
",",
"AbstractAnnotationLayer",
")",
":",
"layerclass",
"=",
"type",
"else",
":",
"layerclass",
"=",
"ANNOTATIONTYPE2LAYERCLASS",
"[",
"type",
... | Yields span annotation elements of the specified type that include this word.
Arguments:
type: The annotation type, can be passed as using any of the :class:`AnnotationType` member, or by passing the relevant :class:`AbstractSpanAnnotation` or :class:`AbstractAnnotationLayer` class.
set... | [
"Yields",
"span",
"annotation",
"elements",
"of",
"the",
"specified",
"type",
"that",
"include",
"this",
"word",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4178-L4213 | [
"type",
"set"
] | What does this function do? | [
"Yields",
"span",
"annotation",
"elements",
"of",
"the",
"specified",
"type",
"that",
"include",
"this",
"word",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | Feature.deepvalidation | def deepvalidation(self):
"""Perform deep validation of this element.
Raises:
:class:`DeepValidationError`
"""
if self.doc and self.doc.deepvalidation and self.parent.set and self.parent.set[0] != '_':
try:
self.doc.setdefinitions[self.parent.set]... | python | def deepvalidation(self):
"""Perform deep validation of this element.
Raises:
:class:`DeepValidationError`
"""
if self.doc and self.doc.deepvalidation and self.parent.set and self.parent.set[0] != '_':
try:
self.doc.setdefinitions[self.parent.set]... | [
"def",
"deepvalidation",
"(",
"self",
")",
":",
"if",
"self",
".",
"doc",
"and",
"self",
".",
"doc",
".",
"deepvalidation",
"and",
"self",
".",
"parent",
".",
"set",
"and",
"self",
".",
"parent",
".",
"set",
"[",
"0",
"]",
"!=",
"'_'",
":",
"try",
... | Perform deep validation of this element.
Raises:
:class:`DeepValidationError` | [
"Perform",
"deep",
"validation",
"of",
"this",
"element",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4283-L4300 | [] | What does this function do? | [
"Perform",
"deep",
"validation",
"of",
"this",
"element",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractSpanAnnotation.xml | def xml(self, attribs = None,elements = None, skipchildren = False):
"""See :meth:`AbstractElement.xml`"""
if not attribs: attribs = {}
E = ElementMaker(namespace="http://ilk.uvt.nl/folia",nsmap={None: "http://ilk.uvt.nl/folia", 'xml' : "http://www.w3.org/XML/1998/namespace"})
e = super(... | python | def xml(self, attribs = None,elements = None, skipchildren = False):
"""See :meth:`AbstractElement.xml`"""
if not attribs: attribs = {}
E = ElementMaker(namespace="http://ilk.uvt.nl/folia",nsmap={None: "http://ilk.uvt.nl/folia", 'xml' : "http://www.w3.org/XML/1998/namespace"})
e = super(... | [
"def",
"xml",
"(",
"self",
",",
"attribs",
"=",
"None",
",",
"elements",
"=",
"None",
",",
"skipchildren",
"=",
"False",
")",
":",
"if",
"not",
"attribs",
":",
"attribs",
"=",
"{",
"}",
"E",
"=",
"ElementMaker",
"(",
"namespace",
"=",
"\"http://ilk.uvt... | See :meth:`AbstractElement.xml` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"xml"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4320-L4334 | [
"attribs",
"elements",
"skipchildren"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"xml"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractSpanAnnotation.append | def append(self, child, *args, **kwargs):
"""See :meth:`AbstractElement.append`"""
#Accept Word instances instead of WordReference, references will be automagically used upon serialisation
if isinstance(child, (Word, Morpheme, Phoneme)) and WordReference in self.ACCEPTED_DATA:
#We do... | python | def append(self, child, *args, **kwargs):
"""See :meth:`AbstractElement.append`"""
#Accept Word instances instead of WordReference, references will be automagically used upon serialisation
if isinstance(child, (Word, Morpheme, Phoneme)) and WordReference in self.ACCEPTED_DATA:
#We do... | [
"def",
"append",
"(",
"self",
",",
"child",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"#Accept Word instances instead of WordReference, references will be automagically used upon serialisation",
"if",
"isinstance",
"(",
"child",
",",
"(",
"Word",
",",
"Morp... | See :meth:`AbstractElement.append` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"append"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4337-L4371 | [
"child",
"args",
"kwargs"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"append"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractSpanAnnotation.setspan | def setspan(self, *args):
"""Sets the span of the span element anew, erases all data inside.
Arguments:
*args: Instances of :class:`Word`, :class:`Morpheme` or :class:`Phoneme`
"""
self.data = []
for child in args:
self.append(child) | python | def setspan(self, *args):
"""Sets the span of the span element anew, erases all data inside.
Arguments:
*args: Instances of :class:`Word`, :class:`Morpheme` or :class:`Phoneme`
"""
self.data = []
for child in args:
self.append(child) | [
"def",
"setspan",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"data",
"=",
"[",
"]",
"for",
"child",
"in",
"args",
":",
"self",
".",
"append",
"(",
"child",
")"
] | Sets the span of the span element anew, erases all data inside.
Arguments:
*args: Instances of :class:`Word`, :class:`Morpheme` or :class:`Phoneme` | [
"Sets",
"the",
"span",
"of",
"the",
"span",
"element",
"anew",
"erases",
"all",
"data",
"inside",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4373-L4381 | [
"args"
] | What does this function do? | [
"Sets",
"the",
"span",
"of",
"the",
"span",
"element",
"anew",
"erases",
"all",
"data",
"inside",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractSpanAnnotation.hasannotation | def hasannotation(self,Class,set=None):
"""Returns an integer indicating whether such as annotation exists, and if so, how many. See ``annotations()`` for a description of the parameters."""
return self.count(Class,set,True,default_ignore_annotations) | python | def hasannotation(self,Class,set=None):
"""Returns an integer indicating whether such as annotation exists, and if so, how many. See ``annotations()`` for a description of the parameters."""
return self.count(Class,set,True,default_ignore_annotations) | [
"def",
"hasannotation",
"(",
"self",
",",
"Class",
",",
"set",
"=",
"None",
")",
":",
"return",
"self",
".",
"count",
"(",
"Class",
",",
"set",
",",
"True",
",",
"default_ignore_annotations",
")"
] | Returns an integer indicating whether such as annotation exists, and if so, how many. See ``annotations()`` for a description of the parameters. | [
"Returns",
"an",
"integer",
"indicating",
"whether",
"such",
"as",
"annotation",
"exists",
"and",
"if",
"so",
"how",
"many",
".",
"See",
"annotations",
"()",
"for",
"a",
"description",
"of",
"the",
"parameters",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4386-L4388 | [
"Class",
"set"
] | What does this function do? | [
"Returns",
"an",
"integer",
"indicating",
"whether",
"such",
"as",
"annotation",
"exists",
"and",
"if",
"so",
"how",
"many",
".",
"See",
"annotations",
"()",
"for",
"a",
"description",
"of",
"the",
"parameters",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractSpanAnnotation.annotation | def annotation(self, type, set=None):
"""Will return a **single** annotation (even if there are multiple). Raises a ``NoSuchAnnotation`` exception if none was found"""
l = list(self.select(type,set,True,default_ignore_annotations))
if len(l) >= 1:
return l[0]
else:
... | python | def annotation(self, type, set=None):
"""Will return a **single** annotation (even if there are multiple). Raises a ``NoSuchAnnotation`` exception if none was found"""
l = list(self.select(type,set,True,default_ignore_annotations))
if len(l) >= 1:
return l[0]
else:
... | [
"def",
"annotation",
"(",
"self",
",",
"type",
",",
"set",
"=",
"None",
")",
":",
"l",
"=",
"list",
"(",
"self",
".",
"select",
"(",
"type",
",",
"set",
",",
"True",
",",
"default_ignore_annotations",
")",
")",
"if",
"len",
"(",
"l",
")",
">=",
"... | Will return a **single** annotation (even if there are multiple). Raises a ``NoSuchAnnotation`` exception if none was found | [
"Will",
"return",
"a",
"**",
"single",
"**",
"annotation",
"(",
"even",
"if",
"there",
"are",
"multiple",
")",
".",
"Raises",
"a",
"NoSuchAnnotation",
"exception",
"if",
"none",
"was",
"found"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4390-L4396 | [
"type",
"set"
] | What does this function do? | [
"Will",
"return",
"a",
"**",
"single",
"**",
"annotation",
"(",
"even",
"if",
"there",
"are",
"multiple",
")",
".",
"Raises",
"a",
"NoSuchAnnotation",
"exception",
"if",
"none",
"was",
"found"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractSpanAnnotation.wrefs | def wrefs(self, index = None, recurse=True):
"""Returns a list of word references, these can be Words but also Morphemes or Phonemes.
Arguments:
index (int or None): If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning the list of all
... | python | def wrefs(self, index = None, recurse=True):
"""Returns a list of word references, these can be Words but also Morphemes or Phonemes.
Arguments:
index (int or None): If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning the list of all
... | [
"def",
"wrefs",
"(",
"self",
",",
"index",
"=",
"None",
",",
"recurse",
"=",
"True",
")",
":",
"targets",
"=",
"[",
"]",
"self",
".",
"_helper_wrefs",
"(",
"targets",
",",
"recurse",
")",
"if",
"index",
"is",
"None",
":",
"return",
"targets",
"else",... | Returns a list of word references, these can be Words but also Morphemes or Phonemes.
Arguments:
index (int or None): If set to an integer, will retrieve and return the n'th element (starting at 0) instead of returning the list of all | [
"Returns",
"a",
"list",
"of",
"word",
"references",
"these",
"can",
"be",
"Words",
"but",
"also",
"Morphemes",
"or",
"Phonemes",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4439-L4450 | [
"index",
"recurse"
] | What does this function do? | [
"Returns",
"a",
"list",
"of",
"word",
"references",
"these",
"can",
"be",
"Words",
"but",
"also",
"Morphemes",
"or",
"Phonemes",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractSpanAnnotation.addtoindex | def addtoindex(self,norecurse=None):
"""Makes sure this element (and all subelements), are properly added to the index"""
if not norecurse: norecurse = (Word, Morpheme, Phoneme)
if self.id:
self.doc.index[self.id] = self
for e in self.data:
if all([not isinstance(... | python | def addtoindex(self,norecurse=None):
"""Makes sure this element (and all subelements), are properly added to the index"""
if not norecurse: norecurse = (Word, Morpheme, Phoneme)
if self.id:
self.doc.index[self.id] = self
for e in self.data:
if all([not isinstance(... | [
"def",
"addtoindex",
"(",
"self",
",",
"norecurse",
"=",
"None",
")",
":",
"if",
"not",
"norecurse",
":",
"norecurse",
"=",
"(",
"Word",
",",
"Morpheme",
",",
"Phoneme",
")",
"if",
"self",
".",
"id",
":",
"self",
".",
"doc",
".",
"index",
"[",
"sel... | Makes sure this element (and all subelements), are properly added to the index | [
"Makes",
"sure",
"this",
"element",
"(",
"and",
"all",
"subelements",
")",
"are",
"properly",
"added",
"to",
"the",
"index"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4452-L4462 | [
"norecurse"
] | What does this function do? | [
"Makes",
"sure",
"this",
"element",
"(",
"and",
"all",
"subelements",
")",
"are",
"properly",
"added",
"to",
"the",
"index"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractSpanAnnotation.copychildren | def copychildren(self, newdoc=None, idsuffix=""):
"""Generator creating a deep copy of the children of this element. If idsuffix is a string, if set to True, a random idsuffix will be generated including a random 32-bit hash"""
if idsuffix is True: idsuffix = ".copy." + "%08x" % random.getrandbits(32) #... | python | def copychildren(self, newdoc=None, idsuffix=""):
"""Generator creating a deep copy of the children of this element. If idsuffix is a string, if set to True, a random idsuffix will be generated including a random 32-bit hash"""
if idsuffix is True: idsuffix = ".copy." + "%08x" % random.getrandbits(32) #... | [
"def",
"copychildren",
"(",
"self",
",",
"newdoc",
"=",
"None",
",",
"idsuffix",
"=",
"\"\"",
")",
":",
"if",
"idsuffix",
"is",
"True",
":",
"idsuffix",
"=",
"\".copy.\"",
"+",
"\"%08x\"",
"%",
"random",
".",
"getrandbits",
"(",
"32",
")",
"#random 32-bi... | Generator creating a deep copy of the children of this element. If idsuffix is a string, if set to True, a random idsuffix will be generated including a random 32-bit hash | [
"Generator",
"creating",
"a",
"deep",
"copy",
"of",
"the",
"children",
"of",
"this",
"element",
".",
"If",
"idsuffix",
"is",
"a",
"string",
"if",
"set",
"to",
"True",
"a",
"random",
"idsuffix",
"will",
"be",
"generated",
"including",
"a",
"random",
"32",
... | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4465-L4472 | [
"newdoc",
"idsuffix"
] | What does this function do? | [
"Generator",
"creating",
"a",
"deep",
"copy",
"of",
"the",
"children",
"of",
"this",
"element",
".",
"If",
"idsuffix",
"is",
"a",
"string",
"if",
"set",
"to",
"True",
"a",
"random",
"idsuffix",
"will",
"be",
"generated",
"including",
"a",
"random",
"32",
... |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractAnnotationLayer.xml | def xml(self, attribs = None,elements = None, skipchildren = False):
"""See :meth:`AbstractElement.xml`"""
if self.set is False or self.set is None:
if len(self.data) == 0: #just skip if there are no children
return None
else:
raise ValueError("No ... | python | def xml(self, attribs = None,elements = None, skipchildren = False):
"""See :meth:`AbstractElement.xml`"""
if self.set is False or self.set is None:
if len(self.data) == 0: #just skip if there are no children
return None
else:
raise ValueError("No ... | [
"def",
"xml",
"(",
"self",
",",
"attribs",
"=",
"None",
",",
"elements",
"=",
"None",
",",
"skipchildren",
"=",
"False",
")",
":",
"if",
"self",
".",
"set",
"is",
"False",
"or",
"self",
".",
"set",
"is",
"None",
":",
"if",
"len",
"(",
"self",
"."... | See :meth:`AbstractElement.xml` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"xml"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4512-L4519 | [
"attribs",
"elements",
"skipchildren"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"xml"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractAnnotationLayer.append | def append(self, child, *args, **kwargs):
"""See :meth:`AbstractElement.append`"""
#if no set is associated with the layer yet, we learn it from span annotation elements that are added
if self.set is False or self.set is None:
if inspect.isclass(child):
if issubclass(... | python | def append(self, child, *args, **kwargs):
"""See :meth:`AbstractElement.append`"""
#if no set is associated with the layer yet, we learn it from span annotation elements that are added
if self.set is False or self.set is None:
if inspect.isclass(child):
if issubclass(... | [
"def",
"append",
"(",
"self",
",",
"child",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"#if no set is associated with the layer yet, we learn it from span annotation elements that are added",
"if",
"self",
".",
"set",
"is",
"False",
"or",
"self",
".",
"set... | See :meth:`AbstractElement.append` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"append"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4521-L4539 | [
"child",
"args",
"kwargs"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"append"
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractAnnotationLayer.alternatives | def alternatives(self, Class=None, set=None):
"""Generator over alternatives, either all or only of a specific annotation type, and possibly restrained also by set.
Arguments:
* ``Class`` - The Class you want to retrieve (e.g. PosAnnotation). Or set to None to select all alternatives regard... | python | def alternatives(self, Class=None, set=None):
"""Generator over alternatives, either all or only of a specific annotation type, and possibly restrained also by set.
Arguments:
* ``Class`` - The Class you want to retrieve (e.g. PosAnnotation). Or set to None to select all alternatives regard... | [
"def",
"alternatives",
"(",
"self",
",",
"Class",
"=",
"None",
",",
"set",
"=",
"None",
")",
":",
"for",
"e",
"in",
"self",
".",
"select",
"(",
"AlternativeLayers",
",",
"None",
",",
"True",
",",
"[",
"'Original'",
",",
"'Suggestion'",
"]",
")",
":",... | Generator over alternatives, either all or only of a specific annotation type, and possibly restrained also by set.
Arguments:
* ``Class`` - The Class you want to retrieve (e.g. PosAnnotation). Or set to None to select all alternatives regardless of what type they are.
* ``set`` - The... | [
"Generator",
"over",
"alternatives",
"either",
"all",
"or",
"only",
"of",
"a",
"specific",
"annotation",
"type",
"and",
"possibly",
"restrained",
"also",
"by",
"set",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4574-L4599 | [
"Class",
"set"
] | What does this function do? | [
"Generator",
"over",
"alternatives",
"either",
"all",
"or",
"only",
"of",
"a",
"specific",
"annotation",
"type",
"and",
"possibly",
"restrained",
"also",
"by",
"set",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractAnnotationLayer.findspan | def findspan(self, *words):
"""Returns the span element which spans over the specified words or morphemes.
See also:
:meth:`Word.findspans`
"""
for span in self.select(AbstractSpanAnnotation,None,True):
if tuple(span.wrefs()) == words:
return spa... | python | def findspan(self, *words):
"""Returns the span element which spans over the specified words or morphemes.
See also:
:meth:`Word.findspans`
"""
for span in self.select(AbstractSpanAnnotation,None,True):
if tuple(span.wrefs()) == words:
return spa... | [
"def",
"findspan",
"(",
"self",
",",
"*",
"words",
")",
":",
"for",
"span",
"in",
"self",
".",
"select",
"(",
"AbstractSpanAnnotation",
",",
"None",
",",
"True",
")",
":",
"if",
"tuple",
"(",
"span",
".",
"wrefs",
"(",
")",
")",
"==",
"words",
":",... | Returns the span element which spans over the specified words or morphemes.
See also:
:meth:`Word.findspans` | [
"Returns",
"the",
"span",
"element",
"which",
"spans",
"over",
"the",
"specified",
"words",
"or",
"morphemes",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4601-L4611 | [
"words"
] | What does this function do? | [
"Returns",
"the",
"span",
"element",
"which",
"spans",
"over",
"the",
"specified",
"words",
"or",
"morphemes",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | AbstractAnnotationLayer.relaxng | def relaxng(cls, includechildren=True,extraattribs = None, extraelements=None, origclass = None):
"""Returns a RelaxNG definition for this element (as an XML element (lxml.etree) rather than a string)"""
E = ElementMaker(namespace="http://relaxng.org/ns/structure/1.0",nsmap={None:'http://relaxng.org/ns/... | python | def relaxng(cls, includechildren=True,extraattribs = None, extraelements=None, origclass = None):
"""Returns a RelaxNG definition for this element (as an XML element (lxml.etree) rather than a string)"""
E = ElementMaker(namespace="http://relaxng.org/ns/structure/1.0",nsmap={None:'http://relaxng.org/ns/... | [
"def",
"relaxng",
"(",
"cls",
",",
"includechildren",
"=",
"True",
",",
"extraattribs",
"=",
"None",
",",
"extraelements",
"=",
"None",
",",
"origclass",
"=",
"None",
")",
":",
"E",
"=",
"ElementMaker",
"(",
"namespace",
"=",
"\"http://relaxng.org/ns/structure... | Returns a RelaxNG definition for this element (as an XML element (lxml.etree) rather than a string) | [
"Returns",
"a",
"RelaxNG",
"definition",
"for",
"this",
"element",
"(",
"as",
"an",
"XML",
"element",
"(",
"lxml",
".",
"etree",
")",
"rather",
"than",
"a",
"string",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4614-L4620 | [
"cls",
"includechildren",
"extraattribs",
"extraelements",
"origclass"
] | What does this function do? | [
"Returns",
"a",
"RelaxNG",
"definition",
"for",
"this",
"element",
"(",
"as",
"an",
"XML",
"element",
"(",
"lxml",
".",
"etree",
")",
"rather",
"than",
"a",
"string",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.hasnew | def hasnew(self,allowempty=False):
"""Does the correction define new corrected annotations?"""
for e in self.select(New,None,False, False):
if not allowempty and len(e) == 0: continue
return True
return False | python | def hasnew(self,allowempty=False):
"""Does the correction define new corrected annotations?"""
for e in self.select(New,None,False, False):
if not allowempty and len(e) == 0: continue
return True
return False | [
"def",
"hasnew",
"(",
"self",
",",
"allowempty",
"=",
"False",
")",
":",
"for",
"e",
"in",
"self",
".",
"select",
"(",
"New",
",",
"None",
",",
"False",
",",
"False",
")",
":",
"if",
"not",
"allowempty",
"and",
"len",
"(",
"e",
")",
"==",
"0",
... | Does the correction define new corrected annotations? | [
"Does",
"the",
"correction",
"define",
"new",
"corrected",
"annotations?"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4982-L4987 | [
"allowempty"
] | What does this function do? | [
"Does",
"the",
"correction",
"define",
"new",
"corrected",
"annotations?"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.hasoriginal | def hasoriginal(self,allowempty=False):
"""Does the correction record the old annotations prior to correction?"""
for e in self.select(Original,None,False, False):
if not allowempty and len(e) == 0: continue
return True
return False | python | def hasoriginal(self,allowempty=False):
"""Does the correction record the old annotations prior to correction?"""
for e in self.select(Original,None,False, False):
if not allowempty and len(e) == 0: continue
return True
return False | [
"def",
"hasoriginal",
"(",
"self",
",",
"allowempty",
"=",
"False",
")",
":",
"for",
"e",
"in",
"self",
".",
"select",
"(",
"Original",
",",
"None",
",",
"False",
",",
"False",
")",
":",
"if",
"not",
"allowempty",
"and",
"len",
"(",
"e",
")",
"==",... | Does the correction record the old annotations prior to correction? | [
"Does",
"the",
"correction",
"record",
"the",
"old",
"annotations",
"prior",
"to",
"correction?"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4989-L4994 | [
"allowempty"
] | What does this function do? | [
"Does",
"the",
"correction",
"record",
"the",
"old",
"annotations",
"prior",
"to",
"correction?"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.hascurrent | def hascurrent(self, allowempty=False):
"""Does the correction record the current authoritative annotation (needed only in a structural context when suggestions are proposed)"""
for e in self.select(Current,None,False, False):
if not allowempty and len(e) == 0: continue
return Tr... | python | def hascurrent(self, allowempty=False):
"""Does the correction record the current authoritative annotation (needed only in a structural context when suggestions are proposed)"""
for e in self.select(Current,None,False, False):
if not allowempty and len(e) == 0: continue
return Tr... | [
"def",
"hascurrent",
"(",
"self",
",",
"allowempty",
"=",
"False",
")",
":",
"for",
"e",
"in",
"self",
".",
"select",
"(",
"Current",
",",
"None",
",",
"False",
",",
"False",
")",
":",
"if",
"not",
"allowempty",
"and",
"len",
"(",
"e",
")",
"==",
... | Does the correction record the current authoritative annotation (needed only in a structural context when suggestions are proposed) | [
"Does",
"the",
"correction",
"record",
"the",
"current",
"authoritative",
"annotation",
"(",
"needed",
"only",
"in",
"a",
"structural",
"context",
"when",
"suggestions",
"are",
"proposed",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L4996-L5001 | [
"allowempty"
] | What does this function do? | [
"Does",
"the",
"correction",
"record",
"the",
"current",
"authoritative",
"annotation",
"(",
"needed",
"only",
"in",
"a",
"structural",
"context",
"when",
"suggestions",
"are",
"proposed",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.hassuggestions | def hassuggestions(self,allowempty=False):
"""Does the correction propose suggestions for correction?"""
for e in self.select(Suggestion,None,False, False):
if not allowempty and len(e) == 0: continue
return True
return False | python | def hassuggestions(self,allowempty=False):
"""Does the correction propose suggestions for correction?"""
for e in self.select(Suggestion,None,False, False):
if not allowempty and len(e) == 0: continue
return True
return False | [
"def",
"hassuggestions",
"(",
"self",
",",
"allowempty",
"=",
"False",
")",
":",
"for",
"e",
"in",
"self",
".",
"select",
"(",
"Suggestion",
",",
"None",
",",
"False",
",",
"False",
")",
":",
"if",
"not",
"allowempty",
"and",
"len",
"(",
"e",
")",
... | Does the correction propose suggestions for correction? | [
"Does",
"the",
"correction",
"propose",
"suggestions",
"for",
"correction?"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5003-L5008 | [
"allowempty"
] | What does this function do? | [
"Does",
"the",
"correction",
"propose",
"suggestions",
"for",
"correction?"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.textcontent | def textcontent(self, cls='current', correctionhandling=CorrectionHandling.CURRENT):
"""See :meth:`AbstractElement.textcontent`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
if correctionhandling in (CorrectionHandling.CURRENT, CorrectionHandli... | python | def textcontent(self, cls='current', correctionhandling=CorrectionHandling.CURRENT):
"""See :meth:`AbstractElement.textcontent`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
if correctionhandling in (CorrectionHandling.CURRENT, CorrectionHandli... | [
"def",
"textcontent",
"(",
"self",
",",
"cls",
"=",
"'current'",
",",
"correctionhandling",
"=",
"CorrectionHandling",
".",
"CURRENT",
")",
":",
"if",
"cls",
"==",
"'original'",
":",
"correctionhandling",
"=",
"CorrectionHandling",
".",
"ORIGINAL",
"#backward comp... | See :meth:`AbstractElement.textcontent` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"textcontent"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5010-L5021 | [
"cls",
"correctionhandling"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"textcontent"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.phoncontent | def phoncontent(self, cls='current', correctionhandling=CorrectionHandling.CURRENT):
"""See :meth:`AbstractElement.phoncontent`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
if correctionhandling in (CorrectionHandling.CURRENT, CorrectionHandli... | python | def phoncontent(self, cls='current', correctionhandling=CorrectionHandling.CURRENT):
"""See :meth:`AbstractElement.phoncontent`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
if correctionhandling in (CorrectionHandling.CURRENT, CorrectionHandli... | [
"def",
"phoncontent",
"(",
"self",
",",
"cls",
"=",
"'current'",
",",
"correctionhandling",
"=",
"CorrectionHandling",
".",
"CURRENT",
")",
":",
"if",
"cls",
"==",
"'original'",
":",
"correctionhandling",
"=",
"CorrectionHandling",
".",
"ORIGINAL",
"#backward comp... | See :meth:`AbstractElement.phoncontent` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"phoncontent"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5024-L5035 | [
"cls",
"correctionhandling"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"phoncontent"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.hastext | def hastext(self, cls='current',strict=True, correctionhandling=CorrectionHandling.CURRENT):
"""See :meth:`AbstractElement.hastext`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
if correctionhandling in (CorrectionHandling.CURRENT, CorrectionHa... | python | def hastext(self, cls='current',strict=True, correctionhandling=CorrectionHandling.CURRENT):
"""See :meth:`AbstractElement.hastext`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
if correctionhandling in (CorrectionHandling.CURRENT, CorrectionHa... | [
"def",
"hastext",
"(",
"self",
",",
"cls",
"=",
"'current'",
",",
"strict",
"=",
"True",
",",
"correctionhandling",
"=",
"CorrectionHandling",
".",
"CURRENT",
")",
":",
"if",
"cls",
"==",
"'original'",
":",
"correctionhandling",
"=",
"CorrectionHandling",
".",... | See :meth:`AbstractElement.hastext` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"hastext"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5038-L5049 | [
"cls",
"strict",
"correctionhandling"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"hastext"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.text | def text(self, cls = 'current', retaintokenisation=False, previousdelimiter="",strict=False, correctionhandling=CorrectionHandling.CURRENT, normalize_spaces=False):
"""See :meth:`AbstractElement.text`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
... | python | def text(self, cls = 'current', retaintokenisation=False, previousdelimiter="",strict=False, correctionhandling=CorrectionHandling.CURRENT, normalize_spaces=False):
"""See :meth:`AbstractElement.text`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
... | [
"def",
"text",
"(",
"self",
",",
"cls",
"=",
"'current'",
",",
"retaintokenisation",
"=",
"False",
",",
"previousdelimiter",
"=",
"\"\"",
",",
"strict",
"=",
"False",
",",
"correctionhandling",
"=",
"CorrectionHandling",
".",
"CURRENT",
",",
"normalize_spaces",
... | See :meth:`AbstractElement.text` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"text"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5051-L5070 | [
"cls",
"retaintokenisation",
"previousdelimiter",
"strict",
"correctionhandling",
"normalize_spaces"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"text"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.phon | def phon(self, cls = 'current', previousdelimiter="",strict=False, correctionhandling=CorrectionHandling.CURRENT):
"""See :meth:`AbstractElement.phon`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
if correctionhandling in (CorrectionHandling.CU... | python | def phon(self, cls = 'current', previousdelimiter="",strict=False, correctionhandling=CorrectionHandling.CURRENT):
"""See :meth:`AbstractElement.phon`"""
if cls == 'original': correctionhandling = CorrectionHandling.ORIGINAL #backward compatibility
if correctionhandling in (CorrectionHandling.CU... | [
"def",
"phon",
"(",
"self",
",",
"cls",
"=",
"'current'",
",",
"previousdelimiter",
"=",
"\"\"",
",",
"strict",
"=",
"False",
",",
"correctionhandling",
"=",
"CorrectionHandling",
".",
"CURRENT",
")",
":",
"if",
"cls",
"==",
"'original'",
":",
"correctionhan... | See :meth:`AbstractElement.phon` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"phon"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5085-L5096 | [
"cls",
"previousdelimiter",
"strict",
"correctionhandling"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"phon"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.gettextdelimiter | def gettextdelimiter(self, retaintokenisation=False):
"""See :meth:`AbstractElement.gettextdelimiter`"""
for e in self:
if isinstance(e, New) or isinstance(e, Current):
return e.gettextdelimiter(retaintokenisation)
return "" | python | def gettextdelimiter(self, retaintokenisation=False):
"""See :meth:`AbstractElement.gettextdelimiter`"""
for e in self:
if isinstance(e, New) or isinstance(e, Current):
return e.gettextdelimiter(retaintokenisation)
return "" | [
"def",
"gettextdelimiter",
"(",
"self",
",",
"retaintokenisation",
"=",
"False",
")",
":",
"for",
"e",
"in",
"self",
":",
"if",
"isinstance",
"(",
"e",
",",
"New",
")",
"or",
"isinstance",
"(",
"e",
",",
"Current",
")",
":",
"return",
"e",
".",
"gett... | See :meth:`AbstractElement.gettextdelimiter` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"gettextdelimiter"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5098-L5103 | [
"retaintokenisation"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"gettextdelimiter"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.new | def new(self,index = None):
"""Get the new corrected annotation.
This returns only one annotation if multiple exist, use `index` to select another in the sequence.
Returns:
an annotation element (:class:`AbstractElement`)
Raises:
:class:`NoSuchAnnotation`
... | python | def new(self,index = None):
"""Get the new corrected annotation.
This returns only one annotation if multiple exist, use `index` to select another in the sequence.
Returns:
an annotation element (:class:`AbstractElement`)
Raises:
:class:`NoSuchAnnotation`
... | [
"def",
"new",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"try",
":",
"return",
"next",
"(",
"self",
".",
"select",
"(",
"New",
",",
"None",
",",
"False",
")",
")",
"except",
"StopIteration",
":",
"raise",
... | Get the new corrected annotation.
This returns only one annotation if multiple exist, use `index` to select another in the sequence.
Returns:
an annotation element (:class:`AbstractElement`)
Raises:
:class:`NoSuchAnnotation` | [
"Get",
"the",
"new",
"corrected",
"annotation",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5106-L5126 | [
"index"
] | What does this function do? | [
"Get",
"the",
"new",
"corrected",
"annotation",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.original | def original(self,index=None):
"""Get the old annotation prior to correction.
This returns only one annotation if multiple exist, use `index` to select another in the sequence.
Returns:
an annotation element (:class:`AbstractElement`)
Raises:
:class:`NoSuchAnno... | python | def original(self,index=None):
"""Get the old annotation prior to correction.
This returns only one annotation if multiple exist, use `index` to select another in the sequence.
Returns:
an annotation element (:class:`AbstractElement`)
Raises:
:class:`NoSuchAnno... | [
"def",
"original",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"try",
":",
"return",
"next",
"(",
"self",
".",
"select",
"(",
"Original",
",",
"None",
",",
"False",
",",
"False",
")",
")",
"except",
"StopIter... | Get the old annotation prior to correction.
This returns only one annotation if multiple exist, use `index` to select another in the sequence.
Returns:
an annotation element (:class:`AbstractElement`)
Raises:
:class:`NoSuchAnnotation` | [
"Get",
"the",
"old",
"annotation",
"prior",
"to",
"correction",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5128-L5147 | [
"index"
] | What does this function do? | [
"Get",
"the",
"old",
"annotation",
"prior",
"to",
"correction",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.current | def current(self,index=None):
"""Get the current authoritative annotation (used with suggestions in a structural context)
This returns only one annotation if multiple exist, use `index` to select another in the sequence.
Returns:
an annotation element (:class:`AbstractElement`)
... | python | def current(self,index=None):
"""Get the current authoritative annotation (used with suggestions in a structural context)
This returns only one annotation if multiple exist, use `index` to select another in the sequence.
Returns:
an annotation element (:class:`AbstractElement`)
... | [
"def",
"current",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"try",
":",
"return",
"next",
"(",
"self",
".",
"select",
"(",
"Current",
",",
"None",
",",
"False",
")",
")",
"except",
"StopIteration",
":",
"ra... | Get the current authoritative annotation (used with suggestions in a structural context)
This returns only one annotation if multiple exist, use `index` to select another in the sequence.
Returns:
an annotation element (:class:`AbstractElement`)
Raises:
:class:`NoSuchA... | [
"Get",
"the",
"current",
"authoritative",
"annotation",
"(",
"used",
"with",
"suggestions",
"in",
"a",
"structural",
"context",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5149-L5168 | [
"index"
] | What does this function do? | [
"Get",
"the",
"current",
"authoritative",
"annotation",
"(",
"used",
"with",
"suggestions",
"in",
"a",
"structural",
"context",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Correction.suggestions | def suggestions(self,index=None):
"""Get suggestions for correction.
Yields:
:class:`Suggestion` element that encapsulate the suggested annotations (if index is ``None``, default)
Returns:
a :class:`Suggestion` element that encapsulate the suggested annotations (if inde... | python | def suggestions(self,index=None):
"""Get suggestions for correction.
Yields:
:class:`Suggestion` element that encapsulate the suggested annotations (if index is ``None``, default)
Returns:
a :class:`Suggestion` element that encapsulate the suggested annotations (if inde... | [
"def",
"suggestions",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"if",
"index",
"is",
"None",
":",
"return",
"self",
".",
"select",
"(",
"Suggestion",
",",
"None",
",",
"False",
",",
"False",
")",
"else",
":",
"for",
"i",
",",
"e",
"in",
"... | Get suggestions for correction.
Yields:
:class:`Suggestion` element that encapsulate the suggested annotations (if index is ``None``, default)
Returns:
a :class:`Suggestion` element that encapsulate the suggested annotations (if index is set)
Raises:
:class... | [
"Get",
"suggestions",
"for",
"correction",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5170-L5188 | [
"index"
] | What does this function do? | [
"Get",
"suggestions",
"for",
"correction",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | External.select | def select(self, Class, set=None, recursive=True, ignore=True, node=None):
"""See :meth:`AbstractElement.select`"""
if self.include:
return self.subdoc.data[0].select(Class,set,recursive, ignore, node) #pass it on to the text node of the subdoc
else:
return iter([]) | python | def select(self, Class, set=None, recursive=True, ignore=True, node=None):
"""See :meth:`AbstractElement.select`"""
if self.include:
return self.subdoc.data[0].select(Class,set,recursive, ignore, node) #pass it on to the text node of the subdoc
else:
return iter([]) | [
"def",
"select",
"(",
"self",
",",
"Class",
",",
"set",
"=",
"None",
",",
"recursive",
"=",
"True",
",",
"ignore",
"=",
"True",
",",
"node",
"=",
"None",
")",
":",
"if",
"self",
".",
"include",
":",
"return",
"self",
".",
"subdoc",
".",
"data",
"... | See :meth:`AbstractElement.select` | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"select"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5353-L5358 | [
"Class",
"set",
"recursive",
"ignore",
"node"
] | What does this function do? | [
"See",
":",
"meth",
":",
"AbstractElement",
".",
"select"
] |
proycon/pynlpl | pynlpl/formats/folia.py | WordReference.xml | def xml(self, attribs = None,elements = None, skipchildren = False):
"""Serialises the FoLiA element to XML, by returning an XML Element (in lxml.etree) for this element and all its children. For string output, consider the xmlstring() method instead."""
E = ElementMaker(namespace=NSFOLIA,nsmap={None: N... | python | def xml(self, attribs = None,elements = None, skipchildren = False):
"""Serialises the FoLiA element to XML, by returning an XML Element (in lxml.etree) for this element and all its children. For string output, consider the xmlstring() method instead."""
E = ElementMaker(namespace=NSFOLIA,nsmap={None: N... | [
"def",
"xml",
"(",
"self",
",",
"attribs",
"=",
"None",
",",
"elements",
"=",
"None",
",",
"skipchildren",
"=",
"False",
")",
":",
"E",
"=",
"ElementMaker",
"(",
"namespace",
"=",
"NSFOLIA",
",",
"nsmap",
"=",
"{",
"None",
":",
"NSFOLIA",
",",
"'xml'... | Serialises the FoLiA element to XML, by returning an XML Element (in lxml.etree) for this element and all its children. For string output, consider the xmlstring() method instead. | [
"Serialises",
"the",
"FoLiA",
"element",
"to",
"XML",
"by",
"returning",
"an",
"XML",
"Element",
"(",
"in",
"lxml",
".",
"etree",
")",
"for",
"this",
"element",
"and",
"all",
"its",
"children",
".",
"For",
"string",
"output",
"consider",
"the",
"xmlstring"... | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5402-L5418 | [
"attribs",
"elements",
"skipchildren"
] | What does this function do? | [
"Serialises",
"the",
"FoLiA",
"element",
"to",
"XML",
"by",
"returning",
"an",
"XML",
"Element",
"(",
"in",
"lxml",
".",
"etree",
")",
"for",
"this",
"element",
"and",
"all",
"its",
"children",
".",
"For",
"string",
"output",
"consider",
"the",
"xmlstring"... |
proycon/pynlpl | pynlpl/formats/folia.py | ComplexAlignment.annotation | def annotation(self, type, set=None):
"""Will return a **single** annotation (even if there are multiple). Raises a ``NoSuchAnnotation`` exception if none was found"""
l = self.count(type,set,True,default_ignore_annotations)
if len(l) >= 1:
return l[0]
else:
raise... | python | def annotation(self, type, set=None):
"""Will return a **single** annotation (even if there are multiple). Raises a ``NoSuchAnnotation`` exception if none was found"""
l = self.count(type,set,True,default_ignore_annotations)
if len(l) >= 1:
return l[0]
else:
raise... | [
"def",
"annotation",
"(",
"self",
",",
"type",
",",
"set",
"=",
"None",
")",
":",
"l",
"=",
"self",
".",
"count",
"(",
"type",
",",
"set",
",",
"True",
",",
"default_ignore_annotations",
")",
"if",
"len",
"(",
"l",
")",
">=",
"1",
":",
"return",
... | Will return a **single** annotation (even if there are multiple). Raises a ``NoSuchAnnotation`` exception if none was found | [
"Will",
"return",
"a",
"**",
"single",
"**",
"annotation",
"(",
"even",
"if",
"there",
"are",
"multiple",
")",
".",
"Raises",
"a",
"NoSuchAnnotation",
"exception",
"if",
"none",
"was",
"found"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5514-L5520 | [
"type",
"set"
] | What does this function do? | [
"Will",
"return",
"a",
"**",
"single",
"**",
"annotation",
"(",
"even",
"if",
"there",
"are",
"multiple",
")",
".",
"Raises",
"a",
"NoSuchAnnotation",
"exception",
"if",
"none",
"was",
"found"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Morpheme.findspans | def findspans(self, type,set=None):
"""Find span annotation of the specified type that include this word"""
if issubclass(type, AbstractAnnotationLayer):
layerclass = type
else:
layerclass = ANNOTATIONTYPE2LAYERCLASS[type.ANNOTATIONTYPE]
e = self
while Tru... | python | def findspans(self, type,set=None):
"""Find span annotation of the specified type that include this word"""
if issubclass(type, AbstractAnnotationLayer):
layerclass = type
else:
layerclass = ANNOTATIONTYPE2LAYERCLASS[type.ANNOTATIONTYPE]
e = self
while Tru... | [
"def",
"findspans",
"(",
"self",
",",
"type",
",",
"set",
"=",
"None",
")",
":",
"if",
"issubclass",
"(",
"type",
",",
"AbstractAnnotationLayer",
")",
":",
"layerclass",
"=",
"type",
"else",
":",
"layerclass",
"=",
"ANNOTATIONTYPE2LAYERCLASS",
"[",
"type",
... | Find span annotation of the specified type that include this word | [
"Find",
"span",
"annotation",
"of",
"the",
"specified",
"type",
"that",
"include",
"this",
"word"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5528-L5542 | [
"type",
"set"
] | What does this function do? | [
"Find",
"span",
"annotation",
"of",
"the",
"specified",
"type",
"that",
"include",
"this",
"word"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Sentence.correctwords | def correctwords(self, originalwords, newwords, **kwargs):
"""Generic correction method for words. You most likely want to use the helper functions
:meth:`Sentence.splitword` , :meth:`Sentence.mergewords`, :meth:`deleteword`, :meth:`insertword` instead"""
for w in originalwords:
i... | python | def correctwords(self, originalwords, newwords, **kwargs):
"""Generic correction method for words. You most likely want to use the helper functions
:meth:`Sentence.splitword` , :meth:`Sentence.mergewords`, :meth:`deleteword`, :meth:`insertword` instead"""
for w in originalwords:
i... | [
"def",
"correctwords",
"(",
"self",
",",
"originalwords",
",",
"newwords",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"w",
"in",
"originalwords",
":",
"if",
"not",
"isinstance",
"(",
"w",
",",
"Word",
")",
":",
"raise",
"Exception",
"(",
"\"Original word ... | Generic correction method for words. You most likely want to use the helper functions
:meth:`Sentence.splitword` , :meth:`Sentence.mergewords`, :meth:`deleteword`, :meth:`insertword` instead | [
"Generic",
"correction",
"method",
"for",
"words",
".",
"You",
"most",
"likely",
"want",
"to",
"use",
"the",
"helper",
"functions",
":",
"meth",
":",
"Sentence",
".",
"splitword",
":",
"meth",
":",
"Sentence",
".",
"mergewords",
":",
"meth",
":",
"deletewo... | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5783-L5798 | [
"originalwords",
"newwords",
"kwargs"
] | What does this function do? | [
"Generic",
"correction",
"method",
"for",
"words",
".",
"You",
"most",
"likely",
"want",
"to",
"use",
"the",
"helper",
"functions",
":",
"meth",
":",
"Sentence",
".",
"splitword",
":",
"meth",
":",
"Sentence",
".",
"mergewords",
":",
"meth",
":",
"deletewo... |
proycon/pynlpl | pynlpl/formats/folia.py | Sentence.splitword | def splitword(self, originalword, *newwords, **kwargs):
"""TODO: Write documentation"""
if isstring(originalword):
originalword = self.doc[u(originalword)]
return self.correctwords([originalword], newwords, **kwargs) | python | def splitword(self, originalword, *newwords, **kwargs):
"""TODO: Write documentation"""
if isstring(originalword):
originalword = self.doc[u(originalword)]
return self.correctwords([originalword], newwords, **kwargs) | [
"def",
"splitword",
"(",
"self",
",",
"originalword",
",",
"*",
"newwords",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isstring",
"(",
"originalword",
")",
":",
"originalword",
"=",
"self",
".",
"doc",
"[",
"u",
"(",
"originalword",
")",
"]",
"return",
... | TODO: Write documentation | [
"TODO",
":",
"Write",
"documentation"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5802-L5806 | [
"originalword",
"newwords",
"kwargs"
] | What does this function do? | [
"TODO",
":",
"Write",
"documentation"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Sentence.mergewords | def mergewords(self, newword, *originalwords, **kwargs):
"""TODO: Write documentation"""
return self.correctwords(originalwords, [newword], **kwargs) | python | def mergewords(self, newword, *originalwords, **kwargs):
"""TODO: Write documentation"""
return self.correctwords(originalwords, [newword], **kwargs) | [
"def",
"mergewords",
"(",
"self",
",",
"newword",
",",
"*",
"originalwords",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"correctwords",
"(",
"originalwords",
",",
"[",
"newword",
"]",
",",
"*",
"*",
"kwargs",
")"
] | TODO: Write documentation | [
"TODO",
":",
"Write",
"documentation"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5810-L5812 | [
"newword",
"originalwords",
"kwargs"
] | What does this function do? | [
"TODO",
":",
"Write",
"documentation"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Sentence.deleteword | def deleteword(self, word, **kwargs):
"""TODO: Write documentation"""
if isstring(word):
word = self.doc[u(word)]
return self.correctwords([word], [], **kwargs) | python | def deleteword(self, word, **kwargs):
"""TODO: Write documentation"""
if isstring(word):
word = self.doc[u(word)]
return self.correctwords([word], [], **kwargs) | [
"def",
"deleteword",
"(",
"self",
",",
"word",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isstring",
"(",
"word",
")",
":",
"word",
"=",
"self",
".",
"doc",
"[",
"u",
"(",
"word",
")",
"]",
"return",
"self",
".",
"correctwords",
"(",
"[",
"word",
... | TODO: Write documentation | [
"TODO",
":",
"Write",
"documentation"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5814-L5818 | [
"word",
"kwargs"
] | What does this function do? | [
"TODO",
":",
"Write",
"documentation"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Sentence.insertwordleft | def insertwordleft(self, newword, nextword, **kwargs):
"""Inserts a word **as a correction** before an existing word.
Reverse of :meth:`Sentence.insertword`.
"""
if nextword:
if isstring(nextword):
nextword = self.doc[u(nextword)]
if not nextword ... | python | def insertwordleft(self, newword, nextword, **kwargs):
"""Inserts a word **as a correction** before an existing word.
Reverse of :meth:`Sentence.insertword`.
"""
if nextword:
if isstring(nextword):
nextword = self.doc[u(nextword)]
if not nextword ... | [
"def",
"insertwordleft",
"(",
"self",
",",
"newword",
",",
"nextword",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"nextword",
":",
"if",
"isstring",
"(",
"nextword",
")",
":",
"nextword",
"=",
"self",
".",
"doc",
"[",
"u",
"(",
"nextword",
")",
"]",
... | Inserts a word **as a correction** before an existing word.
Reverse of :meth:`Sentence.insertword`. | [
"Inserts",
"a",
"word",
"**",
"as",
"a",
"correction",
"**",
"before",
"an",
"existing",
"word",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5858-L5881 | [
"newword",
"nextword",
"kwargs"
] | What does this function do? | [
"Inserts",
"a",
"word",
"**",
"as",
"a",
"correction",
"**",
"before",
"an",
"existing",
"word",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | Pattern.resolve | def resolve(self,size, distribution):
"""Resolve a variable sized pattern to all patterns of a certain fixed size"""
if not self.variablesize():
raise Exception("Can only resize patterns with * wildcards")
nrofwildcards = 0
for x in self.sequence:
if x == '*':
... | python | def resolve(self,size, distribution):
"""Resolve a variable sized pattern to all patterns of a certain fixed size"""
if not self.variablesize():
raise Exception("Can only resize patterns with * wildcards")
nrofwildcards = 0
for x in self.sequence:
if x == '*':
... | [
"def",
"resolve",
"(",
"self",
",",
"size",
",",
"distribution",
")",
":",
"if",
"not",
"self",
".",
"variablesize",
"(",
")",
":",
"raise",
"Exception",
"(",
"\"Can only resize patterns with * wildcards\"",
")",
"nrofwildcards",
"=",
"0",
"for",
"x",
"in",
... | Resolve a variable sized pattern to all patterns of a certain fixed size | [
"Resolve",
"a",
"variable",
"sized",
"pattern",
"to",
"all",
"patterns",
"of",
"a",
"certain",
"fixed",
"size"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L6221-L6242 | [
"size",
"distribution"
] | What does this function do? | [
"Resolve",
"a",
"variable",
"sized",
"pattern",
"to",
"all",
"patterns",
"of",
"a",
"certain",
"fixed",
"size"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Document.load | def load(self, filename):
"""Load a FoLiA XML file.
Argument:
filename (str): The file to load
"""
#if LXE and self.mode != Mode.XPATH:
# #workaround for xml:id problem (disabled)
# #f = open(filename)
# #s = f.read().replace(' xml:id=', ' id... | python | def load(self, filename):
"""Load a FoLiA XML file.
Argument:
filename (str): The file to load
"""
#if LXE and self.mode != Mode.XPATH:
# #workaround for xml:id problem (disabled)
# #f = open(filename)
# #s = f.read().replace(' xml:id=', ' id... | [
"def",
"load",
"(",
"self",
",",
"filename",
")",
":",
"#if LXE and self.mode != Mode.XPATH:",
"# #workaround for xml:id problem (disabled)",
"# #f = open(filename)",
"# #s = f.read().replace(' xml:id=', ' id=')",
"# #f.close()",
"# self.tree = ElementTree.parse(filename)",
... | Load a FoLiA XML file.
Argument:
filename (str): The file to load | [
"Load",
"a",
"FoLiA",
"XML",
"file",
"."
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L6495-L6512 | [
"filename"
] | What does this function do? | [
"Load",
"a",
"FoLiA",
"XML",
"file",
"."
] |
proycon/pynlpl | pynlpl/formats/folia.py | Document.items | def items(self):
"""Returns a depth-first flat list of all items in the document"""
l = []
for e in self.data:
l += e.items()
return l | python | def items(self):
"""Returns a depth-first flat list of all items in the document"""
l = []
for e in self.data:
l += e.items()
return l | [
"def",
"items",
"(",
"self",
")",
":",
"l",
"=",
"[",
"]",
"for",
"e",
"in",
"self",
".",
"data",
":",
"l",
"+=",
"e",
".",
"items",
"(",
")",
"return",
"l"
] | Returns a depth-first flat list of all items in the document | [
"Returns",
"a",
"depth",
"-",
"first",
"flat",
"list",
"of",
"all",
"items",
"in",
"the",
"document"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L6514-L6519 | [] | What does this function do? | [
"Returns",
"a",
"depth",
"-",
"first",
"flat",
"list",
"of",
"all",
"items",
"in",
"the",
"document"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Document.xpath | def xpath(self, query):
"""Run Xpath expression and parse the resulting elements. Don't forget to use the FoLiA namesapace in your expressions, using folia: or the short form f: """
for result in self.tree.xpath(query,namespaces={'f': 'http://ilk.uvt.nl/folia','folia': 'http://ilk.uvt.nl/folia' }):
... | python | def xpath(self, query):
"""Run Xpath expression and parse the resulting elements. Don't forget to use the FoLiA namesapace in your expressions, using folia: or the short form f: """
for result in self.tree.xpath(query,namespaces={'f': 'http://ilk.uvt.nl/folia','folia': 'http://ilk.uvt.nl/folia' }):
... | [
"def",
"xpath",
"(",
"self",
",",
"query",
")",
":",
"for",
"result",
"in",
"self",
".",
"tree",
".",
"xpath",
"(",
"query",
",",
"namespaces",
"=",
"{",
"'f'",
":",
"'http://ilk.uvt.nl/folia'",
",",
"'folia'",
":",
"'http://ilk.uvt.nl/folia'",
"}",
")",
... | Run Xpath expression and parse the resulting elements. Don't forget to use the FoLiA namesapace in your expressions, using folia: or the short form f: | [
"Run",
"Xpath",
"expression",
"and",
"parse",
"the",
"resulting",
"elements",
".",
"Don",
"t",
"forget",
"to",
"use",
"the",
"FoLiA",
"namesapace",
"in",
"your",
"expressions",
"using",
"folia",
":",
"or",
"the",
"short",
"form",
"f",
":"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L6521-L6524 | [
"query"
] | What does this function do? | [
"Run",
"Xpath",
"expression",
"and",
"parse",
"the",
"resulting",
"elements",
".",
"Don",
"t",
"forget",
"to",
"use",
"the",
"FoLiA",
"namesapace",
"in",
"your",
"expressions",
"using",
"folia",
":",
"or",
"the",
"short",
"form",
"f",
":"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Document.alias | def alias(self, annotationtype, set, fallback=False):
"""Return the alias for a set (if applicable, returns the unaltered set otherwise iff fallback is enabled)"""
if inspect.isclass(annotationtype): annotationtype = annotationtype.ANNOTATIONTYPE
if annotationtype in self.set_alias and set in se... | python | def alias(self, annotationtype, set, fallback=False):
"""Return the alias for a set (if applicable, returns the unaltered set otherwise iff fallback is enabled)"""
if inspect.isclass(annotationtype): annotationtype = annotationtype.ANNOTATIONTYPE
if annotationtype in self.set_alias and set in se... | [
"def",
"alias",
"(",
"self",
",",
"annotationtype",
",",
"set",
",",
"fallback",
"=",
"False",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"annotationtype",
")",
":",
"annotationtype",
"=",
"annotationtype",
".",
"ANNOTATIONTYPE",
"if",
"annotationtype",
... | Return the alias for a set (if applicable, returns the unaltered set otherwise iff fallback is enabled) | [
"Return",
"the",
"alias",
"for",
"a",
"set",
"(",
"if",
"applicable",
"returns",
"the",
"unaltered",
"set",
"otherwise",
"iff",
"fallback",
"is",
"enabled",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L6527-L6535 | [
"annotationtype",
"set",
"fallback"
] | What does this function do? | [
"Return",
"the",
"alias",
"for",
"a",
"set",
"(",
"if",
"applicable",
"returns",
"the",
"unaltered",
"set",
"otherwise",
"iff",
"fallback",
"is",
"enabled",
")"
] |
proycon/pynlpl | pynlpl/formats/folia.py | Document.unalias | def unalias(self, annotationtype, alias):
"""Return the set for an alias (if applicable, raises an exception otherwise)"""
if inspect.isclass(annotationtype): annotationtype = annotationtype.ANNOTATIONTYPE
return self.alias_set[annotationtype][alias] | python | def unalias(self, annotationtype, alias):
"""Return the set for an alias (if applicable, raises an exception otherwise)"""
if inspect.isclass(annotationtype): annotationtype = annotationtype.ANNOTATIONTYPE
return self.alias_set[annotationtype][alias] | [
"def",
"unalias",
"(",
"self",
",",
"annotationtype",
",",
"alias",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"annotationtype",
")",
":",
"annotationtype",
"=",
"annotationtype",
".",
"ANNOTATIONTYPE",
"return",
"self",
".",
"alias_set",
"[",
"annotation... | Return the set for an alias (if applicable, raises an exception otherwise) | [
"Return",
"the",
"set",
"for",
"an",
"alias",
"(",
"if",
"applicable",
"raises",
"an",
"exception",
"otherwise",
")"
] | train | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L6538-L6541 | [
"annotationtype",
"alias"
] | What does this function do? | [
"Return",
"the",
"set",
"for",
"an",
"alias",
"(",
"if",
"applicable",
"raises",
"an",
"exception",
"otherwise",
")"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.