From b5874cc0cbd62add13c36ac57ec7ccf18bd13dd5 Mon Sep 17 00:00:00 2001 From: PaulKalho Date: Mon, 1 Dec 2025 21:26:58 -0600 Subject: [PATCH 1/3] chore: add tests --- .github/workflows/{docker.yaml => ci.yaml} | 50 ++++- input.bib | 112 +++++++++++ test/files/test.txt => input.txt | 0 main.py | 47 +---- preprocessing/__init__.py | 0 preprocessing/loader.py | 14 +- requirements.txt | 1 + test/__init__.py | 0 test/conftest.py | 20 ++ test/files/expected_dtm_from_bib.pkl | Bin 0 -> 7546 bytes test/files/expected_dtm_from_txt.pkl | Bin 0 -> 1081 bytes test/files/expected_vocab_from_bib.pkl | Bin 0 -> 9047 bytes test/files/expected_vocab_from_txt.pkl | Bin 0 -> 400 bytes test/files/input.txt | 4 + test/test_full.py | 213 +++++++++++++++++++++ test/test_loaders.py | 33 ++++ test/test_normalize.py | 17 ++ test/test_preprocessor_unit.py | 26 +++ 18 files changed, 487 insertions(+), 50 deletions(-) rename .github/workflows/{docker.yaml => ci.yaml} (52%) create mode 100644 input.bib rename test/files/test.txt => input.txt (100%) create mode 100644 preprocessing/__init__.py create mode 100644 test/__init__.py create mode 100644 test/conftest.py create mode 100644 test/files/expected_dtm_from_bib.pkl create mode 100644 test/files/expected_dtm_from_txt.pkl create mode 100644 test/files/expected_vocab_from_bib.pkl create mode 100644 test/files/expected_vocab_from_txt.pkl create mode 100644 test/files/input.txt create mode 100644 test/test_full.py create mode 100644 test/test_loaders.py create mode 100644 test/test_normalize.py create mode 100644 test/test_preprocessor_unit.py diff --git a/.github/workflows/docker.yaml b/.github/workflows/ci.yaml similarity index 52% rename from .github/workflows/docker.yaml rename to .github/workflows/ci.yaml index df0d4cf..3939887 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,5 @@ -name: Docker +name: CI + on: push: branches: @@ -10,9 +11,55 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: + lint-python: + name: Lint Python + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + cache: "pip" + + - name: Run flake8 + uses: py-actions/flake8@v2 + + test: + runs-on: ubuntu-latest + needs: lint-python + services: + minio: + image: lazybit/minio + ports: + - 9000:9000 + env: + MINIO_ROOT_USER: minioadmin + MINIO_ROOT_PASSWORD: minioadmin + options: >- + --health-cmd "curl -f http://localhost:9000/minio/health/live || exit 1" + --health-interval 5s + --health-retries 5 + --health-timeout 5s + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + cache: "pip" + + - name: Install dependencies + run: | + pip install -r requirements.txt + + - name: Run Tests + run: pytest -vv + build: name: Build docker image runs-on: ubuntu-latest + needs: test permissions: contents: read packages: write @@ -42,3 +89,4 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + diff --git a/input.bib b/input.bib new file mode 100644 index 0000000..f525305 --- /dev/null +++ b/input.bib @@ -0,0 +1,112 @@ + +@article{ WOS:001016714700004, +Author = {White, Joel}, +Title = {Theoretical and Practical Paralogisms of Digital Immortality}, +Journal = {JOURNAL OF AESTHETICS AND PHENOMENOLOGY}, +Year = {2022}, +Volume = {9}, +Number = {2, SI}, +Pages = {155-172}, +Month = {JUL 3}, +Abstract = {Modern and contemporary transhumanism has seen a recent rise in academic + and popular relevance; specific naive metaphysical ideas, such as + immortality, have returned with this rise. This article refrains from + any ethical or political assessment of transhumanism. Still, it + critiques the exact metaphysical or idealistic nature of transhumanism + and its pursuit of digital immortality: the idea that, through + technological advancements, precisely in Artificial General + Intelligence, an immortal virtual ``self{''} will become possible. The + article follows the form of Immanuel Kant's ``Paralogisms{''} from the + Critique of Pure Reason, where Kant is concerned with the substantial, + immortal nature of the soul and its experiential impossibility. The + article will offer theoretical and practical paralogisms (false logical + inferences), arguing that the transhumanist claim that digital + immortality is possible fundamentally stems from two incorrect major + premises. The first concerns the substantial nature of information, + which informs the theoretical paralogisms; the second concerns infinite + transformation (pure plasticity), which informs the practical + paralogisms}, +Publisher = {ROUTLEDGE JOURNALS, TAYLOR \& FRANCIS LTD}, +Address = {2-4 PARK SQUARE, MILTON PARK, ABINGDON OX14 4RN, OXON, ENGLAND}, +Type = {Article}, +Language = {English}, +DOI = {10.1080/20539320.2022.2150463}, +ISSN = {2053-9320}, +EISSN = {2053-9339}, +Keywords = {Transhumanism; Critical Philosophy; Immanuel Kant; Entropy; Paralogisms; + Digital Immortality}, +Research-Areas = {Philosophy}, +Web-of-Science-Categories = {Philosophy}, +Author-Email = {jhmw01@gmail.com}, +ORCID-Numbers = {White, Joel/0000-0001-6460-0564}, +Number-of-Cited-References = {30}, +Times-Cited = {0}, +Usage-Count-Last-180-days = {3}, +Usage-Count-Since-2013 = {15}, +Journal-ISO = {J. Aesthet. Phenomenol.}, +Doc-Delivery-Number = {K5GF0}, +Web-of-Science-Index = {Emerging Sources Citation Index (ESCI)}, +Unique-ID = {WOS:001016714700004}, +DA = {2025-06-26}, +} + +@article{ WOS:001322577100012, +Author = {Kant, Vivek and Khanganba, Sanjram Premjit and Dixit, Sudhir}, +Title = {Sociopolitical Challenges to Digital Transformation of Rural + Communities: Learnings from a Case Study From Manipur, India}, +Journal = {IT PROFESSIONAL}, +Year = {2024}, +Volume = {26}, +Number = {4}, +Pages = {42-47}, +Month = {JUL-AUG}, +Abstract = {The United Nations Panel on Digital Cooperation, 2019, has emphasized + the inclusive growth of digital networks and digital public goods, + utilizing a multistakeholder systems approach. Similarly, the + information and communications technology (ICT) Innovation and + Intervention Program of the Government of India's Digital North East + Vision 2022 has also emphasized a need for inclusive growth of ICT in + the Northeast Region. In line with the above, this article presents + insights from a field study conducted in the rural parts of Manipur, + India, which incidentally can be found to be applicable to many rural + parts of the developing world. The article envisions a community-driven + sociodigital transformation of the Northeast Region of India. In this + quest, the article highlights sociopolitical challenges for digital + transformation and provides insights for inclusive ICT in such + regions-infrastructure as a utility for every citizen, smart governance + and services on demand, digital empowerment of citizens, social welfare, + capacity building, and community engagement.}, +Publisher = {IEEE COMPUTER SOC}, +Address = {10662 LOS VAQUEROS CIRCLE, PO BOX 3014, LOS ALAMITOS, CA 90720-1314 USA}, +Type = {Article}, +Language = {English}, +Affiliation = {Kant, V (Corresponding Author), Indian Inst Technol Kanpur, Kanpur 208016, India. + Kant, Vivek, Indian Inst Technol Kanpur, Kanpur 208016, India. + Khanganba, Sanjram Premjit, Indian Inst Technol Indore, Indore 452020, India. + Dixit, Sudhir, Basic Internet Fdn, Oslo, Norway.}, +DOI = {10.1109/MITP.2024.3433459}, +ISSN = {1520-9202}, +EISSN = {1941-045X}, +Keywords = {Technological innovation; Digital transformation; Government; Buildings; + Asia; Africa; Information and communication technology}, +Research-Areas = {Computer Science; Telecommunications}, +Web-of-Science-Categories = {Computer Science, Information Systems; Computer Science, Software + Engineering; Telecommunications}, +Author-Email = {vkant@iitk.ac.in + sanjrampk@iiti.ac.in + sudhir.dixit@ieee.org}, +Affiliations = {Indian Institute of Technology System (IIT System); Indian Institute of + Technology (IIT) - Kanpur; Indian Institute of Technology System (IIT + System); Indian Institute of Technology (IIT) - Indore}, +ResearcherID-Numbers = {/ITU-6308-2023}, +ORCID-Numbers = {/0000-0002-6215-7500}, +Number-of-Cited-References = {7}, +Times-Cited = {0}, +Usage-Count-Last-180-days = {11}, +Usage-Count-Since-2013 = {22}, +Journal-ISO = {IT Prof.}, +Doc-Delivery-Number = {H3O9D}, +Web-of-Science-Index = {Science Citation Index Expanded (SCI-EXPANDED)}, +Unique-ID = {WOS:001322577100012}, +DA = {2025-06-26}, +} diff --git a/test/files/test.txt b/input.txt similarity index 100% rename from test/files/test.txt rename to input.txt diff --git a/main.py b/main.py index d48e02e..6698911 100644 --- a/main.py +++ b/main.py @@ -3,10 +3,10 @@ from scystream.sdk.core import entrypoint from scystream.sdk.env.settings import ( - EnvSettings, - InputSettings, - OutputSettings, - FileSettings + EnvSettings, + InputSettings, + OutputSettings, + FileSettings ) from scystream.sdk.file_handling.s3_manager import S3Operations @@ -81,7 +81,7 @@ def _preprocess_and_store(texts, settings): dtm, vocab = pre.generate_document_term_matrix() with tempfile.NamedTemporaryFile(suffix="_dtm.pkl") as tmp_dtm, \ - tempfile.NamedTemporaryFile(suffix="_vocab.pkl") as tmp_vocab: + tempfile.NamedTemporaryFile(suffix="_vocab.pkl") as tmp_vocab: pickle.dump(dtm, tmp_dtm) tmp_dtm.flush() @@ -108,40 +108,3 @@ def preprocess_bib_file(settings): attribute=settings.bib_input.SELECTED_ATTRIBUTE, ) _preprocess_and_store(texts, settings) - - -""" -if __name__ == "__main__": - test = PreprocessBIB( - bib_input=BIBFileInput( - S3_HOST="http://localhost", - S3_PORT="9000", - S3_ACCESS_KEY="minioadmin", - S3_SECRET_KEY="minioadmin", - BUCKET_NAME="input-bucket", - FILE_PATH="input_file_path", - FILE_NAME="wos_export", - SELECTED_ATTRIBUTE="abstract" - ), - dtm_output=DTMFileOutput( - S3_HOST="http://localhost", - S3_PORT="9000", - S3_ACCESS_KEY="minioadmin", - S3_SECRET_KEY="minioadmin", - BUCKET_NAME="output-bucket", - FILE_PATH="output_file_path", - FILE_NAME="dtm_file_bib" - ), - vocab_output=VocabFileOutput( - S3_HOST="http://localhost", - S3_PORT="9000", - S3_ACCESS_KEY="minioadmin", - S3_SECRET_KEY="minioadmin", - BUCKET_NAME="output-bucket", - FILE_PATH="output_file_path", - FILE_NAME="vocab_file_bib" - ) - ) - - preprocess_bib_file(test) -""" diff --git a/preprocessing/__init__.py b/preprocessing/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/preprocessing/loader.py b/preprocessing/loader.py index d55aac3..9ff51c6 100644 --- a/preprocessing/loader.py +++ b/preprocessing/loader.py @@ -5,17 +5,17 @@ def normalize_text(text: str) -> str: if not text: return "" - # Remove curly braces - text = re.sub(r"[{}]", "", text) - # Remove LaTeX commands - text = re.sub(r"\\[a-zA-Z]+\s*(\{[^}]*\})?", "", text) + text = re.sub(r"\\[a-zA-Z]+\{([^}]*)\}", r"\1", text) + + text = re.sub(r"\\[a-zA-Z]+", "", text) - # Remove LaTeX escaped quotes/accents - text = re.sub(r"\\""[a-zA-Z]", lambda m: m.group(0)[-1], text) + text = re.sub(r"[{}]", "", text) + + text = re.sub(r'\\"([a-zA-Z])', r'\1', text) text = re.sub(r"\\'", "", text) - text = text.replace("'", "") + text = re.sub(r"\s+", " ", text) return text.strip() diff --git a/requirements.txt b/requirements.txt index 3493ec1..e7737db 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,3 +3,4 @@ spacy==3.8.7 nltk==3.9.1 numpy==2.3.3 bibtexparser==1.4.3 +pytest==9.0.1 diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/conftest.py b/test/conftest.py new file mode 100644 index 0000000..5ce5cca --- /dev/null +++ b/test/conftest.py @@ -0,0 +1,20 @@ +import pytest + +from preprocessing.core import Preprocessor + + +@pytest.fixture +def simple_texts(): + return ["This is a test sentence.", "Another test sentence."] + + +@pytest.fixture +def preprocessor(): + return Preprocessor( + language="en", + filter_stopwords=True, + unigram_normalizer="porter", + use_ngrams=True, + ngram_min=2, + ngram_max=3, + ) diff --git a/test/files/expected_dtm_from_bib.pkl b/test/files/expected_dtm_from_bib.pkl new file mode 100644 index 0000000000000000000000000000000000000000..812760358e55fa9a738dfd127f9a613172985d55 GIT binary patch literal 7546 zcmdU!zityj7{q;c3=K6E^i-}XsG!5b1uqaKjwK=`c66KzcQpKobX}I$;u&}o2=+}g z(oeg4-jjuk`!usN^L@K}y2fA5er{fl_P_S|dV71fo1HH=^=fvzy=ks5>iS|A+GpqW zYPnf|ZtCr_2@j#2?vRR|HN2}X!}stpyqZ_@@rPg4xA1AwPOqBX-Rhrf zeEmAy|2POHZS^KB7K`_P9)J7CeAI-?`?tSe9H!~>tU6O_jrE|M2^d}PvfOpo6ZSqs z<5F|z96fK`ZNPcjm+OQ{Pxbg zuAg>;I$sKxItQ93HJ|*%>wD$-q$l3}rEqS))c1$xqkhhlKefN-2~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4oN8hutR#byIw}fO*q|v zpeK~Se4&p({t&TG*Yr_vr+ED=TGGd`iTmjA=hquyeC`f}Zo+!CYfHKr-X0=VR=5RD zWZ$dkR;bI+?yZVG4n}K`d3~Z!V3>U=r%z%zL%R_CDU1pc`+ouG(+Dl*<&r+r7##V3 D$S9&b literal 0 HcmV?d00001 diff --git a/test/files/expected_vocab_from_txt.pkl b/test/files/expected_vocab_from_txt.pkl new file mode 100644 index 0000000000000000000000000000000000000000..0698bc3d6c3ccde57d064f0e7c0306221b561679 GIT binary patch literal 400 zcmX|-&2GXl5QL#I5R-;~N?SPi*b^_}r+@^AB_L7*QZJQy>1~eYec82R`?51D&u8!c ziN}Ap~2=~ zAgQXN+BFBO`xr&1E~cQ?00VB7HIY(`Tdj)v@M9VRNc7t9kWh?KbjRupL+?E1l`tWa zBXPJ9B-QZt7 0 + + +def test_preprocessor_bag_of_words(preprocessor, simple_texts): + preprocessor.texts = simple_texts + preprocessor.analyze_texts() + preprocessor.generate_bag_of_words() + + assert len(preprocessor.bag_of_words) == 2 + assert all(len(doc) > 0 for doc in preprocessor.bag_of_words) + + +def test_generate_document_term_matrix(preprocessor, simple_texts): + preprocessor.texts = simple_texts + preprocessor.analyze_texts() + preprocessor.generate_bag_of_words() + + dtm, vocab = preprocessor.generate_document_term_matrix() + + assert dtm.shape[0] == 2 + assert dtm.shape[1] == len(vocab) + assert dtm.sum() > 0 From db2ab5546e413a5007906a7aeadb624ec87a39eb Mon Sep 17 00:00:00 2001 From: PaulKalho Date: Mon, 1 Dec 2025 21:56:11 -0600 Subject: [PATCH 2/3] chore: test cbc validity --- .github/workflows/ci.yaml | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3939887..6a49819 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,9 +25,44 @@ jobs: - name: Run flake8 uses: py-actions/flake8@v2 - test: + validate-compute-block: runs-on: ubuntu-latest needs: lint-python + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + + - name: Intall dependencies + run: | + pip install -r requirements.txt + + - name: Check cbcs + run: | + python3 - <<'EOF' + import main + + from scystream.sdk.config import load_config, get_compute_block + from scystream.sdk.config.config_loader import _compare_configs + from pathlib import Path + + CBC_PATH = Path("cbc.yaml") + + if not CBC_PATH.exists(): + raise FileNotFoundError("cbc.yaml not found in repo root.") + + block_from_code = get_compute_block() + block_from_yaml = load_config(str(CBC_PATH)) + + _compare_configs(block_from_code, block_from_yaml) + + print("cbc.yaml matches python code definition") + EOF + + run-test: + runs-on: ubuntu-latest + needs: validate-compute-block services: minio: image: lazybit/minio @@ -59,7 +94,7 @@ jobs: build: name: Build docker image runs-on: ubuntu-latest - needs: test + needs: run-test permissions: contents: read packages: write From 182e71c04c232f556cc73dd13a71e30095cbb471 Mon Sep 17 00:00:00 2001 From: PaulKalho Date: Mon, 1 Dec 2025 21:58:14 -0600 Subject: [PATCH 3/3] chore: rename workflow steps --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6a49819..786a9ed 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,6 +26,7 @@ jobs: uses: py-actions/flake8@v2 validate-compute-block: + name: Validate Compute Block Config runs-on: ubuntu-latest needs: lint-python steps: @@ -61,6 +62,7 @@ jobs: EOF run-test: + name: Run Tests runs-on: ubuntu-latest needs: validate-compute-block services: @@ -92,7 +94,7 @@ jobs: run: pytest -vv build: - name: Build docker image + name: Build Docker Image runs-on: ubuntu-latest needs: run-test permissions: