Skip to content

ZHG2P throws an exception when it encounters English input #72

@gbaian10

Description

@gbaian10
from misaki import zh

g2p = zh.ZHG2P(version="1.1")
print(g2p("這是 example"))
Traceback (most recent call last):
  File "./example.py", line 4, in <module>
    print(g2p("這是 example"))
          ^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/misaki/zh.py", line 80, in __call__
    segments.append(self.unk)
                    ^^^^^^^^
AttributeError: 'ZHG2P' object has no attribute 'unk'

For ZHG2P, if the text to be converted contains English, it will throw an exception.

How can we solve this problem elegantly?
A way to solve this issue is to preprocess the input by splitting it into segments.
Any other suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions