Skip to content

Commit 8638dcf

Browse files
StefanwuuHaotian Wu
andauthored
Add phoneme variation to LexiconFromTextFileJob (#598)
* add phoneme variation to LexiconFromTextFileJob * remove unnecessary change --------- Co-authored-by: Haotian Wu <[email protected]>
1 parent 92f8568 commit 8638dcf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lexicon/conversion.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,16 @@ class LexiconFromTextFileJob(Job):
186186
without checking the output manually on new lexica.
187187
"""
188188

189-
def __init__(self, text_file, compressed=True):
189+
__sis_hash_exclude__ = {"variation": "context"}
190+
191+
def __init__(self, text_file, compressed=True, variation="context"):
190192
"""
191193
:param Path text_file:
192194
:param compressed: save as .xml.gz
195+
:param variation: variation to be added to phonemes
193196
"""
194197
self.text_file = text_file
198+
self.variation = variation
195199

196200
self.out_bliss_lexicon = self.output_path("lexicon.xml.gz" if compressed else "lexicon.xml")
197201

@@ -224,7 +228,7 @@ def run(self):
224228
lex.add_lemma(lemma)
225229

226230
for phoneme in sorted(phonemes):
227-
lex.add_phoneme(phoneme)
231+
lex.add_phoneme(phoneme, variation=self.variation)
228232

229233
write_xml(self.out_bliss_lexicon.get_path(), lex.to_xml())
230234

0 commit comments

Comments
 (0)