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

Multi Language Tokenization Support #298

Open
andrewdalpino opened this issue May 27, 2023 · 4 comments
Open

Multi Language Tokenization Support #298

andrewdalpino opened this issue May 27, 2023 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@andrewdalpino
Copy link
Member

andrewdalpino commented May 27, 2023

I'm hoping that we can get to the point where we fully support the following languages.

  • English
  • Spanish
  • German
  • French
  • Russian
  • Japanese
  • Hindi
  • Farsi
  • Chinese
  • Arabic

I started adding unit tests for these languages for a few tokenizers here https://github.com/RubixML/ML/tree/master/tests/Tokenizers - however, it doesn't look like we support all the langugaes. I only speak English so it's hard for me to tell. Could we get some help from the community to verify that our Tokenizers support all of these languages and, if not, contribute a fix?

https://github.com/RubixML/ML/tree/master/src/Tokenizers

Thank you!

@andrewdalpino andrewdalpino added enhancement New feature or request help wanted Extra attention is needed labels May 27, 2023
@taotecode
Copy link

How to join the development of multiple languages? I am good at Chinese and English.

@andrewdalpino
Copy link
Member Author

Hi @taotecode, thanks for your interest in contributing to the project! Here are the unit tests for the Tokenizers implemented in the library.

https://github.com/RubixML/ML/tree/master/tests/Tokenizers

We need help from native language speakers to ensure that we have test coverage for different languages and that the current tests are correct.

@tanmayk
Copy link

tanmayk commented May 22, 2024

@andrewdalpino I can help with Hindi. I am not sure how it is going to work with though.

Here is the problem:

$text = "यदि कोई चीज़ काफ़ी महत्वपूर्ण है, तो आपको उसे आज़माना चाहिए। भले ही - संभावित परिणाम विफलता हो।";
$tokens = \Rubix\ML\Tokenizers\Word::tokenize($text);

Expected array:

[
  'यदि', 'कोई', 'चीज़', 'महत्वपूर्ण', 'है', 'तो', 'आपको', 'उसे', 'आज़माना',
  'चाहिए', 'भले', 'ही', '-', 'संभावित', 'परिणाम', 'विफलता', 'हो',
]

Actual array:

[
  'यद', 'क', 'ई', 'च', 'ज', 'क', 'फ', 'महत', 'वप', 'र', 'ण', 'ह', 'त', 'आपक',
  'उस', 'आज', 'म', 'न', 'च', 'ह', 'ए', 'भल', 'ह', '-', 'स', 'भ', 'व', 'त',
  'पर', 'ण', 'म', 'व', 'फलत', 'ह',
]

I only tested for \Rubix\ML\Tokenizers\Word yet.

@mxmp210
Copy link

mxmp210 commented Jun 18, 2024

@andrewdalpino I can help with Hindi. I am not sure how it is going to work with though.

Here is the problem:

$text = "यदि कोई चीज़ काफ़ी महत्वपूर्ण है, तो आपको उसे आज़माना चाहिए। भले ही - संभावित परिणाम विफलता हो।";
$tokens = \Rubix\ML\Tokenizers\Word::tokenize($text);

Expected array:

[
  'यदि', 'कोई', 'चीज़', 'महत्वपूर्ण', 'है', 'तो', 'आपको', 'उसे', 'आज़माना',
  'चाहिए', 'भले', 'ही', '-', 'संभावित', 'परिणाम', 'विफलता', 'हो',
]

Actual array:

[
  'यद', 'क', 'ई', 'च', 'ज', 'क', 'फ', 'महत', 'वप', 'र', 'ण', 'ह', 'त', 'आपक',
  'उस', 'आज', 'म', 'न', 'च', 'ह', 'ए', 'भल', 'ह', '-', 'स', 'भ', 'व', 'त',
  'पर', 'ण', 'म', 'व', 'फलत', 'ह',
]

I only tested for \Rubix\ML\Tokenizers\Word yet.

This is because Hindi and many other languages are based on Complex Text Layout (CTL) - so you will need to account for partial words that becomes full words at the end. In general terms, they fall under complex script languages. I'm pretty sure there are many works in python for tokenizing these languages, PHP also needs one of those implementations such as hindi-tokenizer but for other languages as well to support further development.

AFAIK the tokenizers comes from NLTK and it's derivative works, there needs to be equivalent implementation in php or FFI wrapper in order to make this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants