Skip to content

Commit

Permalink
Merge pull request #36 from dimitrismistriotis/update-library-to-1dot…
Browse files Browse the repository at this point in the history
…4dot1

Updated package and retrained models.
  • Loading branch information
dimitrismistriotis authored Feb 21, 2024
2 parents 97ab7cf + 911a85e commit 100b3e9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 1.4.1

* scikit-learn to 1.4.1 (1.4.1.post1)
* Migrated pkg_resources to importlib.resources

## Version 1.3.2

* Teaching Python Note on README
Expand Down
Binary file modified profanity_check/data/model.joblib
Binary file not shown.
Binary file modified profanity_check/data/vectorizer.joblib
Binary file not shown.
29 changes: 22 additions & 7 deletions profanity_check/profanity_check.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
"""Profanity check exposed methods"""
import pkg_resources
import sys

#
# Checks below
#
if sys.version_info.minor > 8:
from importlib import resources
else:
import pkg_resources

import numpy as np
import joblib

vectorizer = joblib.load(
pkg_resources.resource_filename("profanity_check", "data/vectorizer.joblib")
)
model = joblib.load(
pkg_resources.resource_filename("profanity_check", "data/model.joblib")
)
if sys.version_info.minor > 8:
vectorizer = joblib.load(
resources.files("profanity_check") / "data" / "vectorizer.joblib"
)
model = joblib.load(resources.files("profanity_check") / "data" / "model.joblib")
else:
vectorizer = joblib.load(
pkg_resources.resource_filename("profanity_check", "data/vectorizer.joblib")
)
model = joblib.load(
pkg_resources.resource_filename("profanity_check", "data/model.joblib")
)


def _get_profane_prob(prob):
Expand Down
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
joblib==1.3.2
numpy==1.24.4; python_version <= '3.8'
numpy==1.26.2; python_version >= '3.9'
numpy==1.26.4; python_version >= '3.9'
# Used for the training script:
pandas==2.0.3; python_version < '3.8'
pandas==2.1.3; python_version >= '3.9'
scikit-learn==1.3.2
scipy==1.11.3; python_version >= '3.10'
scikit-learn==1.3.2; python_version <= '3.8'
scikit-learn==1.4.1.post1; python_version >= '3.9'
scipy==1.12.0; python_version >= '3.10'
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name="alt-profanity-check",
version="1.3.2",
version="1.4.1.post1",
author="Victor Zhou (original author), Menelaos Kotoglou, Dimitrios Mistriotis",
author_email="[email protected]",
description=(
Expand All @@ -17,7 +17,7 @@
long_description_content_type="text/markdown",
url="https://github.com/dimitrismistriotis/alt-profanity-check",
packages=setuptools.find_packages(),
install_requires=["scikit-learn==1.3.2", "joblib>=1.3.2"],
install_requires=["scikit-learn==1.4.1.post1", "joblib>=1.3.2"],
python_requires=">=3.8",
package_data={"profanity_check": ["data/model.joblib", "data/vectorizer.joblib"]},
classifiers=[
Expand Down

0 comments on commit 100b3e9

Please sign in to comment.