Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
#7 Use pymorphy3 without DAWG dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
yemchenko-dan committed May 1, 2023
1 parent 6b60c21 commit 485ef1c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions numberize.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
requires = [
"setuptools>=42",
"wheel",
"pymorhy2[fast]",
"pymorphy2-dicts-uk",
"pymorhy3",
"pymorphy3-dicts-uk",
"nltk"
]
build-backend = "setuptools.build_meta"
6 changes: 3 additions & 3 deletions numberize/linguists.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from abc import ABC, abstractmethod
from typing import Optional

import pymorphy2
import pymorphy3

import numberize.dicts as dicts

Expand Down Expand Up @@ -37,7 +37,7 @@ def get_number(token: str) -> Optional[int]:


class RuLinguist(Linguist):
def __init__(self, morph: 'pymorphy2.MorphAnalyzer'):
def __init__(self, morph: 'pymorphy3.MorphAnalyzer'):
"""
:param morph: MorphAnalyzer to normalize words
"""
Expand All @@ -54,7 +54,7 @@ def get_number(self, token: str) -> Optional[int]:


class UkLinguist(Linguist):
def __init__(self, morph: 'pymorphy2.MorphAnalyzer'):
def __init__(self, morph: 'pymorphy3.MorphAnalyzer'):
"""
:param morph: MorphAnalyzer to normalize words
"""
Expand Down
2 changes: 1 addition & 1 deletion numberize/replacers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod

from pymorphy2 import MorphAnalyzer
from pymorphy3 import MorphAnalyzer

from numberize.calculators import (
Calculator, AmericanEnCalculator, CyrillicCalculator
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="numberize",
version="1.0.3",
version="1.1.2",
author="YemchenkoDS",
author_email="[email protected]",
description="Replace numerals with numbers",
Expand All @@ -26,7 +26,7 @@
'numberize.dicts'
],
python_requires=">=3.6",
install_requires=['pymorphy2[fast]', 'pymorphy2-dicts-uk', 'nltk'],
install_requires=['pymorphy3', 'pymorphy3-dicts-uk', 'nltk'],
setup_requires=['pytest-runner'],
tests_require=['pytest==6.2.4'],
test_suite='tests'
Expand Down
6 changes: 3 additions & 3 deletions tests/test_linguists.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

import pymorphy2
import pymorphy3

import numberize.linguists as linguists

Expand All @@ -22,8 +22,8 @@
("мільйона", 1000000)
]

ru_morph = pymorphy2.MorphAnalyzer(result_type=None)
uk_morph = pymorphy2.MorphAnalyzer(lang="uk", result_type=None)
ru_morph = pymorphy3.MorphAnalyzer(result_type=None)
uk_morph = pymorphy3.MorphAnalyzer(lang="uk", result_type=None)


@pytest.mark.parametrize("token,expected_output", EN_DATA)
Expand Down

0 comments on commit 485ef1c

Please sign in to comment.