CoffeBank commited on
Commit
a640082
·
1 Parent(s): 71f6f86
Files changed (1) hide show
  1. demo/binary_classifier_demo.py +17 -0
demo/binary_classifier_demo.py CHANGED
@@ -175,6 +175,13 @@ def run_binary_classifier(text, show_analysis=False):
175
  elif pos == 'PRON': pos_name = 'Местоимения'
176
  elif pos == 'CCONJ': pos_name = 'Сочинительные союзы'
177
  elif pos == 'SCONJ': pos_name = 'Подчинительные союзы'
 
 
 
 
 
 
 
178
  analysis_md += f" - {pos_name}: {count}\n"
179
  elif isinstance(value, float):
180
  analysis_md += f"- {label}: {value:.3f}\n"
@@ -198,7 +205,17 @@ def run_binary_classifier(text, show_analysis=False):
198
  elif dep == 'ROOT': dep_name = 'Корневые узлы'
199
  elif dep == 'punct': dep_name = 'Пунктуация'
200
  elif dep == 'case': dep_name = 'Падежные маркеры'
 
 
 
 
 
201
  analysis_md += f" - {dep_name}: {count}\n"
 
 
 
 
 
202
  elif isinstance(value, float):
203
  analysis_md += f"- {label}: {value:.3f}\n"
204
  else:
 
175
  elif pos == 'PRON': pos_name = 'Местоимения'
176
  elif pos == 'CCONJ': pos_name = 'Сочинительные союзы'
177
  elif pos == 'SCONJ': pos_name = 'Подчинительные союзы'
178
+ elif pos == 'NUM': pos_name = 'Числительные'
179
+ elif pos == 'PART': pos_name = 'Частицы'
180
+ elif pos == 'PUNCT': pos_name = 'Знаки препинания'
181
+ elif pos == 'AUX': pos_name = 'Вспомогательные глаголы'
182
+ elif pos == 'SYM': pos_name = 'Символы'
183
+ elif pos == 'INTJ': pos_name = 'Междометия'
184
+ elif pos == 'X': pos_name = 'Другое (X)'
185
  analysis_md += f" - {pos_name}: {count}\n"
186
  elif isinstance(value, float):
187
  analysis_md += f"- {label}: {value:.3f}\n"
 
205
  elif dep == 'ROOT': dep_name = 'Корневые узлы'
206
  elif dep == 'punct': dep_name = 'Пунктуация'
207
  elif dep == 'case': dep_name = 'Падежные маркеры'
208
+ elif dep == 'dep': dep_name = 'Общие зависимости'
209
+ elif dep == 'appos': dep_name = 'Приложения'
210
+ elif dep == 'flat:foreign': dep_name = 'Иностранные выражения'
211
+ elif dep == 'conj': dep_name = 'Сочинительные конструкции'
212
+ elif dep == 'obl': dep_name = 'Косвенные дополнения'
213
  analysis_md += f" - {dep_name}: {count}\n"
214
+ elif key == 'noun_chunks':
215
+ if isinstance(value, bool):
216
+ analysis_md += f"- {label}: {0 if value is False else value}\n"
217
+ else:
218
+ analysis_md += f"- {label}: {value}\n"
219
  elif isinstance(value, float):
220
  analysis_md += f"- {label}: {value:.3f}\n"
221
  else: