Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmenter removes space of English words in code-mixed sentence #43

Open
shivanraptor opened this issue Oct 6, 2023 · 4 comments
Open
Labels

Comments

@shivanraptor
Copy link

Describe the bug
Segmenter removes space of English words in code-mixed sentence, for example this sentence:

這是Career Centre

To reproduce
Here is the code:

import pycantonese
from pycantonese.word_segmentation import Segmenter
segmenter = Segmenter()
pyseg = pycantonese.segment("這是Career Centre", cls=segmenter)
for word in pyseg:
    print(word)

The output is:

這是
CareerCentre

Expected behavior
The expected output is:

這是
Career Centre

or

這是
Career
Centre

System (please complete the following information):

  • Operating System: macOS Sonoma 14.0 (23A344)
  • PyCantonese version: 3.4.0
@shivanraptor
Copy link
Author

After a dig in the old issues, I thought this issue was fixed in #32 (comment), but it isn't.

@laubonghaudoi
Copy link

主要係因為呢個 #35 未解決所以一直都未發佈更新。

@shivanraptor
Copy link
Author

I guess I have to wait then.

@pengzhendong
Copy link

pengzhendong commented May 11, 2024

You can replace the space with some uncommon punctuations, such as "▁". And then skip it.

https://github.com/pengzhendong/g2p-mix/blob/dd19bee513cc13230c41ef66e479de695afa0e2c/g2p_mix/g2p_mix.py#L43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants