-
Notifications
You must be signed in to change notification settings - Fork 457
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
Simplify language identification using dictionary mapping #898
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.
can't we just do Language(args.language)
?
(need a try/except to handle missing cases)
while we're at it, we may want to derive the argparse choices from the Language enum. |
floss/main.py
Outdated
choices=[lang.value for lang in Language], | ||
default="none", |
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.
does this include the unknown language in the usage output and allow to use "none"?
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.
Yes, this change includes the unknown. I've updated it to allow "none" and not "Unknown" in latest commit 😄
else: | ||
|
||
try: | ||
lang_id = Language(args.language) |
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.
how can users disable language detection now?
now part of #901 |
This PR suggests using a dictionary mapping approach for language identification.