Commits

Mikhail Korobov committed e006f76

estimate -> score

Comments (0)

Files changed (4)

pymorphy2/units/by_analogy.py

             method = (self, prefix)
 
             parses = self.morph.parse(unprefixed_word)
-            for fixed_word, tag, normal_form, estimate, methods_stack in parses:
+            for fixed_word, tag, normal_form, score, methods_stack in parses:
 
                 if not tag.is_productive():
                     continue
                     prefix + fixed_word,
                     tag,
                     prefix + normal_form,
-                    estimate * self.ESTIMATE_DECAY,
+                    score * self.ESTIMATE_DECAY,
                     methods_stack + (method,)
                 )
 
             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:
+            for fixed_word, tag, normal_form, score, methods_stack in parses:
 
                 if not tag.is_productive():
                     continue
                     prefix+fixed_word,
                     tag,
                     prefix+normal_form,
-                    estimate*self.ESTIMATE_DECAY,
+                    score*self.ESTIMATE_DECAY,
                     methods_stack+(method,)
                 )
                 add_parse_if_not_seen(parse, result, seen_parses)

pymorphy2/units/by_hyphen.py

         for unsuffixed_word, particle in self.possible_splits(word_lower):
             method = (self, particle)
 
-            for fixed_word, tag, normal_form, estimate, methods_stack in self.morph.parse(unsuffixed_word):
+            for fixed_word, tag, normal_form, score, methods_stack in self.morph.parse(unsuffixed_word):
                 parse = (
                     fixed_word+particle,
                     tag,
                     normal_form+particle,
-                    estimate*self.ESTIMATE_DECAY,
+                    score*self.ESTIMATE_DECAY,
                     methods_stack+(method,)
                 )
                 add_parse_if_not_seen(parse, result, seen_parses)
         """
         result = []
 
-        for fixed_word, tag, normal_form, estimate, right_methods in right_parses:
+        for fixed_word, tag, normal_form, score, right_methods in right_parses:
 
             if tag._is_unknown():
                 continue
                 '-'.join((left, fixed_word)),
                 tag,
                 '-'.join((left, normal_form)),
-                estimate * self.ESTIMATE_DECAY,
+                score * self.ESTIMATE_DECAY,
                 new_methods_stack
             )
             result.append(parse)
             word = '-'.join((left[0], right[0]))
             tag = left[1]
             normal_form = '-'.join((left[2], right[2]))
-            estimate = (left[3] + right[3]) / 2
+            score = (left[3] + right[3]) / 2
             method_stack = ((self, left[4], right[4]), )
 
-            yield (word, tag, normal_form, estimate, method_stack)
+            yield (word, tag, normal_form, score, method_stack)
 
     def _align_lexeme_forms(self, left_lexeme, right_lexeme):
         # FIXME: quadratic algorithm
 
     @classmethod
     def _without_right_part(cls, form):
-        word, tag, normal_form, estimate, methods_stack = form
+        word, tag, normal_form, score, methods_stack = form
         return (word[:word.index('-')], tag, normal_form[:normal_form.index('-')],
-                estimate, methods_stack)
+                score, methods_stack)
 
     @classmethod
     def _without_left_part(cls, form):
-        word, tag, normal_form, estimate, methods_stack = form
+        word, tag, normal_form, score, methods_stack = form
         return (word[word.index('-')+1:], tag, normal_form[normal_form.index('-')+1:],
-                estimate, methods_stack)
+                score, methods_stack)
 
     @classmethod
     def _fixed_left_method_was_used(cls, left_methods):

pymorphy2/units/by_shape.py

 class _ShapeAnalyzer(BaseAnalyzerUnit):
 
     terminal = True
-    ESTIMATE = 0.9
+    SCORE = 0.9
     EXTRA_GRAMMEMES = []
 
     def __init__(self, morph):
             return []
 
         methods = ((self, word),)
-        return [(word_lower, self.get_tag(word, shape), word_lower, self.ESTIMATE, methods)]
+        return [(word_lower, self.get_tag(word, shape), word_lower, self.SCORE, methods)]
 
     def tag(self, word, word_lower, seen_tags):
         shape = self.check_shape(word, word_lower)

pymorphy2/units/utils.py

 
 def with_suffix(form, suffix):
     """ Return a new form with ``suffix`` attached """
-    word, tag, normal_form, estimate, methods_stack = form
-    return (word+suffix, tag, normal_form+suffix, estimate, methods_stack)
+    word, tag, normal_form, score, methods_stack = form
+    return (word+suffix, tag, normal_form+suffix, score, methods_stack)
 
 
 def without_fixed_suffix(form, suffix_length):
     """ Return a new form with ``suffix_length`` chars removed from right """
-    word, tag, normal_form, estimate, methods_stack = form
+    word, tag, normal_form, score, methods_stack = form
     return (word[:-suffix_length], tag, normal_form[:-suffix_length],
-            estimate, methods_stack)
+            score, methods_stack)
 
 
 def without_fixed_prefix(form, prefix_length):
     """ Return a new form with ``prefix_length`` chars removed from left """
-    word, tag, normal_form, estimate, methods_stack = form
+    word, tag, normal_form, score, methods_stack = form
     return (word[prefix_length:], tag, normal_form[prefix_length:],
-            estimate, methods_stack)
+            score, methods_stack)
 
 
 def with_prefix(form, prefix):
     """ Return a new form with ``prefix`` added """
-    word, tag, normal_form, estimate, methods_stack = form
-    return (prefix+word, tag, prefix+normal_form, estimate, methods_stack)
+    word, tag, normal_form, score, methods_stack = form
+    return (prefix+word, tag, prefix+normal_form, score, methods_stack)
 
 
 def replace_methods_stack(form, new_methods_stack):