Skip to content

Commit

Permalink
Merge pull request #88 from dayyass/develop
Browse files Browse the repository at this point in the history
release v0.1.6
  • Loading branch information
dayyass committed Nov 6, 2021
2 parents 3353a53 + 35a7ead commit 6db3dd8
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[run]
branch = True
source = text_clf
source = src/text_clf

[report]
exclude_lines =
Expand All @@ -12,7 +12,7 @@ exclude_lines =
...

omit =
text_clf/__main__.py
src/text_clf/__main__.py

show_missing = True
ignore_errors = False
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ pypi_build:
pypi_twine:
python -m twine upload --repository testpypi dist/*
pypi_clean:
rm -rf dist text_classification_baseline.egg-info
rm -rf dist src/text_classification_baseline.egg-info
clean:
rm -rf models/*
7 changes: 6 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = text-classification-baseline
version = 0.1.5
version = 0.1.6
author = Dani El-Ayyass
author_email = dayyass@yandex.ru
description = TF-IDF + LogReg baseline for text classification
Expand All @@ -15,6 +15,8 @@ classifiers =
Operating System :: OS Independent

[options]
package_dir =
= src
packages = find:
python_requires = >=3.6
install_requires =
Expand All @@ -26,6 +28,9 @@ install_requires =
pymorphy2 >= 0.9.1
PyYAML >= 5.4.1

[options.packages.find]
where = src

[options.entry_points]
console_scripts =
text-clf-train = text_clf.__main__:main
9 changes: 9 additions & 0 deletions src/text_clf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from . import pr_roc_curve, token_frequency
from .__main__ import train

__version__ = "0.1.6"
__all__ = [
"train",
"pr_roc_curve",
"token_frequency",
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_lemmatizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from parameterized import parameterized

from text_clf.lemmatizer import LemmatizerPymorphy2, Preprocessor
from src.text_clf.lemmatizer import LemmatizerPymorphy2, Preprocessor


class TestLemmatizer(unittest.TestCase):
Expand Down
10 changes: 9 additions & 1 deletion tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from parameterized import parameterized

from data.load_20newsgroups import load_20newsgroups
from text_clf import train
from src.text_clf import train


class TestUsage(unittest.TestCase):
Expand All @@ -17,6 +17,8 @@ def setUpClass(cls) -> None:

load_20newsgroups()

cls._remove_models_folder()

@parameterized.expand(
[
("tests/config/config.yaml",),
Expand Down Expand Up @@ -48,6 +50,12 @@ def test_train_error(self) -> None:
def tearDownClass(cls) -> None:
"""tearDown tests with models remove."""

cls._remove_models_folder()

@staticmethod
def _remove_models_folder():
"""Remove models folder."""

path_to_models_folder = "tests/models"
if os.path.exists(path_to_models_folder):
shutil.rmtree(path_to_models_folder)
Expand Down
14 changes: 9 additions & 5 deletions tests/test_pr_roc_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from sklearn.metrics import auc

from data.load_20newsgroups import load_20newsgroups
from text_clf import train
from text_clf.pr_roc_curve import (
from src.text_clf import train
from src.text_clf.pr_roc_curve import (
get_precision_recall_curve,
get_roc_curve,
plot_precision_recall_curve,
Expand All @@ -26,9 +26,7 @@ def setUpClass(cls) -> None:

load_20newsgroups()

path_to_models_folder = "tests/models"
if os.path.exists(path_to_models_folder):
shutil.rmtree(path_to_models_folder)
cls._remove_models_folder()

train(path_to_config="tests/config/config.yaml")
train(path_to_config="tests/config/config_russian.yaml")
Expand Down Expand Up @@ -86,6 +84,12 @@ def test_get_plot_curve(self, path_to_model_folder_pattern) -> None:
def tearDownClass(cls) -> None:
"""tearDown tests with models remove."""

cls._remove_models_folder()

@staticmethod
def _remove_models_folder():
"""Remove models folder."""

path_to_models_folder = "tests/models"
if os.path.exists(path_to_models_folder):
shutil.rmtree(path_to_models_folder)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_token_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from parameterized import parameterized

from data.load_20newsgroups import load_20newsgroups
from text_clf.token_frequency import get_token_frequency
from src.text_clf.token_frequency import get_token_frequency


class TestTokenFrequency(unittest.TestCase):
Expand Down
4 changes: 0 additions & 4 deletions text_clf/__init__.py

This file was deleted.

0 comments on commit 6db3dd8

Please sign in to comment.