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

Python internals.overridden函数代码示例

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

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



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

示例1: parse

 def parse(self, sent, *args, **kwargs):
     '''
     :param sent: list(str)
     :param args:
     :param kwargs:
     :return:An iterator that generates parse for the sentence.
     '''
     if overridden(self.parse_sents):
         return next(self.parse_sents([sent], *args, **kwargs))
     elif overridden(self.parse_one):
         return (tree for tree in [self.parse_one(sent, *args, **kwargs)] if tree is not None)
     elif overridden(self.parse_all):
         return iter(self.parse_all(sent, *args, **kwargs))
     else:
         raise NotImplementedError()
开发者ID:IgorWang,项目名称:IgorNLP,代码行数:15,代码来源:api.py


示例2: tokenize

    def tokenize(self, s):
        """
        Return a tokenized copy of *s*.

        :rtype: list of str
        """
        if overridden(self.tokenize_sents):
            return self.tokenize_sents([s])[0]
开发者ID:prz3m,项目名称:kind2anki,代码行数:8,代码来源:api.py


示例3: parse

    def parse(self, sent, *args, **kwargs):
        """
        :return: An iterator that generates parse trees for the sentence.
        When possible this list is sorted from most likely to least likely.

        :param sent: The sentence to be parsed
        :type sent: list(str)
        :rtype: iter(Tree)
        """
        if overridden(self.parse_sents):
            return next(self.parse_sents([sent], *args, **kwargs))
        elif overridden(self.parse_one):
            return (tree for tree in [self.parse_one(sent, *args, **kwargs)] if tree is not None)
        elif overridden(self.parse_all):
            return iter(self.parse_all(sent, *args, **kwargs))
        else:
            raise NotImplementedError()
开发者ID:DrDub,项目名称:nltk,代码行数:17,代码来源:api.py


示例4: classify

 def classify(self, featureset):
     """
     @return: the most appropriate label for the given featureset.
     @rtype: label
     """
     if overridden(self.batch_classify):
         return self.batch_classify([featureset])[0]
     else:
         raise NotImplementedError()
开发者ID:B-Rich,项目名称:Fem-Coding-Challenge,代码行数:9,代码来源:api.py


示例5: classify

 def classify(self, featureset):
     """
     :return: the most appropriate set of labels for the given featureset.
     :rtype: set(label)
     """
     if overridden(self.classify_many):
         return self.classify_many([featureset])[0]
     else:
         raise NotImplementedError()
开发者ID:DrDub,项目名称:nltk,代码行数:9,代码来源:api.py


示例6: prob_classify

 def prob_classify(self, featureset):
     """
     :return: a probability distribution over labels for the given
         featureset.
     :rtype: ProbDistI
     """
     if overridden(self.prob_classify_many):
         return self.prob_classify_many([featureset])[0]
     else:
         raise NotImplementedError()
开发者ID:DrDub,项目名称:nltk,代码行数:10,代码来源:api.py


示例7: tag

    def tag(self, tokens):
        """
        Determine the most appropriate tag sequence for the given
        token sequence, and return a corresponding list of tagged
        tokens.  A tagged token is encoded as a tuple ``(token, tag)``.

        :rtype: list(tuple(str, str))
        """
        if overridden(self.tag_sents):
            return self.tag_sents([tokens])[0]
开发者ID:Weiming-Hu,项目名称:text-based-six-degree,代码行数:10,代码来源:api.py


示例8: tag

 def tag(self, tokens):
     '''
     标注单个句子
     :param tokens:list
     :return:list(tuple(str,str))
     '''
     if overridden(self.tag_sents):
         return self.tag_sents([tokens])[0]
     else:
         raise NotImplementedError()
开发者ID:IgorWang,项目名称:IgorNLP,代码行数:10,代码来源:ltp.py


示例9: prob_classify

 def prob_classify(self, featureset):
     """
     @return: a probability distribution over labels for the given
         featureset.
     @rtype: L{ProbDistI <nltk.probability.ProbDistI>}
     """
     if overridden(self.batch_prob_classify):
         return self.batch_prob_classify([featureset])[0]
     else:
         raise NotImplementedError()
开发者ID:B-Rich,项目名称:Fem-Coding-Challenge,代码行数:10,代码来源:api.py


示例10: tokenize

    def tokenize(self, s):
        """
        Return a tokenized copy of *s*.

        :rtype: list of str
        """
        if overridden(self.batch_tokenize):
            return self.batch_tokenize([s])[0]
        else:
            raise NotImplementedError()
开发者ID:0day1day,项目名称:golismero,代码行数:10,代码来源:api.py


示例11: tokenize

 def tokenize(self, s):
     """
     Divide the given string into a list of substrings.
     
     @return: C{list} of C{str}
     """
     if overridden(self.batch_tokenize):
         return self.batch_tokenize([s])[0]
     else:
         raise NotImplementedError()
开发者ID:DrDub,项目名称:icsisumm,代码行数:10,代码来源:api.py


示例12: parse

 def parse(self, sent, *args, **kwargs):
     '''
     解析单个句子
     :param tokens:list
     :return:list(tuple(str,str))
     '''
     if overridden(self.parse_sents):
         return self.parse_sents([sent])[0]
     else:
         raise NotImplementedError()
开发者ID:IgorWang,项目名称:IgorNLP,代码行数:10,代码来源:ltp.py


