Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into summary_fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
piterand committed Jun 26, 2023
2 parents f29a01c + 75e9f49 commit 54d86f9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ammico/test/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_text_sentiment_transformers():
mydict["text_english"] = "I am happy that the CI is working again."
test_obj.text_sentiment_transformers()
assert mydict["sentiment"] == "POSITIVE"
assert mydict["sentiment_score"] == pytest.approx(0.99, 0.01)
assert mydict["sentiment_score"] == pytest.approx(0.99, 0.02)


@pytest.mark.win_skip
Expand Down
19 changes: 19 additions & 0 deletions ammico/test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,22 @@ def test_dump_df(get_path):
df = ut.dump_df(outdict)
out_df = pd.read_csv(get_path + "example_dump_df.csv", index_col=[0])
pd.testing.assert_frame_equal(df, out_df)


def test_is_interactive():
assert ut.is_interactive


def test_get_color_table():
colors = ut.get_color_table()
assert colors["Pink"] == {
"ColorName": [
"Pink",
"LightPink",
"HotPink",
"DeepPink",
"PaleVioletRed",
"MediumVioletRed",
],
"HEX": ["#FFC0CB", "#FFB6C1", "#FF69B4", "#FF1493", "#DB7093", "#C71585"],
}
2 changes: 1 addition & 1 deletion ammico/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def text_sentiment_transformers(self):
)
result = pipe(self.subdict["text_english"])
self.subdict["sentiment"] = result[0]["label"]
self.subdict["sentiment_score"] = result[0]["score"]
self.subdict["sentiment_score"] = round(result[0]["score"], 2)

def text_ner(self):
"""Perform named entity recognition on the text using the Transformers pipeline."""
Expand Down
7 changes: 6 additions & 1 deletion ammico/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
import os
from pandas import DataFrame, read_csv
import pooch
import importlib_resources


pkg = importlib_resources.files("ammico")


class DownloadResource:
Expand Down Expand Up @@ -110,8 +114,9 @@ def is_interactive():


def get_color_table():
path_tables = pkg / "data" / "Color_tables.csv"
df_colors = read_csv(
os.path.join(os.path.dirname(__file__), "data", "Color_tables.csv"),
path_tables,
delimiter=";",
dtype=str,
encoding="UTF-8",
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ammico"
version = "0.0.1"
version = "0.1.0"
description = "AI Media and Misinformation Content Analysis Tool"
readme = "README.md"
maintainers = [
Expand All @@ -31,6 +31,7 @@ dependencies = [
"google-cloud-vision",
"grpcio",
"importlib_metadata",
"importlib_resources",
"ipython",
"jupyter_dash",
"matplotlib",
Expand Down Expand Up @@ -71,7 +72,6 @@ documentation = "https://ssciwr.github.io/AMMICO/build/html/index.html"
packages = ["ammico"]

[tool.setuptools.package-data]
# Include any png files found in the "data" subdirectory of "ammico"
"ammico.data" = ["*.png"]
mypkg = [ "*.csv"]
# Include any png and csv files found in the "data" subdirectory of "ammico"
"ammico.data" = ["*.png", "*.csv"]

0 comments on commit 54d86f9

Please sign in to comment.