speaker_helper.eardrum package
Submodules
- speaker_helper.eardrum.discover module
- speaker_helper.eardrum.ear module
- speaker_helper.eardrum.espeak module
- speaker_helper.eardrum.expressive module
- Module summary
- Usage example
- Author
AROUSAL_STEPDEFAULT_LEVERSExpressionResultExpressionResult.textExpressionResult.languageExpressionResult.expected_contourExpressionResult.expectedExpressionResult.neutralExpressionResult.takesExpressionResult.bestExpressionResult.verdictExpressionResult.bestExpressionResult.expectedExpressionResult.expected_contourExpressionResult.languageExpressionResult.neutralExpressionResult.takesExpressionResult.textExpressionResult.verdict
ExpressionTakeExpressionTake.leverExpressionTake.sayExpressionTake.contourExpressionTake.contour_okExpressionTake.arousal_shiftExpressionTake.arousal_okExpressionTake.audioExpressionTake.agreesExpressionTake.arousal_okExpressionTake.arousal_shiftExpressionTake.audioExpressionTake.contourExpressionTake.contour_okExpressionTake.emotionExpressionTake.intensityExpressionTake.leverExpressionTake.paceExpressionTake.say
LeverProsodyReportREFERENCE_TAKESTAG_AROUSALTakeSelectorTextExpressionarousal_agrees()check_expression()closer_to_the_text()expected_arousal_from_tag()infer_expression()marked_question()parse_expression()retake()run_prosody()run_prosody_async()segments_from_text()stronger_emotion()
- speaker_helper.eardrum.intonation module
- speaker_helper.eardrum.loop module
- Module summary
- Usage example
- Author
AttemptCARRIERSCLIP_PAD_SDEFAULT_THRESHOLDIMPROVEMENT_MARGINListenerSPELLING_GUIDETakeWordJobWordResultWordResult.reasonsWordResult.sourceWordResult.targetWordResult.attemptsWordResult.bestWordResult.verdictWordResult.savedWordResult.noteWordResult.attemptsWordResult.bestWordResult.engineWordResult.languageWordResult.noteWordResult.reasonsWordResult.savedWordResult.sourceWordResult.targetWordResult.verdictWordResult.word
carriers_for()chosen_variant()phones_of()propose_respelling()save_verified()slug()tune_word()
- speaker_helper.eardrum.phones module
- speaker_helper.eardrum.prosody module
- Module summary
- Usage example
- Author
CREAK_SContourF0_MIN_HZFINAL_WINDOW_SHOPProsodyFeaturesProsodyFeatures.f0_median_hzProsodyFeatures.f0_range_stProsodyFeatures.finalProsodyFeatures.loudness_dbProsodyFeatures.loudness_spread_dbProsodyFeatures.voiced_shareProsodyFeatures.duration_sProsodyFeatures.duration_sProsodyFeatures.f0_median_hzProsodyFeatures.f0_range_stProsodyFeatures.finalProsodyFeatures.loudness_dbProsodyFeatures.loudness_spread_dbProsodyFeatures.voiced_share
RISE_STSAMPLE_RATEarousal_shift()average_features()final_contour()measure()pitch_track()semitones()
- speaker_helper.eardrum.report module
- speaker_helper.eardrum.targets module
Module contents
The Ralph Eardrum Loop: re-listen to every word, fix how it is spelled for the engine, until the engine says it right.
Module summary
The sibling of the Ralph Eyeball Loop (render a figure, look at it, fix the source): here the engine says a word, a phoneme recogniser hears it, the distance to the right pronunciation is measured, and the respelling the engine is handed is rewritten until the word comes out right. What is checked:
every entry of the lexicon for the language (the default);
the words of a document at risk of being mispronounced and not in the lexicon yet — proper nouns, acronyms, brand-shaped words, words espeak reads as foreign (
discover);optionally (
listen_all) every word of the document: each sentence is said with today’s lexicon and heard back, and the words that came out far from their expected reading join the list;or an explicit list of words.
Winning spellings go to lexicon.yaml.eardrum.yaml (per engine, applied on
every later synthesis, never over a hand-written one); the report with every
take goes to .private/eardrum-loop/<date-time>/index.html.
Submodules: phones (IPA units and distances), targets (what
a word should sound like: lexicon, Wiktionary, Wikipedia, espeak),
ear (the phoneme recogniser), espeak, discover,
loop (one word, start to finish), report.
Usage example
>>> from speaker_helper import Settings
>>> from speaker_helper.eardrum import run_eardrum
>>> # report = run_eardrum(Settings.from_mapping({"language": "fr"}),
>>> # text="Hier, Feynman parlait de l'ONU.")
>>> # report.html -> .private/eardrum-loop/20261117-213000/index.html
- class speaker_helper.eardrum.EardrumReport(results=<factory>, html=None, verified_path=None, meta=<factory>)[source]
Bases:
objectWhat a run of the loop produced.
- Parameters:
- results
One per word.
- Type:
list of WordResult
- html
The HTML report (
Nonewhen nothing was written).- Type:
Path or None
- verified_path
The sidecar the winning spellings went to (
Noneon a dry run).- Type:
Path or None
- results: list[WordResult]
- property unresolved: list[WordResult]
The words still said wrong (
unresolved,proposal,no-target).
- class speaker_helper.eardrum.WordJob(word, language, entry=None, reasons=<factory>)[source]
Bases:
objectA word to put through the loop.
- Parameters:
word (str)
language (str)
entry (LexiconEntry | None)
- entry
The lexicon entry, when there is one.
- Type:
LexiconEntry or None
- entry: LexiconEntry | None = None
- class speaker_helper.eardrum.WordResult(word, language, engine, reasons=<factory>, source='new', target=None, attempts=<factory>, best=-1, verdict='unresolved', saved=False, note='')[source]
Bases:
objectEverything the loop did for one word.
- Parameters:
- word, language, engine
What was tested, in which language, on which backend.
- Type:
- source
The lexicon entry’s source (
user,builtin,llm,eardrum) or"new"for a discovered word.- Type:
- verdict
ok(already right),fixed(a new spelling passes and was saved),improved(better, saved, still above the threshold),proposal(a hand-written spelling fails; a better one is proposed, not applied),unresolved,no-target.- Type:
- speaker_helper.eardrum.collect_jobs(lexicon, language, *, text=None, words=None, include_lexicon=True, foreign=None)[source]
Decide which words the loop will test.
- Parameters:
lexicon (Lexicon or None) – The project’s lexicon.
language (str) – Language of the text.
text (str or None) – A document: its lexicon words and its discovered words are tested.
words (list of str or None) – Explicit words (tested whatever else is asked).
include_lexicon (bool) – Without
text: test every lexicon entry of the language. Withtext: test the lexicon entries the text contains.foreign (callable or None) – espeak-based foreign-word detection, forwarded to
discover().
- Returns:
No word twice.
- Return type:
- speaker_helper.eardrum.run_eardrum(settings, **kwargs)[source]
Synchronous wrapper around
run_eardrum_async().- Parameters:
settings (Settings) – See
run_eardrum_async().**kwargs – Forwarded unchanged.
- Returns:
The results and where the report went.
- Return type:
- async speaker_helper.eardrum.run_eardrum_async(settings, *, text=None, words=None, include_lexicon=True, listen_everything=False, max_iter=4, threshold=0.25, web=True, llm=True, dry_run=False, out_dir=None, ear=None, speaker=None, resolver=None)[source]
Run the Ralph Eardrum Loop; see the module docstring.
- Parameters:
settings (Settings) – Engine, language, lexicon location.
text (str or None) – A document to check (its lexicon words and discovered words).
include_lexicon (bool) – Also check lexicon entries (all of them without
text).listen_everything (bool) – Say the whole
textfirst and add every word heard far from its expected reading.max_iter (int) – Maximum LLM proposals per word.
threshold (float) – Score at or below which a word counts as said right.
web (bool) – Look targets up on Wiktionary / Wikipedia.
llm (bool) – Let the local LLM propose respellings.
dry_run (bool) – Measure and report, but write nothing to the verified sidecar.
out_dir (Path or None) – Report directory; a dated folder under
DEFAULT_OUTby default.ear (optional) – Injected collaborators (tests); built from
settingsotherwise.speaker (optional) – Injected collaborators (tests); built from
settingsotherwise.resolver (optional) – Injected collaborators (tests); built from
settingsotherwise.
- Returns:
The results and where the report went.
- Return type: