当前位置: 首页>>代码示例>>Python>>正文


Python util.concat函数代码示例

本文整理汇总了Python中nltk.corpus.reader.util.concat函数的典型用法代码示例。如果您正苦于以下问题:Python concat函数的具体用法?Python concat怎么用?Python concat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了concat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: words

 def words(self, fileids=None, **kwargs):
     return concat(
         [
             self._view(fileid, tags=False, **kwargs)
             for fileid in self._list_morph_files(fileids)
         ]
     )
开发者ID:prz3m,项目名称:kind2anki,代码行数:7,代码来源:ipipan.py

示例2: raw

 def raw(self, fileids=None, **kwargs):
     """
     Returns words in specified fileids.
     """
     return concat([self._view(self.add_root(fileid),
                               mode=NKJPCorpusReader.RAW_MODE, **kwargs).handle_query()
                    for fileid in fileids])
开发者ID:esabelhaus,项目名称:secret-octo-dubstep,代码行数:7,代码来源:nkjp.py

示例3: header

 def header(self, fileids=None, **kwargs):
     """
     Returns header(s) of specified fileids.
     """
     return concat([self._view(self.add_root(fileid),
                               mode=NKJPCorpusReader.HEADER_MODE, **kwargs).handle_query()
                    for fileid in fileids])
开发者ID:esabelhaus,项目名称:secret-octo-dubstep,代码行数:7,代码来源:nkjp.py

示例4: sents

 def sents(self, fileids=None, **kwargs):
     """
     Returns sentences in specified fileids.
     """
     return concat([self._view(self.add_root(fileid),
                               mode=NKJPCorpusReader.SENTS_MODE, **kwargs).handle_query()
                    for fileid in fileids])
开发者ID:esabelhaus,项目名称:secret-octo-dubstep,代码行数:7,代码来源:nkjp.py

示例5: tagged_paras

 def tagged_paras(self, fileids=None, **kwargs):
     return concat(
         [
             self._view(fileid, mode=IPIPANCorpusView.PARAS_MODE, **kwargs)
             for fileid in self._list_morph_files(fileids)
         ]
     )
开发者ID:prz3m,项目名称:kind2anki,代码行数:7,代码来源:ipipan.py

示例6: raw

 def raw(self, fileids=None):
     """
     :return: the given file(s) as a single string.
     :rtype: str
     """
     if fileids is None: fileids = self._fileids
     elif isinstance(fileids, basestring): fileids = [fileids]
     return concat([self.open(f).read() for f in fileids])
开发者ID:approximatelylinear,项目名称:nltk,代码行数:8,代码来源:aligned.py

示例7: parsed_sents2

 def parsed_sents2(self, fileids=None):
   return concat([JapaneseCorpusView(fileid, enc,
                                     False, False, False, True,
                                     self._syntax_parser,
                                     self._word_tokenizer,
                                     self._sent_tokenizer,
                                     self._case_parser)
                  for (fileid, enc) in self.abspaths(fileids, True)])
开发者ID:miyamofigo,项目名称:Japanese-corpus-and-utility,代码行数:8,代码来源:corpus.py

示例8: fixed_parsed_sents

def fixed_parsed_sents(self, fileids=None, top_label="root"):
    from nltk.corpus.reader.util import concat
    from nltk.corpus.reader.dependency import DependencyCorpusView
    from nltk.parse import DependencyGraph
    
    sents=concat([DependencyCorpusView(fileid, False, True, True, encoding=enc)
                  for fileid, enc in self.abspaths(fileids, include_encoding=True)])
    return [DependencyGraph(sent, top_relation_label=top_label, cell_separator="\t") for sent in sents]
开发者ID:francescomambrini,项目名称:research-projects,代码行数:8,代码来源:syntacticNetwork.py

示例9: tagged_words

 def tagged_words(self, fileids=None, **kwargs):
     """
     Call with specified tags as a list, e.g. tags=['subst', 'comp'].
     Returns tagged words in specified fileids.
     """
     tags = kwargs.pop('tags', [])
     return concat([self._view(self.add_root(fileid),
                               mode=NKJPCorpusReader.WORDS_MODE, tags=tags, **kwargs).handle_query()
                    for fileid in fileids])
开发者ID:esabelhaus,项目名称:secret-octo-dubstep,代码行数:9,代码来源:nkjp.py

示例10: _views

 def _views(self, fileids=None, sent=False, tag=False, strip_space=True, stem=False):
     """A helper function that instantiates BNCWordViews or the list of words/sentences."""
     f = BNCWordView if self._lazy else self._words
     return concat(
         [
             f(fileid, sent, tag, strip_space, stem)
             for fileid in self.abspaths(fileids)
         ]
     )
开发者ID:prz3m,项目名称:kind2anki,代码行数:9,代码来源:bnc.py

示例11: raw

 def raw(self, fileids=None):
     """
     Return the corpora in their raw form.
     """
     if fileids is None:
         fileids = self._fileids
     elif isinstance(fileids, string_types):
         fileids = [fileids]
     return concat([self.open(f).read() for f in fileids])
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:9,代码来源:twitter.py

示例12: sents

 def sents(self, fileids=None, **kwargs):
     return concat(
         [
             self._view(
                 fileid, mode=IPIPANCorpusView.SENTS_MODE, tags=False, **kwargs
             )
             for fileid in self._list_morph_files(fileids)
         ]
     )
开发者ID:prz3m,项目名称:kind2anki,代码行数:9,代码来源:ipipan.py

示例13: aligned_sents

 def aligned_sents(self, fileids=None):
     """
     :return: the given file(s) as a list of AlignedSent objects.
     :rtype: list of C{AlignedSent}
     """
     return concat([AlignedSentCorpusView(fileid, enc, True, True,
                                          self._word_tokenizer,
                                          self._sent_tokenizer,
                                          self._alignedsent_block_reader)
                    for (fileid, enc) in self.abspaths(fileids, True)])
开发者ID:approximatelylinear,项目名称:nltk,代码行数:10,代码来源:aligned.py

示例14: words

 def words(self, fileids=None):
     """
     @return: the given file(s) as a list of words
         and punctuation symbols.
     @rtype: C{list} of C{str}
     """
     return concat([self._alignedsent_corpus_view(fileid, enc, False, False,
                                          self._word_tokenizer,
                                          self._sent_tokenizer,
                                          self._alignedsent_block_reader)
                    for (fileid, enc) in self.abspaths(fileids, True)])
开发者ID:yochananmkp,项目名称:clir,代码行数:11,代码来源:aligned_corpus_reader.py

示例15: parsed_docs

 def parsed_docs(self, fileids=None):
     """
     @return: A list of parsed corpus documents.
     @rtype: C{list} of C{StreamBackedCorpusView}
     @param fileids: A list of corpus files.
     @type fileids: C{list} of C{str} or regular expression
     """        
     return concat([StreamBackedCorpusView(fileid,
                                           self._read_parsed_block,
                                           encoding=enc)
                    for (fileid, enc) in self.abspaths(fileids, True)])
开发者ID:knowlp,项目名称:nltk_contrib,代码行数:11,代码来源:muc.py


注:本文中的nltk.corpus.reader.util.concat函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。