本文整理汇总了Python中nltk.corpus.reader.concat方法的典型用法代码示例。如果您正苦于以下问题:Python reader.concat方法的具体用法?Python reader.concat怎么用?Python reader.concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nltk.corpus.reader
的用法示例。
在下文中一共展示了reader.concat方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tagged_paras
# 需要导入模块: from nltk.corpus import reader [as 别名]
# 或者: from nltk.corpus.reader import concat [as 别名]
def tagged_paras(self, fileids=None, tagset="msd", tags=""):
"""
:param fileids: A list specifying the fileids that should be used.
:param tagset: The tagset that should be used in the returned object,
either "universal" or "msd", "msd" is the default
:param tags: An MSD Tag that is used to filter all parts of the used corpus
that are not more precise or at least equal to the given tag
:return: the given file(s) as a list of paragraphs, each encoded as a
list of sentences, which are in turn encoded as a list
of (word,tag) tuples
:rtype: list(list(list(tuple(str, str))))
"""
if tagset == "universal" or tagset == "msd":
return concat([MTEFileReader(os.path.join(self._root, f)).tagged_paras(tagset, tags) for f in self.__fileids(fileids)])
else:
print("Unknown tagset specified.")
示例2: words
# 需要导入模块: from nltk.corpus import reader [as 别名]
# 或者: from nltk.corpus.reader import concat [as 别名]
def words(self, fileids=None):
"""
:param fileids: A list specifying the fileids that should be used.
:return: the given file(s) as a list of words and punctuation symbols.
:rtype: list(str)
"""
return concat([MTEFileReader(os.path.join(self._root, f)).words() for f in self.__fileids(fileids)])
示例3: sents
# 需要导入模块: from nltk.corpus import reader [as 别名]
# 或者: from nltk.corpus.reader import concat [as 别名]
def sents(self, fileids=None):
"""
:param fileids: A list specifying the fileids that should be used.
:return: the given file(s) as a list of sentences or utterances,
each encoded as a list of word strings
:rtype: list(list(str))
"""
return concat([MTEFileReader(os.path.join(self._root, f)).sents() for f in self.__fileids(fileids)])
示例4: paras
# 需要导入模块: from nltk.corpus import reader [as 别名]
# 或者: from nltk.corpus.reader import concat [as 别名]
def paras(self, fileids=None):
"""
:param fileids: A list specifying the fileids that should be used.
:return: the given file(s) as a list of paragraphs, each encoded as a list
of sentences, which are in turn encoded as lists of word string
:rtype: list(list(list(str)))
"""
return concat([MTEFileReader(os.path.join(self._root, f)).paras() for f in self.__fileids(fileids)])
示例5: lemma_words
# 需要导入模块: from nltk.corpus import reader [as 别名]
# 或者: from nltk.corpus.reader import concat [as 别名]
def lemma_words(self, fileids=None):
"""
:param fileids: A list specifying the fileids that should be used.
:return: the given file(s) as a list of words, the corresponding lemmas
and punctuation symbols, encoded as tuples (word, lemma)
:rtype: list(tuple(str,str))
"""
return concat([MTEFileReader(os.path.join(self._root, f)).lemma_words() for f in self.__fileids(fileids)])
示例6: tagged_words
# 需要导入模块: from nltk.corpus import reader [as 别名]
# 或者: from nltk.corpus.reader import concat [as 别名]
def tagged_words(self, fileids=None, tagset="msd", tags=""):
"""
:param fileids: A list specifying the fileids that should be used.
:param tagset: The tagset that should be used in the returned object,
either "universal" or "msd", "msd" is the default
:param tags: An MSD Tag that is used to filter all parts of the used corpus
that are not more precise or at least equal to the given tag
:return: the given file(s) as a list of tagged words and punctuation symbols
encoded as tuples (word, tag)
:rtype: list(tuple(str, str))
"""
if tagset == "universal" or tagset == "msd":
return concat([MTEFileReader(os.path.join(self._root, f)).tagged_words(tagset, tags) for f in self.__fileids(fileids)])
else:
print("Unknown tagset specified.")
示例7: tagged_sents
# 需要导入模块: from nltk.corpus import reader [as 别名]
# 或者: from nltk.corpus.reader import concat [as 别名]
def tagged_sents(self, fileids=None, tagset="msd", tags=""):
"""
:param fileids: A list specifying the fileids that should be used.
:param tagset: The tagset that should be used in the returned object,
either "universal" or "msd", "msd" is the default
:param tags: An MSD Tag that is used to filter all parts of the used corpus
that are not more precise or at least equal to the given tag
:return: the given file(s) as a list of sentences or utterances, each
each encoded as a list of (word,tag) tuples
:rtype: list(list(tuple(str, str)))
"""
if tagset == "universal" or tagset == "msd":
return concat([MTEFileReader(os.path.join(self._root, f)).tagged_sents(tagset, tags) for f in self.__fileids(fileids)])
else:
print("Unknown tagset specified.")
示例8: lemma_paras
# 需要导入模块: from nltk.corpus import reader [as 别名]
# 或者: from nltk.corpus.reader import concat [as 别名]
def lemma_paras(self, fileids=None):
"""
:param fileids: A list specifying the fileids that should be used.
:return: the given file(s) as a list of paragraphs, each encoded as a
list of sentences, which are in turn encoded as a list of
tuples of the word and the corresponding lemma (word, lemma)
:rtype: list(List(List(tuple(str, str))))
"""
return concat([MTEFileReader(os.path.join(self._root, f)).lemma_paras() for f in self.__fileids(fileids)])
示例9: raw
# 需要导入模块: from nltk.corpus import reader [as 别名]
# 或者: from nltk.corpus.reader import concat [as 别名]
def raw(self, fileids=None):
"""
:param fileids: A list specifying the fileids that should be used.
:return: the given file(s) as a single string.
:rtype: str
"""
return concat([self.open(f).read() for f in self.__fileids(fileids)])