### Install fastlangid Source: https://github.com/currentslab/fastlangid/blob/master/README.md Install the fastlangid package using pip. ```bash $ pip install fastlangid ``` -------------------------------- ### Install local copy into a virtualenv Source: https://github.com/currentslab/fastlangid/blob/master/CONTRIBUTING.rst Steps to set up the forked repository for local development using virtualenvwrapper. ```shell $ mkvirtualenv fastlangid $ cd fastlangid/ $ python setup.py develop ``` -------------------------------- ### Clone your fork locally Source: https://github.com/currentslab/fastlangid/blob/master/CONTRIBUTING.rst Command to clone the forked repository to your local machine. ```shell $ git clone git@github.com:your_name_here/fastlangid.git ``` -------------------------------- ### Run a subset of tests Source: https://github.com/currentslab/fastlangid/blob/master/CONTRIBUTING.rst Command to execute a specific subset of tests. ```shell $ python -m unittest test/testcases.py ``` -------------------------------- ### Check changes and run tests Source: https://github.com/currentslab/fastlangid/blob/master/CONTRIBUTING.rst Commands to verify changes by running flake8 and tests, including testing other Python versions with tox. ```shell $ python -m unittest ``` -------------------------------- ### Deploying fastlangid Source: https://github.com/currentslab/fastlangid/blob/master/CONTRIBUTING.rst Commands for maintainers to deploy a new version of fastlangid. ```shell $ bump2version patch # possible: major / minor / patch $ git push $ git push --tags ``` -------------------------------- ### Create a branch for local development Source: https://github.com/currentslab/fastlangid/blob/master/CONTRIBUTING.rst Command to create a new branch for bug fixes or feature development. ```shell $ git checkout -b name-of-your-bugfix-or-feature ``` -------------------------------- ### Commit and push changes Source: https://github.com/currentslab/fastlangid/blob/master/CONTRIBUTING.rst Commands to commit local changes and push the branch to GitHub. ```shell $ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature ``` -------------------------------- ### Reference 2: Bag of Tricks for Efficient Text Classification Source: https://github.com/currentslab/fastlangid/blob/master/README.md BibTeX entry for the paper 'Bag of Tricks for Efficient Text Classification'. ```bibtex @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} } ``` -------------------------------- ### Force Cantonese prediction Source: https://github.com/currentslab/fastlangid/blob/master/README.md To use Cantonese prediction, it is recommended to force inference using the second stage prediction. ```python lang_code = langid.predict('平嘢有冇好嘢?', force_second=True) ``` -------------------------------- ### Reference 1: Enriching Word Vectors with Subword Information Source: https://github.com/currentslab/fastlangid/blob/master/README.md BibTeX entry for the paper 'Enriching Word Vectors with Subword Information'. ```bibtex @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} } ``` -------------------------------- ### Multiple sentence prediction Source: https://github.com/currentslab/fastlangid/blob/master/README.md Handle multiple sentences prediction with a single function call. ```python from fastlangid.langid import LID langid = LID() examples = [ '中文繁體', '中文简体', 'Lorem Ipsum is simply dummy text of the printing and typesetting industry', 'Lorem Ipsum adalah text contoh digunakan didalam industri pencetakan dan typesetting', 'Le Lorem Ipsum est simplement du faux texte employé dans la composition et la mise en page avant impression' ] results = langid.predict(examples) print(results) ``` -------------------------------- ### Single sentence prediction Source: https://github.com/currentslab/fastlangid/blob/master/README.md Handle single sentence prediction with a single function call. ```python from fastlangid.langid import LID langid = LID() result = langid.predict('This is a test') print(result) ``` -------------------------------- ### FastText.zip Paper Citation Source: https://github.com/currentslab/fastlangid/blob/master/README.md BibTeX citation for the FastText.zip paper. ```bibtex @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} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.