facebook / fasttext-language-identification

huggingface.co
Total runs: 3.0M
24-hour runs: 6.3K
7-day runs: 34.6K
30-day runs: 2.7M
Model's Last Updated: June 09 2023
text-classification

Introduction of fasttext-language-identification

Model Details of fasttext-language-identification

fastText (Language Identification)

fastText is an open-source, free, lightweight library that allows users to learn text representations and text classifiers. It works on standard, generic hardware. Models can later be reduced in size to even fit on mobile devices. It was introduced in this paper . The official website can be found here .

This LID (Language IDentification) model is used to predict the language of the input text, and the hosted version ( lid218e ) was released as part of the NLLB project and can detect 217 languages. You can find older versions (ones that can identify 157 languages) on the official fastText website .

Model description

fastText is a library for efficient learning of word representations and sentence classification. fastText is designed to be simple to use for developers, domain experts, and students. It's dedicated to text classification and learning word representations, and was designed to allow for quick model iteration and refinement without specialized hardware. fastText models can be trained on more than a billion words on any multicore CPU in less than a few minutes.

It includes pre-trained models learned on Wikipedia and in over 157 different languages. fastText can be used as a command line, linked to a C++ application, or used as a library for use cases from experimentation and prototyping to production.

Intended uses & limitations

You can use pre-trained word vectors for text classification or language identification. See the tutorials and resources on its official website to look for tasks that interest you.

How to use

Here is how to use this model to detect the language of a given text:

>>> import fasttext
>>> from huggingface_hub import hf_hub_download

>>> model_path = hf_hub_download(repo_id="facebook/fasttext-language-identification", filename="model.bin")
>>> model = fasttext.load_model(model_path)
>>> model.predict("Hello, world!")

(('__label__eng_Latn',), array([0.81148803]))

>>> model.predict("Hello, world!", k=5)

(('__label__eng_Latn', '__label__vie_Latn', '__label__nld_Latn', '__label__pol_Latn', '__label__deu_Latn'), 
 array([0.61224753, 0.21323682, 0.09696738, 0.01359863, 0.01319415]))
Limitations and bias

Even if the training data used for this model could be characterized as fairly neutral, this model can have biased predictions.

Cosine similarity can be used to measure the similarity between two different word vectors. If two two vectors are identical, the cosine similarity will be 1. For two completely unrelated vectors, the value will be 0. If two vectors have an opposite relationship, the value will be -1.

>>> import numpy as np

>>> def cosine_similarity(word1, word2):
>>>     return np.dot(model[word1], model[word2]) / (np.linalg.norm(model[word1]) * np.linalg.norm(model[word2]))

>>> cosine_similarity("man", "boy")

0.061653383

>>> cosine_similarity("man", "ceo")

0.11989131

>>> cosine_similarity("woman", "ceo")

-0.08834904
Training data

Pre-trained word vectors for 157 languages were trained on Common Crawl and Wikipedia using fastText. These models were trained using CBOW with position-weights, in dimension 300, with character n-grams of length 5, a window of size 5 and 10 negatives. We also distribute three new word analogy datasets, for French, Hindi and Polish.

Training procedure
Tokenization

We used the Stanford word segmenter for Chinese, Mecab for Japanese and UETsegmenter for Vietnamese. For languages using the Latin, Cyrillic, Hebrew or Greek scripts, we used the tokenizer from the Europarl preprocessing tools. For the remaining languages, we used the ICU tokenizer.

More information about the training of these models can be found in the article Learning Word Vectors for 157 Languages .

License

The language identification model is distributed under the Creative Commons Attribution-NonCommercial 4.0 International Public License .

Evaluation datasets

The analogy evaluation datasets described in the paper are available here: French , Hindi , Polish .

BibTeX entry and citation info

Please cite [1] if using this code for learning word representations or [2] if using for text classification.

[1] P. Bojanowski*, E. Grave*, A. Joulin, T. Mikolov, Enriching Word Vectors with Subword Information

@article{bojanowski2016enriching,
  title={Enriching Word Vectors with Subword Information},
  author={Bojanowski, Piotr and Grave, Edouard and Joulin, Armand and Mikolov, Tomas},
  journal={arXiv preprint arXiv:1607.04606},
  year={2016}
}

