Commits

Mikhail Korobov committed 343c869

обновления для словаря 0.92

Comments (0)

Files changed (2)

pymorphy2/opencorpora_dict.py

     for ev, elem in etree.iterparse(filename):
 
         if elem.tag == 'grammeme':
-            grammeme = elem.text
+            name = elem.find('name').text
             parent = elem.get('parent')
-            alias = elem.get('alias')
-            grammemes.append((grammeme, parent, alias))
+            alias = elem.find('alias').text
+            description = elem.find('description').text
+
+            grameme = (name, parent, alias, description)
+            grammemes.append(grameme)
             _clear(elem)
 
         if elem.tag == 'dictionary':

pymorphy2/tagset.py

         """
 
         # figure out parents & children
-        gr = dict(((name, parent) for (name, parent, alias) in dict_grammemes))
+        gr = dict(((name, parent) for (name, parent, alias, description) in dict_grammemes))
         children = collections.defaultdict(set)
 
-        for index, (name, parent, alias) in enumerate(dict_grammemes):
+        for index, (name, parent, alias, description) in enumerate(dict_grammemes):
             if parent:
                 children[parent].add(name)
             if gr.get(parent, None): # parent's parent
                 g_set.update(children[g])
 
         # fill GRAMMEME_INDICES and GRAMMEME_INCOMPATIBLE
-        for index, (name, parent, alias) in enumerate(dict_grammemes):
+        for index, (name, parent, alias, description) in enumerate(dict_grammemes):
             cls.GRAMMEME_INDICES[name] = index
             incompatible = cls.EXTRA_INCOMPATIBLE.get(name, set())
             incompatible = (incompatible | children[parent]) - set([name])
 
     @classmethod
     def _init_alias_map(cls, dict_grammemes):
-        for name, parent, alias in dict_grammemes:
+        for name, parent, alias, description in dict_grammemes:
             cls.GRAMMEME_ALIAS_MAP[name] = alias