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

Add Language primitive #142

Open
gsheni opened this issue May 11, 2022 · 2 comments
Open

Add Language primitive #142

gsheni opened this issue May 11, 2022 · 2 comments

Comments

@gsheni
Copy link
Contributor

gsheni commented May 11, 2022

import fasttext
filepath = os.path.join(FILE_PATH, "../data/lid.176.ftz")
model = fasttext.load_model(filepath)
predictions = self.model.predict(text="hej", k=2) # returns top 2 matching languages
predictions

The object returned by the model is of the form ((‘__label__pl’, ‘__label__sv’), array([0.40688798, 0.23321952])) of <class 'tuple'> where pl and sv are the ISO 639 code for Polish and Swedish. The prediction for both languages is correct as Hej means Hello in both languages. The second part indicates the respective confidence of the sentence belonging to those languages.

@sbadithe
Copy link
Contributor

sbadithe commented Jul 2, 2022

Can I pick this up?

@gsheni
Copy link
Contributor Author

gsheni commented Jul 2, 2022

Yes, we can tackle this after the other, currently assigned NLP primitives

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

No branches or pull requests

2 participants