[2] A. Joulin, E. Grave, P. Bojanowski, T. Mikolov, Bag of Tricks for Efficient Text Classification

@article{joulin2016bag,
  title={Bag of Tricks for Efficient Text Classification},
  author={Joulin, Armand and Grave, Edouard and Bojanowski, Piotr and Mikolov, Tomas},
  journal={arXiv preprint arXiv:1607.01759},
  year={2016}
}

[3] A. Joulin, E. Grave, P. Bojanowski, M. Douze, H. Jégou, T. Mikolov, FastText.zip: Compressing text classification models

@article{joulin2016fasttext,
  title={FastText.zip: Compressing text classification models},
  author={Joulin, Armand and Grave, Edouard and Bojanowski, Piotr and Douze, Matthijs and J{'e}gou, H{'e}rve and Mikolov, Tomas},
  journal={arXiv preprint arXiv:1612.03651},
  year={2016}
}

If you use these word vectors, please cite the following paper:

[4] E. Grave*, P. Bojanowski*, P. Gupta, A. Joulin, T. Mikolov, Learning Word Vectors for 157 Languages

@inproceedings{grave2018learning,
  title={Learning Word Vectors for 157 Languages},
  author={Grave, Edouard and Bojanowski, Piotr and Gupta, Prakhar and Joulin, Armand and Mikolov, Tomas},
  booktitle={Proceedings of the International Conference on Language Resources and Evaluation (LREC 2018)},
  year={2018}
}

(* These authors contributed equally.)

Runs of facebook fasttext-language-identification on huggingface.co

3.0M
Total runs
6.3K
24-hour runs
10.8K
3-day runs
34.6K
7-day runs
2.7M
30-day runs

More Information About fasttext-language-identification huggingface.co Model

More fasttext-language-identification license Visit here:

https://choosealicense.com/licenses/cc-by-nc-4.0

fasttext-language-identification huggingface.co

fasttext-language-identification huggingface.co is an AI model on huggingface.co that provides fasttext-language-identification's model effect (), which can be used instantly with this facebook fasttext-language-identification model. huggingface.co supports a free trial of the fasttext-language-identification model, and also provides paid use of the fasttext-language-identification. Support call fasttext-language-identification model through api, including Node.js, Python, http.

fasttext-language-identification huggingface.co Url

https://huggingface.co/facebook/fasttext-language-identification

facebook fasttext-language-identification online free

fasttext-language-identification huggingface.co is an online trial and call api platform, which integrates fasttext-language-identification's modeling effects, including api services, and provides a free online trial of fasttext-language-identification, you can try fasttext-language-identification online for free by clicking the link below.

facebook fasttext-language-identification online free url in huggingface.co:

https://huggingface.co/facebook/fasttext-language-identification

fasttext-language-identification install

fasttext-language-identification is an open source model from GitHub that offers a free installation service, and any user can find fasttext-language-identification on GitHub to install. At the same time, huggingface.co provides the effect of fasttext-language-identification install, users can directly use fasttext-language-identification installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

fasttext-language-identification install url in huggingface.co:

https://huggingface.co/facebook/fasttext-language-identification

Url of fasttext-language-identification

fasttext-language-identification huggingface.co Url

Provider of fasttext-language-identification huggingface.co

facebook
ORGANIZATIONS

Other API from facebook

huggingface.co

Total runs: 15.4M
Run Growth: 6.1M
Growth Rate: 39.73%
Updated: January 17 2024
huggingface.co

Total runs: 6.3M
Run Growth: 1.4M
Growth Rate: 22.16%
Updated: September 15 2023
huggingface.co

Total runs: 5.4M
Run Growth: 5.0M
Growth Rate: 92.86%
Updated: March 23 2023
huggingface.co

Total runs: 2.6M
Run Growth: 304.5K
Growth Rate: 11.49%
Updated: November 17 2022
huggingface.co

Total runs: 2.2M
Run Growth: 2.0M
Growth Rate: 90.92%
Updated: November 14 2023
huggingface.co

