[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-70880":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},70880,"fastText","facebookresearch\u002FfastText","facebookresearch","Library for fast text representation and classification.","https:\u002F\u002Ffasttext.cc\u002F",null,"HTML",26530,4812,1,466,0,10,45,"MIT License",true,false,"main",[],"2026-06-12 02:02:44","# fastText\n[fastText](https:\u002F\u002Ffasttext.cc\u002F) is a library for efficient learning of word representations and sentence classification.\n\n[![CircleCI](https:\u002F\u002Fcircleci.com\u002Fgh\u002Ffacebookresearch\u002FfastText\u002Ftree\u002Fmaster.svg?style=svg)](https:\u002F\u002Fcircleci.com\u002Fgh\u002Ffacebookresearch\u002FfastText\u002Ftree\u002Fmaster)\n\n## Table of contents\n\n* [Resources](#resources)\n   * [Models](#models)\n   * [Supplementary data](#supplementary-data)\n   * [FAQ](#faq)\n   * [Cheatsheet](#cheatsheet)\n* [Requirements](#requirements)\n* [Building fastText](#building-fasttext)\n   * [Getting the source code](#getting-the-source-code)\n   * [Building fastText using make (preferred)](#building-fasttext-using-make-preferred)\n   * [Building fastText using cmake](#building-fasttext-using-cmake)\n   * [Building fastText for Python](#building-fasttext-for-python)\n* [Example use cases](#example-use-cases)\n   * [Word representation learning](#word-representation-learning)\n   * [Obtaining word vectors for out-of-vocabulary words](#obtaining-word-vectors-for-out-of-vocabulary-words)\n   * [Text classification](#text-classification)\n* [Full documentation](#full-documentation)\n* [References](#references)\n   * [Enriching Word Vectors with Subword Information](#enriching-word-vectors-with-subword-information)\n   * [Bag of Tricks for Efficient Text Classification](#bag-of-tricks-for-efficient-text-classification)\n   * [FastText.zip: Compressing text classification models](#fasttextzip-compressing-text-classification-models)\n* [Join the fastText community](#join-the-fasttext-community)\n* [License](#license)\n\n## Resources\n\n### Models\n- Recent state-of-the-art [English word vectors](https:\u002F\u002Ffasttext.cc\u002Fdocs\u002Fen\u002Fenglish-vectors.html).\n- Word vectors for [157 languages trained on Wikipedia and Crawl](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FfastText\u002Fblob\u002Fmaster\u002Fdocs\u002Fcrawl-vectors.md).\n- Models for [language identification](https:\u002F\u002Ffasttext.cc\u002Fdocs\u002Fen\u002Flanguage-identification.html#content) and [various supervised tasks](https:\u002F\u002Ffasttext.cc\u002Fdocs\u002Fen\u002Fsupervised-models.html#content).\n\n### Supplementary data\n- The preprocessed [YFCC100M data](https:\u002F\u002Ffasttext.cc\u002Fdocs\u002Fen\u002Fdataset.html#content) used in [2].\n\n### FAQ\n\nYou can find [answers to frequently asked questions](https:\u002F\u002Ffasttext.cc\u002Fdocs\u002Fen\u002Ffaqs.html#content) on our [website](https:\u002F\u002Ffasttext.cc\u002F).\n\n### Cheatsheet\n\nWe also provide a [cheatsheet](https:\u002F\u002Ffasttext.cc\u002Fdocs\u002Fen\u002Fcheatsheet.html#content) full of useful one-liners.\n\n## Requirements\n\nWe are continuously building and testing our library, CLI and Python bindings under various docker images using [circleci](https:\u002F\u002Fcircleci.com\u002F).\n\nGenerally, **fastText** builds on modern Mac OS and Linux distributions.\nSince it uses some C++11 features, it requires a compiler with good C++11 support.\nThese include :\n\n* (g++-4.7.2 or newer) or (clang-3.3 or newer)\n\nCompilation is carried out using a Makefile, so you will need to have a working **make**.\nIf you want to use **cmake** you need at least version 2.8.9.\n\nOne of the oldest distributions we successfully built and tested the CLI under is [Debian jessie](https:\u002F\u002Fwww.debian.org\u002Freleases\u002Fjessie\u002F).\n\nFor the word-similarity evaluation script you will need:\n\n* Python 2.6 or newer\n* NumPy & SciPy\n\nFor the python bindings (see the subdirectory python) you will need:\n\n* Python version 2.7 or >=3.4\n* NumPy & SciPy\n* [pybind11](https:\u002F\u002Fgithub.com\u002Fpybind\u002Fpybind11)\n\nOne of the oldest distributions we successfully built and tested the Python bindings under is [Debian jessie](https:\u002F\u002Fwww.debian.org\u002Freleases\u002Fjessie\u002F).\n\nIf these requirements make it impossible for you to use fastText, please open an issue and we will try to accommodate you.\n\n## Building fastText\n\nWe discuss building the latest stable version of fastText.\n\n### Getting the source code\n\nYou can find our [latest stable release](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FfastText\u002Freleases\u002Flatest) in the usual place.\n\nThere is also the master branch that contains all of our most recent work, but comes along with all the usual caveats of an unstable branch. You might want to use this if you are a developer or power-user.\n\n### Building fastText using make (preferred)\n\n```\n$ wget https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FfastText\u002Farchive\u002Fv0.9.2.zip\n$ unzip v0.9.2.zip\n$ cd fastText-0.9.2\n$ make\n```\n\nThis will produce object files for all the classes as well as the main binary `fasttext`.\nIf you do not plan on using the default system-wide compiler, update the two macros defined at the beginning of the Makefile (CC and INCLUDES).\n\n### Building fastText using cmake\n\nFor now this is not part of a release, so you will need to clone the master branch.\n\n```\n$ git clone https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FfastText.git\n$ cd fastText\n$ mkdir build && cd build && cmake ..\n$ make && make install\n```\n\nThis will create the fasttext binary and also all relevant libraries (shared, static, PIC).\n\n### Building fastText for Python\n\nFor now this is not part of a release, so you will need to clone the master branch.\n\n```\n$ git clone https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FfastText.git\n$ cd fastText\n$ pip install .\n```\n\nFor further information and introduction see python\u002FREADME.md\n\n## Example use cases\n\nThis library has two main use cases: word representation learning and text classification.\nThese were described in the two papers [1](#enriching-word-vectors-with-subword-information) and [2](#bag-of-tricks-for-efficient-text-classification).\n\n### Word representation learning\n\nIn order to learn word vectors, as described in [1](#enriching-word-vectors-with-subword-information), do:\n\n```\n$ .\u002Ffasttext skipgram -input data.txt -output model\n```\n\nwhere `data.txt` is a training file containing `UTF-8` encoded text.\nBy default the word vectors will take into account character n-grams from 3 to 6 characters.\nAt the end of optimization the program will save two files: `model.bin` and `model.vec`.\n`model.vec` is a text file containing the word vectors, one per line.\n`model.bin` is a binary file containing the parameters of the model along with the dictionary and all hyper parameters.\nThe binary file can be used later to compute word vectors or to restart the optimization.\n\n### Obtaining word vectors for out-of-vocabulary words\n\nThe previously trained model can be used to compute word vectors for out-of-vocabulary words.\nProvided you have a text file `queries.txt` containing words for which you want to compute vectors, use the following command:\n\n```\n$ .\u002Ffasttext print-word-vectors model.bin \u003C queries.txt\n```\n\nThis will output word vectors to the standard output, one vector per line.\nThis can also be used with pipes:\n\n```\n$ cat queries.txt | .\u002Ffasttext print-word-vectors model.bin\n```\n\nSee the provided scripts for an example. For instance, running:\n\n```\n$ .\u002Fword-vector-example.sh\n```\n\nwill compile the code, download data, compute word vectors and evaluate them on the rare words similarity dataset RW [Thang et al. 2013].\n\n### Text classification\n\nThis library can also be used to train supervised text classifiers, for instance for sentiment analysis.\nIn order to train a text classifier using the method described in [2](#bag-of-tricks-for-efficient-text-classification), use:\n\n```\n$ .\u002Ffasttext supervised -input train.txt -output model\n```\n\nwhere `train.txt` is a text file containing a training sentence per line along with the labels.\nBy default, we assume that labels are words that are prefixed by the string `__label__`.\nThis will output two files: `model.bin` and `model.vec`.\nOnce the model was trained, you can evaluate it by computing the precision and recall at k (P@k and R@k) on a test set using:\n\n```\n$ .\u002Ffasttext test model.bin test.txt k\n```\n\nThe argument `k` is optional, and is equal to `1` by default.\n\nIn order to obtain the k most likely labels for a piece of text, use:\n\n```\n$ .\u002Ffasttext predict model.bin test.txt k\n```\n\nor use `predict-prob` to also get the probability for each label\n\n```\n$ .\u002Ffasttext predict-prob model.bin test.txt k\n```\n\nwhere `test.txt` contains a piece of text to classify per line.\nDoing so will print to the standard output the k most likely labels for each line.\nThe argument `k` is optional, and equal to `1` by default.\nSee `classification-example.sh` for an example use case.\nIn order to reproduce results from the paper [2](#bag-of-tricks-for-efficient-text-classification), run `classification-results.sh`, this will download all the datasets and reproduce the results from Table 1.\n\nIf you want to compute vector representations of sentences or paragraphs, please use:\n\n```\n$ .\u002Ffasttext print-sentence-vectors model.bin \u003C text.txt\n```\n\nThis assumes that the `text.txt` file contains the paragraphs that you want to get vectors for.\nThe program will output one vector representation per line in the file.\n\nYou can also quantize a supervised model to reduce its memory usage with the following command:\n\n```\n$ .\u002Ffasttext quantize -output model\n```\nThis will create a `.ftz` file with a smaller memory footprint. All the standard functionality, like `test` or `predict` work the same way on the quantized models:\n```\n$ .\u002Ffasttext test model.ftz test.txt\n```\nThe quantization procedure follows the steps described in [3](#fasttextzip-compressing-text-classification-models). You can\nrun the script `quantization-example.sh` for an example.\n\n\n## Full documentation\n\nInvoke a command without arguments to list available arguments and their default values:\n\n```\n$ .\u002Ffasttext supervised\nEmpty input or output path.\n\nThe following arguments are mandatory:\n  -input              training file path\n  -output             output file path\n\nThe following arguments are optional:\n  -verbose            verbosity level [2]\n\nThe following arguments for the dictionary are optional:\n  -minCount           minimal number of word occurrences [1]\n  -minCountLabel      minimal number of label occurrences [0]\n  -wordNgrams         max length of word ngram [1]\n  -bucket             number of buckets [2000000]\n  -minn               min length of char ngram [0]\n  -maxn               max length of char ngram [0]\n  -t                  sampling threshold [0.0001]\n  -label              labels prefix [__label__]\n\nThe following arguments for training are optional:\n  -lr                 learning rate [0.1]\n  -lrUpdateRate       change the rate of updates for the learning rate [100]\n  -dim                size of word vectors [100]\n  -ws                 size of the context window [5]\n  -epoch              number of epochs [5]\n  -neg                number of negatives sampled [5]\n  -loss               loss function {ns, hs, softmax} [softmax]\n  -thread             number of threads [12]\n  -pretrainedVectors  pretrained word vectors for supervised learning []\n  -saveOutput         whether output params should be saved [0]\n\nThe following arguments for quantization are optional:\n  -cutoff             number of words and ngrams to retain [0]\n  -retrain            finetune embeddings if a cutoff is applied [0]\n  -qnorm              quantizing the norm separately [0]\n  -qout               quantizing the classifier [0]\n  -dsub               size of each sub-vector [2]\n```\n\nDefaults may vary by mode. (Word-representation modes `skipgram` and `cbow` use a default `-minCount` of 5.)\n\n## References\n\nPlease cite [1](#enriching-word-vectors-with-subword-information) if using this code for learning word representations or [2](#bag-of-tricks-for-efficient-text-classification) if using for text classification.\n\n### Enriching Word Vectors with Subword Information\n\n[1] P. Bojanowski\\*, E. Grave\\*, A. Joulin, T. Mikolov, [*Enriching Word Vectors with Subword Information*](https:\u002F\u002Farxiv.org\u002Fabs\u002F1607.04606)\n\n```\n@article{bojanowski2017enriching,\n  title={Enriching Word Vectors with Subword Information},\n  author={Bojanowski, Piotr and Grave, Edouard and Joulin, Armand and Mikolov, Tomas},\n  journal={Transactions of the Association for Computational Linguistics},\n  volume={5},\n  year={2017},\n  issn={2307-387X},\n  pages={135--146}\n}\n```\n\n### Bag of Tricks for Efficient Text Classification\n\n[2] A. Joulin, E. Grave, P. Bojanowski, T. Mikolov, [*Bag of Tricks for Efficient Text Classification*](https:\u002F\u002Farxiv.org\u002Fabs\u002F1607.01759)\n\n```\n@InProceedings{joulin2017bag,\n  title={Bag of Tricks for Efficient Text Classification},\n  author={Joulin, Armand and Grave, Edouard and Bojanowski, Piotr and Mikolov, Tomas},\n  booktitle={Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers},\n  month={April},\n  year={2017},\n  publisher={Association for Computational Linguistics},\n  pages={427--431},\n}\n```\n\n### FastText.zip: Compressing text classification models\n\n[3] A. Joulin, E. Grave, P. Bojanowski, M. Douze, H. Jégou, T. Mikolov, [*FastText.zip: Compressing text classification models*](https:\u002F\u002Farxiv.org\u002Fabs\u002F1612.03651)\n\n```\n@article{joulin2016fasttext,\n  title={FastText.zip: Compressing text classification models},\n  author={Joulin, Armand and Grave, Edouard and Bojanowski, Piotr and Douze, Matthijs and J{\\'e}gou, H{\\'e}rve and Mikolov, Tomas},\n  journal={arXiv preprint arXiv:1612.03651},\n  year={2016}\n}\n```\n\n(\\* These authors contributed equally.)\n\n\n## Join the fastText community\n\n* Facebook page: https:\u002F\u002Fwww.facebook.com\u002Fgroups\u002F1174547215919768\n* Google group: https:\u002F\u002Fgroups.google.com\u002Fforum\u002F#!forum\u002Ffasttext-library\n* Contact: [egrave@fb.com](mailto:egrave@fb.com), [bojanowski@fb.com](mailto:bojanowski@fb.com), [ajoulin@fb.com](mailto:ajoulin@fb.com), [tmikolov@fb.com](mailto:tmikolov@fb.com)\n\nSee the CONTRIBUTING file for information about how to help out.\n\n## License\n\nfastText is MIT-licensed.\n","fastText是一个用于高效学习词表示和句子分类的库。它支持多种语言的词向量训练，并能够处理词汇表外词语的词向量获取，同时提供了文本分类的功能。通过利用子词信息，fastText能够在保持高效率的同时提高模型的质量。此外，该项目还开放了包括英语在内的157种语言预训练词向量以及多种监督任务模型。适合需要快速准确地进行自然语言处理、特别是大规模文本数据分类的应用场景使用。",2,"2026-06-11 03:34:44","high_star"]