Skip to content

Maximum recursion depth exceeded with --preserve-punctuation and long documents #108

Closed
@jncasey

Description

Describe the bug
If you try to phonemize a long document (say, a Project Gutenberg ebook) and preserve punctuation, phonemize throws
fatal error: maximum recursion depth exceeded in comparison

Phonemizer version
phonemizer-3.0.1
available backends: espeak-1.48.3, segments-2.2.0
uninstalled backends: espeak-mbrola, festival

System
Both macOS 11.6 and Ubuntu 20.10

To reproduce
phonemize --preserve-punctuation pg67147.txt
where pg67147.txt is this ebook, or anything relatively long.

Expected behavior
This looks like a result of the Punctuation restore methods being recursive and my (probably unreasonably long) use case.

Additional context
I'm happy to try refactoring the restore methods into a single iterative method. Just let me know if you'd like me to contribute.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions