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

Fix inconsistent tokenization #2

Open
maharajbrahma opened this issue Aug 31, 2023 · 2 comments
Open

Fix inconsistent tokenization #2

maharajbrahma opened this issue Aug 31, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@maharajbrahma
Copy link
Member

  1. 12.6 should not split
  2. 22थी should split
  3. थी22 should split
@maharajbrahma maharajbrahma added the bug Something isn't working label Aug 31, 2023
@swaubhik
Copy link

swaubhik commented Sep 5, 2023

import re

def bodo_tokenizer(text):
    # Regular expression to match Bodo language tokens
    pattern = r'(\d+\.\d+)|([\d.]+)|([\u0980-\u09FF]+)|(\S+)'
    
    # Find all matches using the regex pattern
    tokens = [match.group(0) for match in re.finditer(pattern, text)]
    
    return tokens

# Test the tokenizer with some examples
text1 = "12.6 थी22 22थी"
tokens1 = bodo_tokenizer(text1)
print(tokens1)  # Output: ['12.6', 'थी22', '22', 'थी']

text2 = "थी 12.6 थी 22थी"
tokens2 = bodo_tokenizer(text2)
print(tokens2)  # Output: ['थी', '12.6', 'थी', '22', 'थी']

@swaubhik swaubhik linked a pull request Sep 5, 2023 that will close this issue
@swaubhik swaubhik pinned this issue Sep 5, 2023
@swaubhik
Copy link

12,600 this should not split
21,थी this should split

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants