• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.concat函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: words

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


示例17: sents

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


示例18: docs

    def docs(self, fileids=None):
        """
        Returns the full Tweet objects, as specified by `Twitter
        documentation on Tweets
        <https://dev.twitter.com/docs/platform-objects/tweets>`_

        :return: the given file(s) as a list of dictionaries deserialised
        from JSON.
        :rtype: list(dict)
        """
        return concat([self.CorpusView(path, self._read_tweets, encoding=enc)
                       for (path, enc, fileid) in self.abspaths(fileids, True, True)])
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:12,代码来源:twitter.py


示例19: raw

 def raw(self, fileids=None):
     """
     @return: A list of corpus file contents.
     @rtype: C{list} of C{str}
     @param fileids: A list of corpus files.
     @type fileids: C{list} of C{str} or regular expression
     """
     if fileids is None:
         fileids = self._fileids
     elif isinstance(fileids, basestring): 
         fileids = [fileids]
     return concat([self.open(f).read() for f in fileids])
开发者ID:knowlp,项目名称:nltk_contrib,代码行数:12,代码来源:muc.py


示例20: sents

 def sents(self, fileids=None):
     """
     :return: the given file(s) as a list of
         sentences or utterances, each encoded as a list of word
         strings.
     :rtype: list of (list of str)
     """
     return concat([AlignedSentCorpusView(fileid, enc, False, True,
                                          self._word_tokenizer,
                                          self._sent_tokenizer,
                                          self._alignedsent_block_reader)
                    for (fileid, enc) in self.abspaths(fileids, True)])
开发者ID:approximatelylinear,项目名称:nltk,代码行数:12,代码来源:aligned.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python xmldocs.ElementTree类代码示例发布时间:2022-05-27
下一篇:
Python api.CorpusReader类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap