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

Harjoth #199

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Harjoth #199

wants to merge 3 commits into from

Conversation

harjothkaur
Copy link

No description provided.

Copy link

@akumar2709 akumar2709 left a 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", "ı")

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", "Á", "É", "Í", "Ó", "Ú"):

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] + "ς"

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"

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"

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"

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

Successfully merging this pull request may close these issues.

2 participants