Commits

Mikhail Korobov committed fa0cdbe

opencorpora ext-int conversion is fixed

  • Participants
  • Parent commits 9592f89

Comments (0)

Files changed (2)

russian_tagsets/opencorpora.py

 EXTERNAL_TO_INTERNAL = invert_mapping(INTERNAL_TO_EXTERNAL)
 
 def external_to_internal(external_tag):
-    return ",".join(EXTERNAL_TO_INTERNAL[tok].strip() for tok in external_tag.split(','))
+    return ",".join(EXTERNAL_TO_INTERNAL.get(tok, tok).strip() for tok in external_tag.split(','))
 
 def internal_to_external(internal_tag):
-    return ",".join(INTERNAL_TO_EXTERNAL[tok].strip() for tok in internal_tag.split(','))
+    return ",".join(INTERNAL_TO_EXTERNAL.get(tok, tok).strip() for tok in internal_tag.split(','))
 
 
 def to_aot(open_tag):

russian_tagsets/tests/test_opencorpora.py

     TEST_DATA = [
         ['власть', 'NOUN,inan,femn,sing,nomn', 'СУЩ,неод,жр,ед,им'],
         ['поменяться', 'INFN,perf,intr', 'ИНФ,сов,неперех'],
+        ['.', 'PNCT', 'PNCT'],
     ]
 
     @pytest.mark.parametrize(("word", "internal", "external"), TEST_DATA)