/
HiQuN
/
THE_PROJECT
Обзор
Документация
Войти
/
HiQuN
/
THE_PROJECT
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/classifier.py
27 строк
664 B
HiQuN
Quiz Classifier: final version
28 дек 2025, 21:30
28 дек 2025, 21:30
592ef7b
Код
Авторство
О чём код?
import textstat import re def classify_question(text: str) -> str: if not isinstance(text, str) or not text.strip(): return "easy" text = text.strip() # Hard if contains truly complex words (why/how/analyze/etc.) if re.search( r"\b(why|how|analyze|compare|evaluate|explain)\b", text, re.IGNORECASE ): return "hard" length = len(text) try: readability = textstat.flesch_reading_ease(text) except Exception: readability = 60.0 if length < 20 and readability > 75: return "easy" elif length > 100 or readability < 40: return "hard" else: return "medium"