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:
parent
b3ea086e85
commit
d0f4aea58d
1 changed files with 10 additions and 0 deletions
|
|
@ -74,6 +74,16 @@ def get_frequency_rank(word_no_nikkud: str) -> int | None:
|
||||||
return _freq.get(clean)
|
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__":
|
if __name__ == "__main__":
|
||||||
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s")
|
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s")
|
||||||
load()
|
load()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue