Skip to content

Add files via upload#197

Open
kishore223 wants to merge 5 commits intokscanne:masterfrom
kishore223:feature
Open

Add files via upload#197
kishore223 wants to merge 5 commits intokscanne:masterfrom
kishore223:feature

Conversation

@kishore223
Copy link
Copy Markdown

No description provided.

else:
return word.lower()
elif lang in ['zh', 'ja', 'th']:
return word
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here in the line 16th we can write return word.lower()

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chinese (zh), Japanese (ja), or Thai (th) these languages don't have notion of upper and lowercase characters. So it returns unchanged.

word = input("Enter a word: ")
lang = input("Enter language code (BCP-47): ")

lowercased_word = lowercase_word(word, lang)
Copy link
Copy Markdown

@pbutiya pbutiya Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if some person will enter any random BCP-47 code which is not existing then it will convert text into lower case but after the output coming how person can know that the language code is correct or not so should should we ask for language inspite of language code?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I have mentioned the code word for every language.

vowels = set(['A', 'E', 'I', 'O', 'U', 'Á', 'É', 'Í', 'Ó', 'Ú'])
for i in range(1, len(word)):
if word[i-1] in ['n', 't'] and word[i] in vowels and word[i].isupper():
return word[:i] + '-' + word[i:].lower()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should only be applied at the beginning of a word. nAthair -> n-athair, but if it's "bhurnAthair, then "bhurnathair" is fine.

import unittest

def lowercase_word(word, lang):
if lang in ['tr', 'az']:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If "lang" is meant to be a BCP-47 code, you'll need to pick out the language code from the beginning.

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.

3 participants