MCPcopy Create free account
hub / github.com/OpenMOSS/MOSS-TTS-Nano / normalize

Method normalize

text_normalization_pipeline.py:116–128  ·  view source on GitHub ↗
(self, *, text: str, prompt_text: str, language: str)

Source from the content-addressed store, hash-verified

114 return self._normalizers
115
116 def normalize(self, *, text: str, prompt_text: str, language: str) -> tuple[str, str]:
117 snapshot = self.ensure_ready()
118 if not snapshot.ready:
119 raise RuntimeError(snapshot.error or snapshot.message)
120
121 with self._normalize_lock:
122 normalizers = self._ensure_normalizers_loaded()
123 if language not in normalizers:
124 raise ValueError(f"Unsupported text normalization language: {language}")
125 normalizer = normalizers[language]
126 normalized_text = normalizer.normalize(text) if text else ""
127 normalized_prompt_text = normalizer.normalize(prompt_text) if prompt_text else ""
128 return normalized_text, normalized_prompt_text
129
130
131def resolve_text_normalization_language(*, text: str, voice: str) -> str:

Callers 1

Calls 2

ensure_readyMethod · 0.95

Tested by

no test coverage detected