本文整理匯總了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)])