feat(frequency_lookup): add get_freq_data() for batch frequency access

Exposes the full word→rank dict for use by the upcoming sentence_difficulty
module without requiring per-word lookups.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Sochen 2026-03-15 13:18:11 +00:00
parent b3ea086e85
commit d0f4aea58d

View file

@ -74,6 +74,16 @@ def get_frequency_rank(word_no_nikkud: str) -> int | None:
return _freq.get(clean)
def get_freq_data() -> dict[str, int]:
"""Return the full frequency dict (word -> rank).
Auto-loads from cache if not yet loaded.
"""
if not _freq:
load()
return _freq
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s")
load()