-
Notifications
You must be signed in to change notification settings - Fork 89
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
Harjoth #199
base: master
Are you sure you want to change the base?
Harjoth #199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have only listed the changes required to make the code functional. Once those issues are addressed we can later optimize the code and remove some redundancies.
|
||
# Check if language is Turkish or Azerbaijani and replace 'I' with 'ı'. | ||
if language.startswith("tr") or language.startswith("az"): | ||
return word.replace("I", "ı") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only replace "I" with "ı", hence not converting the entire word to lowercase. I would suggest something like -
word.lower().replace("i","ı")
This will convert rest of the alphabets to lowercase too
if language.startswith("ga"): | ||
if word.startswith("n"): | ||
next_letter = word[1:2] | ||
if next_letter in ("A", "E", "I", "O", "U", "Á", "É", "Í", "Ó", "Ú"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check for the next letter wont work if the tilde is implemented with a separate Unicode. Integer equivalent of the tilde Unicode is 771. so you have to check for Unicode of tilde too
# Check if language is modern Greek and handle final sigma. | ||
if language.startswith("el"): | ||
if word.endswith("Σ") or word.endswith("ς"): | ||
return word[:-1] + "ς" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as turkish conversion, we have to convert other letters to lowercase too.
print(f'Test case failed. Expected "{expected}" when lowercasing "{word}" in language "{language}" but got "{actual}".') | ||
|
||
#Testing | ||
assert lc ("你好", "zh-CN") == "你好", "Test case failed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should move these tests to tests.tsv
assert lc("WORLD", "eng") == "world", "Test case failed" | ||
print("passed") | ||
|
||
assert lc ("HELLO-WORLD", "en") == "hello world", "Test case failed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case is wrong and should be like -
assert lc ("HELLO-WORLD", "en") == "hello-world", "Test case failed"
No description provided.