Skip to content

Fix/el teen gender forms and sparrowhawk server#453

Closed
georgepar wants to merge 4 commits into
NVIDIA:mainfrom
athena-ilsp:fix/el-teen-gender-forms-and-sparrowhawk-server
Closed

Fix/el teen gender forms and sparrowhawk server#453
georgepar wants to merge 4 commits into
NVIDIA:mainfrom
athena-ilsp:fix/el-teen-gender-forms-and-sparrowhawk-server

Conversation

@georgepar

Copy link
Copy Markdown

What does this PR do ?

Add a one line overview of what this PR aims to accomplish.

Before your PR is "Ready for review"

Pre checks:

  • Have you signed your commits? Use git commit -s to sign.
  • Do all unittests finish successfully before sending PR?
    1. pytest or (if your machine does not have GPU) pytest --cpu from the root folder (given you marked your test cases accordingly @pytest.mark.run_only_on('CPU')).
    2. Sparrowhawk tests bash tools/text_processing_deployment/export_grammars.sh --MODE=test ...
  • If you are adding a new feature: Have you added test cases for both pytest and Sparrowhawk here.
  • Have you added __init__.py for every folder and subfolder, including data folder which has .TSV files?
  • Have you followed codeQL results and removed unused variables and imports (report is at the bottom of the PR in github review box) ?
  • Have you added the correct license header Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. to all newly added Python files?
  • If you copied nemo_text_processing/text_normalization/en/graph_utils.py your header's second line should be Copyright 2015 and onwards Google, Inc.. See an example here.
  • Remove import guards (try import: ... except: ...) if not already done.
  • If you added a new language or a new feature please update the NeMo documentation (lives in different repo).
  • Have you added your language support to tools/text_processing_deployment/pynini_export.py.

PR Type:

  • New Feature
  • Bugfix
  • Documentation
  • Test

If you haven't finished some of the above items you can still open "Draft" PR.

georgepar and others added 4 commits July 7, 2026 22:22
Add full TN and ITN grammar coverage for Greek (el), wired into
Normalizer / InverseNormalizer and the Sparrowhawk export tooling.

TN taggers/verbalizers: cardinal, ordinal (full gender/case agreement),
decimal, fraction, date, time, measure, money, telephone, electronic,
roman, range, serial, whitelist, punctuation, word. Numbers render in
neuter citation form with feminine thousands, up to 10^12.

ITN taggers/verbalizers: cardinal, ordinal, decimal, fraction, date,
time, measure, money, telephone, electronic, whitelist, punctuation,
word.

Deployment:
- Register el in tools/text_processing_deployment/pynini_export.py and
  add the Greek Sparrowhawk test scripts.
- Commit the exported TN/ITN classify+verbalize .far grammars; gitignore
  the regenerable grammar cache .far files.
- Add tools/text_processing_deployment/GREEK_TN_ITN_GUIDE.md with usage
  and Linux Sparrowhawk deployment instructions.

Notes:
- Greek acronyms are handled only via the whitelist; there is no generic
  all-caps letter-split (it mis-spells all-caps words like ΙΝΤΡΑΚΟΜ and
  Greek acronym pronunciation is irregular and lexicon-dependent).
- Measure ITN uses SI symbols as canonical output (e.g. μέτρα -> m).

Signed-off-by: Giorgos Paraskevopoulos <geopar@central.ntua.gr>
Greek cardinals 3 and 4 inflect for gender, and digit.tsv already lists
both forms (τέσσερα/τέσσερις). The teens that embed them — 13 and 14 —
were only present in their neuter form in teen.tsv, so feminine inputs
like "δεκατέσσερις Ιουλίου" (the natural way to say "14th of July") had
no path and failed, while neuter "δεκατέσσερα" worked.

- teen.tsv: add δεκατρείς (13), δεκατέσσερις and variant δεκατέσσερεις (14)
- inverse_normalize.py: register 'el' in the --language argparse choices
  (omitted when Greek was added, so the CLI rejected el)
- add ITN cardinal/date regression cases
- regenerate el_itn_grammars_cased classify FAR to match

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HC8SksXmtP6LS8u84H3WqW

Signed-off-by: Giorgos Paraskevopoulos <g.paraskevopoulos@athenarc.gr>
FastAPI service that serves both Text Normalization and Inverse Text
Normalization from one container via Google Sparrowhawk, running the
compiled .far grammars exported by nemo_text_processing.

- Two persistent normalizer_main processes (TN + ITN), each behind a
  worker pool, wrapped by /tn, /itn, /normalize, /health endpoints
- normalizer.py launches the C++ binary under `stdbuf -oL` and drains
  stderr on a side thread, so the block-buffered pipe can't deadlock the
  request/response loop (matches the test_sparrowhawk_*.sh contract)
- Dockerfile builds FROM the existing sparrowhawk:latest base and bakes
  in the exported grammars; parameterized per language via build args or
  bind mounts
- entrypoint.sh wires each direction's .far + ascii_proto config into a
  cwd-relative serving dir
- build_and_run.sh one-shot export/build/run helper
- tests/: fake normalizer_main + full-stack local test (no image needed)
- README with API, deploy, config, and the buffering rationale

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HC8SksXmtP6LS8u84H3WqW

Signed-off-by: Giorgos Paraskevopoulos <g.paraskevopoulos@athenarc.gr>
Satisfy the repo pre-commit hooks (black --line-length=119 --skip-string-normalization,
isort --line-width=119, and requirements-txt-fixer) over the Greek TN/ITN and
Sparrowhawk server files so the pre-commit.ci check passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JxHtWQkMhX77mE3EeQsVHi

Signed-off-by: Giorgos Paraskevopoulos <g.paraskevopoulos@athenarc.gr>
@georgepar georgepar force-pushed the fix/el-teen-gender-forms-and-sparrowhawk-server branch from b5f1819 to b1ab13b Compare July 7, 2026 19:26
@georgepar georgepar closed this Jul 7, 2026
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