Skip to content

docs: Add HebPipe architecture and migration report#1

Open
arielnahom wants to merge 3 commits into
masterfrom
add-architecture-report-3353676423318959672
Open

docs: Add HebPipe architecture and migration report#1
arielnahom wants to merge 3 commits into
masterfrom
add-architecture-report-3353676423318959672

Conversation

@arielnahom

Copy link
Copy Markdown
Owner

This PR adds a comprehensive report outlining the current state of the HebPipe codebase and proposes a detailed re-architecture and migration plan to modernize the project.

Key points covered in the report (doc/report.txt):

  • Project Overview: Summary of the existing monolithic pipeline architecture.
  • The "Gold" Data: Identification of the most valuable assets (lexicons, morphology rules, annotated datasets) that should be preserved.
  • Missing Parts and Gaps: Analysis of technical debt, including lack of tests, monolithic design, and outdated dependency management.
  • Migration Plan: Step-by-step strategy for extracting data, refactoring logic, decoupling ML models, and building a modular pipeline.
  • Suggestions for Improvement: Recommendations for better model hosting, typing/linting, and ecosystem integration (e.g., HuggingFace, spaCy).
  • Recommendations: Advice to split the data from the code and completely rewrite the pipeline utilizing modern standards.
  • Data Usage and Applications: Ideas on how the extracted Hebrew data can be utilized independently (e.g., search indexing, LLM fine-tuning, grammar checking).

PR created automatically by Jules for task 3353676423318959672 started by @arielnahom

- Added `doc/report.txt` containing a detailed architecture and migration report.
- The report covers project overview, data/logic analysis, gaps, migration plan, and recommendations for improvement.

Co-authored-by: arielnahom <16294824+arielnahom@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a detailed re-architecture and migration report for the HebPipe Hebrew NLP pipeline, covering project overview, data assets, and a modernization roadmap. The review feedback identifies several areas for improvement: addressing security risks of unencrypted HTTP downloads, adopting Ruff for linting and formatting, decoupling core logic from ML frameworks like scikit-learn, and including a CI/CD pipeline in the migration plan to automate testing.

Comment thread doc/report.txt
- **Lack of Automated Testing:** There is no test suite (e.g., `pytest`), making it risky to refactor or update dependencies.
- **Monolithic Design:** `heb_pipe.py` mixes CLI parsing, data downloading, pipeline orchestration, and formatting, making it difficult to import and use cleanly as a Python library.
- **Outdated Packaging:** Still relies on `setup.py` and a rigid `requirements.txt` instead of modern dependency management like `pyproject.toml` (Poetry/PDM).
- **Hardcoded Model Hosting:** Model weights are downloaded via hardcoded URLs from a personal domain (`gucorpling.org`), which is a single point of failure and not ideal for longevity.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

The report correctly identifies hardcoded URLs as a single point of failure. However, it should also highlight that the current implementation uses unencrypted HTTP (http://gucorpling.org), which poses a significant security risk. Since model weights (often stored as pickle files) can execute arbitrary code upon loading, they should be served over HTTPS (e.g., via HuggingFace Hub) to prevent Man-in-the-Middle (MitM) attacks.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! I saw you tagged me. Is there anything specific you would like me to address regarding this line or the report in general?

Comment thread doc/report.txt

## 4. Migration Plan
To rewrite and modernize this library from scratch, follow these phases:
1. **Bootstrap Modern Project:** Initialize a new repository with `pyproject.toml`, `pytest`, `black`/`ruff` for formatting, and `mypy` for typing.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While black is mentioned, ruff is a more modern and performant alternative that handles formatting, linting, and import sorting. It is recommended to standardize on ruff to simplify the toolchain and improve developer experience.

1. Bootstrap Modern Project: Initialize a new repository with pyproject.toml, pytest, ruff for linting and formatting, and mypy for typing.

Comment thread doc/report.txt
To rewrite and modernize this library from scratch, follow these phases:
1. **Bootstrap Modern Project:** Initialize a new repository with `pyproject.toml`, `pytest`, `black`/`ruff` for formatting, and `mypy` for typing.
2. **Extract the Data Layer:** Move all the "Gold" data into a dedicated `data/` or `assets/` directory. Write clean data-loaders with `pydantic` models for structure.
3. **Refactor Logic & Heuristics:** Port the core Hebrew-specific logic (from `preprocess.py`, `whitespace_tokenize.py`) into pure, testable functions with type hints. Write unit tests to guarantee 1:1 behavior with the legacy system.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The report identifies lib/preprocess.py as containing valuable rule-based logic. However, the current implementation is tightly coupled with scikit-learn (e.g., BaseEstimator, TransformerMixin). To achieve the goal of decoupling from ML frameworks, the migration plan should explicitly mention refactoring this logic into framework-agnostic Python functions.

3. Refactor Logic & Heuristics: Port the core Hebrew-specific logic (from preprocess.py, whitespace_tokenize.py) into pure, testable functions with type hints, removing dependencies on frameworks like scikit-learn. Write unit tests to guarantee 1:1 behavior with the legacy system.

Comment thread doc/report.txt
2. **Extract the Data Layer:** Move all the "Gold" data into a dedicated `data/` or `assets/` directory. Write clean data-loaders with `pydantic` models for structure.
3. **Refactor Logic & Heuristics:** Port the core Hebrew-specific logic (from `preprocess.py`, `whitespace_tokenize.py`) into pure, testable functions with type hints. Write unit tests to guarantee 1:1 behavior with the legacy system.
4. **Decouple ML Models:** Replace the legacy `mtlmodel.py` with cleaner PyTorch Lightning modules or integrate natively with the HuggingFace `transformers` ecosystem.
5. **Construct a Modular Pipeline:** Implement the pipeline using the Strategy pattern or HuggingFace Pipeline API, where tokenization, tagging, and parsing are distinct, pluggable components.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The migration plan identifies the lack of automated testing as a gap but does not explicitly include the setup of a Continuous Integration (CI) pipeline. Adding CI (e.g., GitHub Actions) is essential to ensure that tests and linters are run automatically on every contribution, maintaining the proposed modern standards.

5. Construct a Modular Pipeline & CI: Implement the pipeline using the Strategy pattern or HuggingFace Pipeline API, and set up CI/CD to automate testing and linting.

google-labs-jules Bot and others added 2 commits May 18, 2026 20:08
- Added `doc/report.txt` containing a detailed architecture and migration report.
- The report covers project overview, data/logic analysis, gaps, migration plan, and recommendations for improvement.

Co-authored-by: arielnahom <16294824+arielnahom@users.noreply.github.com>
Co-authored-by: arielnahom <16294824+arielnahom@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant