Conversation
akumar2709
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
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.
This test case is wrong and should be like -
assert lc ("HELLO-WORLD", "en") == "hello-world", "Test case failed"
No description provided.