コード例 #1
0
ファイル: by_analogy.py プロジェクト: albedium/pymorphy2
    def parse(self, word, word_lower, seen_parses):
        result = []
        for prefix, unprefixed_word in self.possible_splits(word_lower):
            method = (self, prefix)

            parses = self.morph.parse(unprefixed_word)
            for fixed_word, tag, normal_form, score, methods_stack in parses:

                if not tag.is_productive():
                    continue

                parse = (prefix + fixed_word, tag, prefix + normal_form,
                         score * self.score_multiplier,
                         methods_stack + (method, ))

                add_parse_if_not_seen(parse, result, seen_parses)

        return result
コード例 #2
0
ファイル: by_hyphen.py プロジェクト: DariyaShagieva/Search
    def parse(self, word, word_lower, seen_parses):

        result = []
        for unsuffixed_word, particle in self.possible_splits(word_lower):
            method = (self, particle)

            for fixed_word, tag, normal_form, score, methods_stack in self.morph.parse(
                    unsuffixed_word):
                parse = (fixed_word + particle, tag, normal_form + particle,
                         score * self.score_multiplier,
                         methods_stack + (method, ))
                add_parse_if_not_seen(parse, result, seen_parses)

            # If a word ends with with one of the particles,
            # it can't ends with an another.
            break

        return result
コード例 #3
0
    def parse(self, word, word_lower, seen_parses):
        result = []
        for prefix, unprefixed_word in word_splits(word_lower):

            method = (self, prefix)

            parses = self.dict_analyzer.parse(unprefixed_word, unprefixed_word,
                                              seen_parses)
            for fixed_word, tag, normal_form, estimate, methods_stack in parses:

                if not tag.is_productive():
                    continue

                parse = (prefix + fixed_word, tag, prefix + normal_form,
                         estimate * self.ESTIMATE_DECAY,
                         methods_stack + (method, ))
                add_parse_if_not_seen(parse, result, seen_parses)

        return result
コード例 #4
0
ファイル: by_hyphen.py プロジェクト: alafin/pymorphy2
    def parse(self, word, word_lower, seen_parses):

        result = []
        for unsuffixed_word, particle in self.possible_splits(word_lower):
            method = (self, particle)

            for fixed_word, tag, normal_form, score, methods_stack in self.morph.parse(unsuffixed_word):
                parse = (
                    fixed_word+particle,
                    tag,
                    normal_form+particle,
                    score*self.ESTIMATE_DECAY,
                    methods_stack+(method,)
                )
                add_parse_if_not_seen(parse, result, seen_parses)

            # If a word ends with with one of the particles,
            # it can't ends with an another.
            break

        return result
コード例 #5
0
ファイル: by_analogy.py プロジェクト: Koryakov/pymorphy2
    def parse(self, word, word_lower, seen_parses):
        result = []
        for prefix, unprefixed_word in self.possible_splits(word_lower):
            method = (self, prefix)

            parses = self.morph.parse(unprefixed_word)
            for fixed_word, tag, normal_form, score, methods_stack in parses:

                if not tag.is_productive():
                    continue

                parse = (
                    prefix + fixed_word,
                    tag,
                    prefix + normal_form,
                    score * self.score_multiplier,
                    methods_stack + (method,)
                )

                add_parse_if_not_seen(parse, result, seen_parses)

        return result
コード例 #6
0
ファイル: by_analogy.py プロジェクト: alafin/pymorphy2
    def parse(self, word, word_lower, seen_parses):
        result = []
        for prefix, unprefixed_word in word_splits(word_lower):

            method = (self, prefix)

            parses = self.dict_analyzer.parse(unprefixed_word, unprefixed_word, seen_parses)
            for fixed_word, tag, normal_form, score, methods_stack in parses:

                if not tag.is_productive():
                    continue

                parse = (
                    prefix + fixed_word,
                    tag,
                    prefix + normal_form,
                    score * self.ESTIMATE_DECAY,
                    methods_stack + (method,)
                )
                add_parse_if_not_seen(parse, result, seen_parses)

        return result