Skip to content

Commit

Permalink
Handle weird error
Browse files Browse the repository at this point in the history
  • Loading branch information
mbollmann committed Sep 25, 2022
1 parent 8f74b0c commit 10806f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sonnet_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,14 @@ def main(args):
# pronunciation prediction on these words
sentence = sentence.replace("-", " - ")

pron = g2p(sentence)
try:
pron = g2p(sentence)
except Exception:
# Something weird is going on here, e.g.
# inflect.NumOutOfRangeError when input contains a long string
# of digits
continue

candidates.extend(phrase for phrase in extract_phrases(sentence, pron))

log.info(f"Extracted {len(candidates)} candidate phrases.")
Expand Down

0 comments on commit 10806f2

Please sign in to comment.