You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: share rule instances to eliminate redundant FST construction (#333)
Each rule class now accepts optional dependency params (e.g. cardinal=None)
and reuses injected instances instead of creating its own. Normalizer and
InverseNormalizer build all rules once in topological order via a new
build_tagger_and_verbalizer() method, sharing instances across tagger and
verbalizer construction.
Before: Cardinal was instantiated 60 times per English Normalizer build.
After: Cardinal is instantiated once.
Performance improvement:
- English Normalizer build: 71s -> 17s (4x faster)
- Full test suite: 196s -> 88s (2.2x faster)
0 commit comments