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

Not working with Chinese. #134

Open
joshhu opened this issue Aug 20, 2022 · 1 comment
Open

Not working with Chinese. #134

joshhu opened this issue Aug 20, 2022 · 1 comment

Comments

@joshhu
Copy link

joshhu commented Aug 20, 2022

Missing a lot of matches with only Chinese characters not words. Modifying line 523 in the keyword.py not working at all.

@Hyprnx
Copy link

Hyprnx commented Oct 11, 2022

Faced the same problem, kinda fixed it by adding my type of alphabet characters(in your case, chinese) to self._white_space_chars variable

self._keyword = '_keyword_'
self._white_space_chars = set(['.', '\t', '\n', '\a', ' ', ','])
vn_text = 'àáãạảăắằẳẵặâấầẩẫậèéẹẻẽêềếểễệđìíĩỉịòóõọỏôốồổỗộơớờởỡợùúũụủưứừửữựỳỵỷỹýÀÁÃẠẢĂẮẰẲẴẶÂẤẦẨẪẬÈÉẸẺẼÊỀẾỂỄỆĐÌÍĨỈỊÒÓÕỌỎÔỐỒỔỖỘƠỚỜỞỠỢÙÚŨỤỦƯỨỪỬỮỰỲỴỶỸÝ' # My Language alphabet characters
other_text = 'äöüßÄÖÜß' # German alphabet characters
try:
    # python 2.x
    self.non_word_boundaries = set(string.digits + string.letters + '_' + vn_text + other_text)
except AttributeError:
    # python 3.x
    self.non_word_boundaries = set(string.digits + string.ascii_letters + '_' + vn_text + other_text)

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

No branches or pull requests

2 participants