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


Python internals.overridden函数代码示例

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


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


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