Total runs: 1.2M
Run Growth: -23.4K
Growth Rate: -1.89%
Updated: February 29 2024
huggingface.co

Total runs: 1.0M
Run Growth: 419.8K
Growth Rate: 40.14%
Updated: September 06 2023
huggingface.co

Total runs: 805.8K
Run Growth: -153.6K
Growth Rate: -19.24%
Updated: December 28 2021
huggingface.co

Total runs: 773.3K
Run Growth: 515.3K
Growth Rate: 66.65%
Updated: January 25 2024
huggingface.co

Total runs: 740.9K
Run Growth: 186.0K
Growth Rate: 25.87%
Updated: January 12 2024
huggingface.co

Total runs: 650.1K
Run Growth: 497.6K
Growth Rate: 68.58%
Updated: June 15 2023
huggingface.co

Total runs: 638.0K
Run Growth: 539.7K
Growth Rate: 84.59%
Updated: November 16 2023
huggingface.co

Total runs: 635.9K
Run Growth: 337.2K
Growth Rate: 53.25%
Updated: September 06 2023
huggingface.co

Total runs: 560.7K
Run Growth: 100.3K
Growth Rate: 18.93%
Updated: September 01 2023
huggingface.co

Total runs: 353.9K
Run Growth: -34.3K
Growth Rate: -9.69%
Updated: January 20 2022
huggingface.co

Total runs: 352.9K
Run Growth: 176.2K
Growth Rate: 49.92%
Updated: September 15 2023
huggingface.co

Total runs: 341.0K
Run Growth: 225.8K
Growth Rate: 66.79%
Updated: January 12 2024
huggingface.co

Total runs: 234.6K
Run Growth: 142.8K
Growth Rate: 60.86%
Updated: September 06 2023
huggingface.co

Total runs: 226.8K
Run Growth: 67.1K
Growth Rate: 29.28%
Updated: May 22 2023
huggingface.co

Total runs: 222.7K
Run Growth: 88.3K
Growth Rate: 39.66%
Updated: June 03 2022
huggingface.co

Total runs: 181.8K
Run Growth: -54.0K
Growth Rate: -29.70%
Updated: September 05 2023
huggingface.co

Total runs: 143.7K
Run Growth: 54.8K
Growth Rate: 38.13%
Updated: September 15 2023
huggingface.co

Total runs: 108.3K
Run Growth: -5.1M
Growth Rate: -4749.39%
Updated: June 13 2023
huggingface.co

Total runs: 75.9K
Run Growth: -2.3K
Growth Rate: -44.21%
Updated: October 16 2024
huggingface.co

Total runs: 58.0K
Run Growth: 22.4K
Growth Rate: 38.69%
Updated: September 15 2023
huggingface.co

Total runs: 56.5K
Run Growth: 27.0K
Growth Rate: 56.88%
Updated: May 22 2023
huggingface.co

Total runs: 51.4K
Run Growth: -44.9K
Growth Rate: -88.02%
Updated: January 12 2024
huggingface.co

Total runs: 46.6K
Run Growth: 3.0K
Growth Rate: 6.42%
Updated: January 25 2023
huggingface.co

Total runs: 33.0K
Run Growth: 4.0K
Growth Rate: 12.12%
Updated: June 05 2023
huggingface.co

Total runs: 28.5K
Run Growth: 6.8K
Growth Rate: 23.74%
Updated: February 12 2023
huggingface.co

Total runs: 28.2K
Run Growth: 12.7K
Growth Rate: 45.10%
Updated: January 25 2023
huggingface.co

Total runs: 25.8K
Run Growth: -39.2K
Growth Rate: -157.99%
Updated: March 13 2024
huggingface.co

Total runs: 22.1K
Run Growth: 11.2K
Growth Rate: 50.76%
Updated: July 23 2024
huggingface.co

Total runs: 21.2K
Run Growth: -3.1K
Growth Rate: -15.51%
Updated: September 15 2023
huggingface.co

Total runs: 21.0K
Run Growth: -4.6K
Growth Rate: -20.53%
Updated: September 06 2023
huggingface.co

Total runs: 18.7K
Run Growth: -4.9K
Growth Rate: -26.01%
Updated: January 25 2023