-
Notifications
You must be signed in to change notification settings - Fork 68
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
Another multilingual approach #177
base: main
Are you sure you want to change the base?
Conversation
dd6269b
to
824c027
Compare
langkit/sentiment.py
Outdated
|
||
def sentiment_nltk(text: str) -> float: | ||
if _sentiment_analyzer is None: | ||
def sentiment_nltk(text: str, sentiment_analyzer) -> float: |
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 think we should continue supporting the use of the modules as standalone functions. It looks like this change would prevent the user from simply calling sentiment_nltk("I am very sad")
, right?
I think this comment applies to other modules. At least for toxicity, I think it's the same case.
Can we require only the text values for the standalone functions?
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 don't see a way to have a single function support multiple languages without the extra parameter. There's a few ways it could be curried, but logically it needs to be there.
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 think having an extra parameter is ok, but requiring the user to pass a SentimentIntensityAnalyzer, for example, looks very complex. Couldn't we have the user be able to pass an optional language
parameter that defaults to english?
we can choose to drop the single function support, but I personally find it very useful.
pass | ||
|
||
|
||
init() |
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.
The removal of the init() call in the import of these modules: (textstat, sentiment, regexes, etc) is a significant breaking change in behavior and will break existing LangKit integrations that imported these modules directly.
Can we provide a back-compat friendly version of the language support changes?
ef52f92
to
17fb02b
Compare
17fb02b
to
bf99652
Compare
init()
on import!Translator
interface for polyglotting English-only metrics