Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ошибка подсчета статистик на коротких текстах #5

Closed
xeonvs opened this issue Apr 27, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@xeonvs
Copy link

xeonvs commented Apr 27, 2020

Простой пример:

ds = DiversityStats('саид, ты опять абдулле насолил?').get_stats()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ruts/diversity_stats.py", line 163, in get_stats
    'dttr': self.dttr,
  File "/usr/local/lib/python3.6/dist-packages/ruts/diversity_stats.py", line 119, in dttr
    return calc_dttr(self.words)
  File "/usr/local/lib/python3.6/dist-packages/ruts/diversity_stats.py", line 300, in calc_dttr
    return log10(n_words)**2 / (log10(n_words) - log10(n_lexemes))
ZeroDivisionError: float division by zero

Проверялось на 0.5.0

@LSinev
Copy link

LSinev commented Aug 30, 2020

Не могли бы вы зарелизить с этим исправлением поскорее, а то пользоваться хочется, а устанавливать из git возможности нет?

@LSinev
Copy link

LSinev commented Aug 30, 2020

Тем более, что в репозиторий месяц уже коммитов не было, а это прям баг — можно 0.5.1 выпустить ;)

@SergeyShk
Copy link
Owner

Тем более, что в репозиторий месяц уже коммитов не было, а это прям баг — можно 0.5.1 выпустить ;)

Пока залил на тестовый сервер, просьба проверить:

pip install -i https://test.pypi.org/simple/ ruts==0.5.1

@LSinev
Copy link

LSinev commented Sep 8, 2020

вроде бы, нормально работает

@SergeyShk
Copy link
Owner

Ок. Залил на основной сервер.

@puffofsmoke
Copy link

puffofsmoke commented Sep 29, 2020

ruts==0.5.1

  text = 'яблоко'
  rs = DiversityStats(text)
  rs.get_stats()```

Traceback (most recent call last):
File "[some_path]\lib\site-packages\IPython\core\interactiveshell.py", line 3417, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 4, in
rs.get_stats()
File "[some_path]\lib\site-packages\ruts\diversity_stats.py", line 162, in get_stats
'sttr': self.sttr,
File "[some_path]\lib\site-packages\ruts\diversity_stats.py", line 112, in sttr
return calc_sttr(self.words)
File "[some_path]\lib\site-packages\ruts\diversity_stats.py", line 266, in calc_sttr
return safe_divide(log10(log10(n_lexemes)), log10(log10(n_words)))
ValueError: math domain error

@SergeyShk
Copy link
Owner

Спасибо, исправлю.

SergeyShk added a commit that referenced this issue Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants