Language Detection with Fastlangid

language-detection-with-fastlangid

In this short post, I will show you an example of the module Spacy fastlangid. This module can detect the language of a text.

The module is based on the model lid.176.ftz based on fastText.

Usage

To use it, import the library and use it. Now, let’s see an example:

from fastlangid.langid import LID
langid = LID()

Now, we have the langid object, and we can pass it to the predict:

result = langid.predict('This is a test')
print(f"The detected language is {result}")

The output is:

The detected language is en

For more details see this

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
accelerating-your-routes-to-market-with-optimized-gtm-alignment

Accelerating your routes-to-market with optimized GTM alignment

Next Post
manipulation-data-science

manipulation Data Science

Related Posts