示例13: tag

 def tag(self, tokens):
     '''
     Determine the most appropriate tag sequence for the given token sequence,
     and return a corresponding list of tagged tokens
     :param tokens: list of tokens ['我','爱','北京','天安门']
     :return: list(tuple(str,str)
     '''
     if overridden(self.tag_sents):
         return self.tag_sents([tokens])[0]
     else:
         raise NotImplementedError()
开发者ID:IgorWang,项目名称:IgorNLP,代码行数:11,代码来源:api.py


示例14: iter_parse

    def iter_parse(self, sent):
        """
        :return: An iterator that generates parse trees that represent
        possible structures for the given sentence.  When possible,
        this list is sorted from most likely to least likely.

        :param sent: The sentence to be parsed
        :type sent: list(str)
        :rtype: iter(Tree)
        """
        if overridden(self.batch_iter_parse):
            return self.batch_iter_parse([sent])[0]
        elif overridden(self.nbest_parse) or overridden(self.batch_nbest_parse):
            return iter(self.nbest_parse(sent))
        elif overridden(self.parse) or overridden(self.batch_parse):
            tree = self.parse(sent)
            if tree: return iter([tree])
            else: return iter([])
        else:
            raise NotImplementedError()
开发者ID:BohanHsu,项目名称:developer,代码行数:20,代码来源:api.py


示例15: tag

    def tag(self, tokens):
        """
        Determine the most appropriate tag sequence for the given
        token sequence, and return a corresponding list of tagged
        tokens.  A tagged token is encoded as a tuple C{(token, tag)}.

        @rtype: C{list} of C{(token, tag)}
        """
        if overridden(self.batch_tag):
            return self.batch_tag([tokens])[0]
        else:
            raise NotImplementedError()
开发者ID:ciju,项目名称:yql_hash,代码行数:12,代码来源:api.py


示例16: nbest_parse

    def nbest_parse(self, sent, n=None):
        """
        :return: A list of parse trees that represent possible
        structures for the given sentence.  When possible, this list is
        sorted from most likely to least likely.  If ``n`` is
        specified, then the returned list will contain at most ``n``
        parse trees.

        :param sent: The sentence to be parsed
        :type sent: list(str)
        :param n: The maximum number of trees to return.
        :type n: int
        :rtype: list(Tree)
        """
        if overridden(self.batch_nbest_parse):
            return self.batch_nbest_parse([sent],n)[0]
        elif overridden(self.parse) or overridden(self.batch_parse):
            tree = self.parse(sent)
            if tree: return [tree]
            else: return []
        else:
            return list(itertools.islice(self.iter_parse(sent), n))
开发者ID:BohanHsu,项目名称:developer,代码行数:22,代码来源:api.py


示例17: nbest_parse

 def nbest_parse(self, sent, n=None):
     """
     @return: A list of parse trees that represent possible
     structures for the given sentence.  When possible, this list is
     sorted from most likely to least likely.  If C{n} is
     specified, then the returned list will contain at most C{n}
     parse trees.
     
     @param sent: The sentence to be parsed
     @type sent: L{list} of L{string}
     @param n: The maximum number of trees to return.
     @type n: C{int}
     @rtype: C{list} of L{Tree}
     """
     if overridden(self.batch_nbest_parse):
         return self.batch_nbest_parse([sent],n)[0]
     elif overridden(self.parse) or overridden(self.batch_parse):
         tree = self.parse(sent)
         if tree: return [tree]
         else: return []
     else:
         return list(itertools.islice(self.iter_parse(sent), n))
开发者ID:jparise,项目名称:haitwu-appengine,代码行数:22,代码来源:api.py


示例18: prob_parse

    def prob_parse(self, sent):
        """
        :return: A probability distribution over the possible parse
        trees for the given sentence.  If there are no possible parse
        trees for the given sentence, return a probability distribution
        that assigns a probability of 1.0 to None.

        :param sent: The sentence to be parsed
        :type sent: list(str)
        :rtype: ProbDistI(Tree)
        """
        if overridden(self.batch_prob_parse):
            return self.batch_prob_parse([sent])[0]
        else:
            raise NotImplementedError
开发者ID:BohanHsu,项目名称:developer,代码行数:15,代码来源:api.py


示例19: prob_parse

 def prob_parse(self, sent):
     """
     @return: A probability distribution over the possible parse
     trees for the given sentence.  If there are no possible parse
     trees for the given sentence, return a probability distribution
     that assigns a probability of 1.0 to C{None}.
     
     @param sent: The sentence to be parsed
     @type sent: L{list} of L{string}
     @rtype: L{ProbDistI} of L{Tree}
     """
     if overridden(self.batch_prob_parse):
         return self.batch_prob_parse([sent])[0]
     else:
         raise NotImplementedError
开发者ID:jparise,项目名称:haitwu-appengine,代码行数:15,代码来源:api.py


示例20: parse

    def parse(self, sent):
        """
        :return: A parse tree that represents the structure of the
        given sentence, or None if no parse tree is found.  If
        multiple parses are found, then return the best parse.

        :param sent: The sentence to be parsed
        :type sent: list(str)
        :rtype: Tree
        """
        if overridden(self.batch_parse):
            return self.batch_parse([sent])[0]
        else:
            trees = self.nbest_parse(sent, 1)
            if trees: return trees[0]
            else: return None
开发者ID:BohanHsu,项目名称:developer,代码行数:16,代码来源:api.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python internals.slice_bounds函数代码示例发布时间:2022-05-27
下一篇:
Python internals.java函数代码示例发布时间: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