fasttext 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -1
- data/LICENSE.txt +18 -18
- data/README.md +39 -12
- data/ext/fasttext/ext.cpp +108 -101
- data/ext/fasttext/extconf.rb +7 -9
- data/lib/fasttext.rb +3 -0
- data/lib/fasttext/classifier.rb +25 -7
- data/lib/fasttext/vectorizer.rb +7 -2
- data/lib/fasttext/version.rb +1 -1
- data/vendor/fastText/README.md +3 -3
- data/vendor/fastText/src/args.cc +179 -6
- data/vendor/fastText/src/args.h +29 -1
- data/vendor/fastText/src/autotune.cc +477 -0
- data/vendor/fastText/src/autotune.h +89 -0
- data/vendor/fastText/src/densematrix.cc +27 -7
- data/vendor/fastText/src/densematrix.h +10 -2
- data/vendor/fastText/src/fasttext.cc +125 -114
- data/vendor/fastText/src/fasttext.h +31 -52
- data/vendor/fastText/src/main.cc +32 -13
- data/vendor/fastText/src/meter.cc +148 -2
- data/vendor/fastText/src/meter.h +24 -2
- data/vendor/fastText/src/model.cc +0 -1
- data/vendor/fastText/src/real.h +0 -1
- data/vendor/fastText/src/utils.cc +25 -0
- data/vendor/fastText/src/utils.h +29 -0
- data/vendor/fastText/src/vector.cc +0 -1
- metadata +16 -539
- data/lib/fasttext/ext.bundle +0 -0
- data/vendor/fastText/CMakeLists.txt +0 -68
- data/vendor/fastText/CODE_OF_CONDUCT.md +0 -2
- data/vendor/fastText/CONTRIBUTING.md +0 -32
- data/vendor/fastText/MANIFEST.in +0 -5
- data/vendor/fastText/Makefile +0 -63
- data/vendor/fastText/alignment/README.md +0 -53
- data/vendor/fastText/alignment/align.py +0 -145
- data/vendor/fastText/alignment/eval.py +0 -60
- data/vendor/fastText/alignment/example.sh +0 -51
- data/vendor/fastText/alignment/unsup_align.py +0 -109
- data/vendor/fastText/alignment/utils.py +0 -154
- data/vendor/fastText/classification-example.sh +0 -41
- data/vendor/fastText/classification-results.sh +0 -94
- data/vendor/fastText/crawl/README.md +0 -26
- data/vendor/fastText/crawl/dedup.cc +0 -51
- data/vendor/fastText/crawl/download_crawl.sh +0 -57
- data/vendor/fastText/crawl/filter_dedup.sh +0 -13
- data/vendor/fastText/crawl/filter_utf8.cc +0 -105
- data/vendor/fastText/crawl/process_wet_file.sh +0 -30
- data/vendor/fastText/docs/aligned-vectors.md +0 -64
- data/vendor/fastText/docs/api.md +0 -6
- data/vendor/fastText/docs/cheatsheet.md +0 -66
- data/vendor/fastText/docs/crawl-vectors.md +0 -125
- data/vendor/fastText/docs/dataset.md +0 -6
- data/vendor/fastText/docs/english-vectors.md +0 -53
- data/vendor/fastText/docs/faqs.md +0 -63
- data/vendor/fastText/docs/language-identification.md +0 -47
- data/vendor/fastText/docs/options.md +0 -50
- data/vendor/fastText/docs/pretrained-vectors.md +0 -142
- data/vendor/fastText/docs/python-module.md +0 -314
- data/vendor/fastText/docs/references.md +0 -41
- data/vendor/fastText/docs/supervised-models.md +0 -54
- data/vendor/fastText/docs/supervised-tutorial.md +0 -349
- data/vendor/fastText/docs/support.md +0 -58
- data/vendor/fastText/docs/unsupervised-tutorials.md +0 -309
- data/vendor/fastText/eval.py +0 -95
- data/vendor/fastText/get-wikimedia.sh +0 -79
- data/vendor/fastText/python/README.md +0 -322
- data/vendor/fastText/python/README.rst +0 -406
- data/vendor/fastText/python/benchmarks/README.rst +0 -3
- data/vendor/fastText/python/benchmarks/get_word_vector.py +0 -49
- data/vendor/fastText/python/doc/examples/FastTextEmbeddingBag.py +0 -81
- data/vendor/fastText/python/doc/examples/bin_to_vec.py +0 -41
- data/vendor/fastText/python/doc/examples/compute_accuracy.py +0 -163
- data/vendor/fastText/python/doc/examples/get_vocab.py +0 -48
- data/vendor/fastText/python/doc/examples/train_supervised.py +0 -42
- data/vendor/fastText/python/doc/examples/train_unsupervised.py +0 -56
- data/vendor/fastText/python/fasttext_module/fasttext/FastText.py +0 -468
- data/vendor/fastText/python/fasttext_module/fasttext/__init__.py +0 -22
- data/vendor/fastText/python/fasttext_module/fasttext/pybind/fasttext_pybind.cc +0 -388
- data/vendor/fastText/python/fasttext_module/fasttext/tests/__init__.py +0 -14
- data/vendor/fastText/python/fasttext_module/fasttext/tests/test_configurations.py +0 -239
- data/vendor/fastText/python/fasttext_module/fasttext/tests/test_script.py +0 -629
- data/vendor/fastText/python/fasttext_module/fasttext/util/__init__.py +0 -13
- data/vendor/fastText/python/fasttext_module/fasttext/util/util.py +0 -60
- data/vendor/fastText/quantization-example.sh +0 -40
- data/vendor/fastText/runtests.py +0 -60
- data/vendor/fastText/scripts/kbcompletion/README.md +0 -19
- data/vendor/fastText/scripts/kbcompletion/data.sh +0 -69
- data/vendor/fastText/scripts/kbcompletion/eval.cpp +0 -108
- data/vendor/fastText/scripts/kbcompletion/fb15k.sh +0 -49
- data/vendor/fastText/scripts/kbcompletion/fb15k237.sh +0 -45
- data/vendor/fastText/scripts/kbcompletion/svo.sh +0 -38
- data/vendor/fastText/scripts/kbcompletion/wn18.sh +0 -49
- data/vendor/fastText/scripts/quantization/quantization-results.sh +0 -43
- data/vendor/fastText/setup.cfg +0 -2
- data/vendor/fastText/setup.py +0 -203
- data/vendor/fastText/tests/fetch_test_data.sh +0 -202
- data/vendor/fastText/website/README.md +0 -6
- data/vendor/fastText/website/blog/2016-08-18-blog-post.md +0 -42
- data/vendor/fastText/website/blog/2017-05-02-blog-post.md +0 -60
- data/vendor/fastText/website/blog/2017-10-02-blog-post.md +0 -90
- data/vendor/fastText/website/blog/2019-06-25-blog-post.md +0 -168
- data/vendor/fastText/website/core/Footer.js +0 -127
- data/vendor/fastText/website/package.json +0 -12
- data/vendor/fastText/website/pages/en/index.js +0 -286
- data/vendor/fastText/website/sidebars.json +0 -18
- data/vendor/fastText/website/siteConfig.js +0 -102
- data/vendor/fastText/website/static/docs/en/html/annotated.html +0 -115
- data/vendor/fastText/website/static/docs/en/html/annotated_dup.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/args_8cc.html +0 -113
- data/vendor/fastText/website/static/docs/en/html/args_8h.html +0 -134
- data/vendor/fastText/website/static/docs/en/html/args_8h.js +0 -14
- data/vendor/fastText/website/static/docs/en/html/args_8h_source.html +0 -139
- data/vendor/fastText/website/static/docs/en/html/bc_s.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/bdwn.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/classes.html +0 -121
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Args-members.html +0 -140
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Args.html +0 -753
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Args.js +0 -40
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Dictionary-members.html +0 -148
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Dictionary.html +0 -1266
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Dictionary.js +0 -43
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1FastText-members.html +0 -145
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1FastText.html +0 -1149
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1FastText.js +0 -45
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Matrix-members.html +0 -123
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Matrix.html +0 -610
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Matrix.js +0 -23
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Model-members.html +0 -150
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Model.html +0 -1400
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Model.js +0 -48
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1ProductQuantizer-members.html +0 -131
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1ProductQuantizer.html +0 -950
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1ProductQuantizer.js +0 -31
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1QMatrix-members.html +0 -122
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1QMatrix.html +0 -565
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1QMatrix.js +0 -22
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Vector-members.html +0 -121
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Vector.html +0 -542
- data/vendor/fastText/website/static/docs/en/html/classfasttext_1_1Vector.js +0 -21
- data/vendor/fastText/website/static/docs/en/html/closed.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/dictionary_8cc.html +0 -116
- data/vendor/fastText/website/static/docs/en/html/dictionary_8h.html +0 -142
- data/vendor/fastText/website/static/docs/en/html/dictionary_8h.js +0 -10
- data/vendor/fastText/website/static/docs/en/html/dictionary_8h_source.html +0 -127
- data/vendor/fastText/website/static/docs/en/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +0 -145
- data/vendor/fastText/website/static/docs/en/html/dir_68267d1309a1af8e8297ef4c3efbcdba.js +0 -29
- data/vendor/fastText/website/static/docs/en/html/doc.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/doxygen.css +0 -1596
- data/vendor/fastText/website/static/docs/en/html/doxygen.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/dynsections.js +0 -97
- data/vendor/fastText/website/static/docs/en/html/fasttext_8cc.html +0 -119
- data/vendor/fastText/website/static/docs/en/html/fasttext_8h.html +0 -168
- data/vendor/fastText/website/static/docs/en/html/fasttext_8h.js +0 -6
- data/vendor/fastText/website/static/docs/en/html/fasttext_8h_source.html +0 -155
- data/vendor/fastText/website/static/docs/en/html/favicon.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/files.html +0 -125
- data/vendor/fastText/website/static/docs/en/html/files.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/folderclosed.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/folderopen.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/functions.html +0 -139
- data/vendor/fastText/website/static/docs/en/html/functions_0x7e.html +0 -112
- data/vendor/fastText/website/static/docs/en/html/functions_b.html +0 -115
- data/vendor/fastText/website/static/docs/en/html/functions_c.html +0 -143
- data/vendor/fastText/website/static/docs/en/html/functions_d.html +0 -135
- data/vendor/fastText/website/static/docs/en/html/functions_dup.js +0 -27
- data/vendor/fastText/website/static/docs/en/html/functions_e.html +0 -115
- data/vendor/fastText/website/static/docs/en/html/functions_f.html +0 -112
- data/vendor/fastText/website/static/docs/en/html/functions_func.html +0 -563
- data/vendor/fastText/website/static/docs/en/html/functions_g.html +0 -145
- data/vendor/fastText/website/static/docs/en/html/functions_h.html +0 -112
- data/vendor/fastText/website/static/docs/en/html/functions_i.html +0 -121
- data/vendor/fastText/website/static/docs/en/html/functions_k.html +0 -106
- data/vendor/fastText/website/static/docs/en/html/functions_l.html +0 -140
- data/vendor/fastText/website/static/docs/en/html/functions_m.html +0 -153
- data/vendor/fastText/website/static/docs/en/html/functions_n.html +0 -164
- data/vendor/fastText/website/static/docs/en/html/functions_o.html +0 -116
- data/vendor/fastText/website/static/docs/en/html/functions_p.html +0 -161
- data/vendor/fastText/website/static/docs/en/html/functions_q.html +0 -135
- data/vendor/fastText/website/static/docs/en/html/functions_r.html +0 -116
- data/vendor/fastText/website/static/docs/en/html/functions_s.html +0 -159
- data/vendor/fastText/website/static/docs/en/html/functions_t.html +0 -138
- data/vendor/fastText/website/static/docs/en/html/functions_u.html +0 -106
- data/vendor/fastText/website/static/docs/en/html/functions_v.html +0 -106
- data/vendor/fastText/website/static/docs/en/html/functions_vars.html +0 -486
- data/vendor/fastText/website/static/docs/en/html/functions_w.html +0 -124
- data/vendor/fastText/website/static/docs/en/html/functions_z.html +0 -104
- data/vendor/fastText/website/static/docs/en/html/globals.html +0 -170
- data/vendor/fastText/website/static/docs/en/html/globals_defs.html +0 -113
- data/vendor/fastText/website/static/docs/en/html/globals_func.html +0 -155
- data/vendor/fastText/website/static/docs/en/html/index.html +0 -100
- data/vendor/fastText/website/static/docs/en/html/jquery.js +0 -87
- data/vendor/fastText/website/static/docs/en/html/main_8cc.html +0 -582
- data/vendor/fastText/website/static/docs/en/html/main_8cc.js +0 -22
- data/vendor/fastText/website/static/docs/en/html/matrix_8cc.html +0 -114
- data/vendor/fastText/website/static/docs/en/html/matrix_8h.html +0 -121
- data/vendor/fastText/website/static/docs/en/html/matrix_8h_source.html +0 -123
- data/vendor/fastText/website/static/docs/en/html/menu.js +0 -26
- data/vendor/fastText/website/static/docs/en/html/menudata.js +0 -90
- data/vendor/fastText/website/static/docs/en/html/model_8cc.html +0 -113
- data/vendor/fastText/website/static/docs/en/html/model_8h.html +0 -183
- data/vendor/fastText/website/static/docs/en/html/model_8h.js +0 -8
- data/vendor/fastText/website/static/docs/en/html/model_8h_source.html +0 -139
- data/vendor/fastText/website/static/docs/en/html/namespacefasttext.html +0 -343
- data/vendor/fastText/website/static/docs/en/html/namespacefasttext.js +0 -13
- data/vendor/fastText/website/static/docs/en/html/namespacefasttext_1_1utils.html +0 -158
- data/vendor/fastText/website/static/docs/en/html/namespacemembers.html +0 -125
- data/vendor/fastText/website/static/docs/en/html/namespacemembers_enum.html +0 -107
- data/vendor/fastText/website/static/docs/en/html/namespacemembers_func.html +0 -110
- data/vendor/fastText/website/static/docs/en/html/namespacemembers_type.html +0 -104
- data/vendor/fastText/website/static/docs/en/html/namespaces.html +0 -106
- data/vendor/fastText/website/static/docs/en/html/namespaces.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/nav_f.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/nav_g.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/nav_h.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/navtree.css +0 -146
- data/vendor/fastText/website/static/docs/en/html/navtree.js +0 -517
- data/vendor/fastText/website/static/docs/en/html/navtreedata.js +0 -40
- data/vendor/fastText/website/static/docs/en/html/navtreeindex0.js +0 -253
- data/vendor/fastText/website/static/docs/en/html/navtreeindex1.js +0 -139
- data/vendor/fastText/website/static/docs/en/html/open.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/productquantizer_8cc.html +0 -118
- data/vendor/fastText/website/static/docs/en/html/productquantizer_8cc.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/productquantizer_8h.html +0 -124
- data/vendor/fastText/website/static/docs/en/html/productquantizer_8h_source.html +0 -133
- data/vendor/fastText/website/static/docs/en/html/qmatrix_8cc.html +0 -112
- data/vendor/fastText/website/static/docs/en/html/qmatrix_8h.html +0 -126
- data/vendor/fastText/website/static/docs/en/html/qmatrix_8h_source.html +0 -128
- data/vendor/fastText/website/static/docs/en/html/real_8h.html +0 -117
- data/vendor/fastText/website/static/docs/en/html/real_8h.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/real_8h_source.html +0 -103
- data/vendor/fastText/website/static/docs/en/html/resize.js +0 -114
- data/vendor/fastText/website/static/docs/en/html/search/all_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_0.js +0 -17
- data/vendor/fastText/website/static/docs/en/html/search/all_1.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_1.js +0 -8
- data/vendor/fastText/website/static/docs/en/html/search/all_10.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_10.js +0 -10
- data/vendor/fastText/website/static/docs/en/html/search/all_11.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_11.js +0 -25
- data/vendor/fastText/website/static/docs/en/html/search/all_12.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_12.js +0 -15
- data/vendor/fastText/website/static/docs/en/html/search/all_13.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_13.js +0 -7
- data/vendor/fastText/website/static/docs/en/html/search/all_14.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_14.js +0 -7
- data/vendor/fastText/website/static/docs/en/html/search/all_15.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_15.js +0 -11
- data/vendor/fastText/website/static/docs/en/html/search/all_16.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_16.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/all_17.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_17.js +0 -7
- data/vendor/fastText/website/static/docs/en/html/search/all_2.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_2.js +0 -17
- data/vendor/fastText/website/static/docs/en/html/search/all_3.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_3.js +0 -17
- data/vendor/fastText/website/static/docs/en/html/search/all_4.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_4.js +0 -10
- data/vendor/fastText/website/static/docs/en/html/search/all_5.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_5.js +0 -12
- data/vendor/fastText/website/static/docs/en/html/search/all_6.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_6.js +0 -18
- data/vendor/fastText/website/static/docs/en/html/search/all_7.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_7.js +0 -8
- data/vendor/fastText/website/static/docs/en/html/search/all_8.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_8.js +0 -11
- data/vendor/fastText/website/static/docs/en/html/search/all_9.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_9.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/all_a.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_a.js +0 -17
- data/vendor/fastText/website/static/docs/en/html/search/all_b.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_b.js +0 -27
- data/vendor/fastText/website/static/docs/en/html/search/all_c.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_c.js +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_d.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_d.js +0 -9
- data/vendor/fastText/website/static/docs/en/html/search/all_e.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_e.js +0 -35
- data/vendor/fastText/website/static/docs/en/html/search/all_f.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/all_f.js +0 -16
- data/vendor/fastText/website/static/docs/en/html/search/classes_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/classes_0.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/classes_1.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/classes_1.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/classes_2.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/classes_2.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/classes_3.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/classes_3.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/classes_4.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/classes_4.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/classes_5.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/classes_5.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/classes_6.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/classes_6.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/classes_7.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/classes_7.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/classes_8.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/classes_8.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/close.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/search/defines_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/defines_0.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/defines_1.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/defines_1.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/defines_2.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/defines_2.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/defines_3.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/defines_3.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/enums_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/enums_0.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/enums_1.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/enums_1.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/enums_2.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/enums_2.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_0.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_1.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_1.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_2.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_2.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_3.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_3.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_4.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_4.js +0 -6
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_5.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/enumvalues_5.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/files_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/files_0.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/files_1.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/files_1.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/files_2.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/files_2.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/files_3.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/files_3.js +0 -8
- data/vendor/fastText/website/static/docs/en/html/search/files_4.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/files_4.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/files_5.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/files_5.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/files_6.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/files_6.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/files_7.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/files_7.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/files_8.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/files_8.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/functions_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_0.js +0 -14
- data/vendor/fastText/website/static/docs/en/html/search/functions_1.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_1.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/functions_10.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_10.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/functions_11.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_11.js +0 -18
- data/vendor/fastText/website/static/docs/en/html/search/functions_12.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_12.js +0 -8
- data/vendor/fastText/website/static/docs/en/html/search/functions_13.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_13.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/functions_14.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_14.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/functions_15.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_15.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/functions_16.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_16.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/functions_17.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_17.js +0 -7
- data/vendor/fastText/website/static/docs/en/html/search/functions_2.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_2.js +0 -11
- data/vendor/fastText/website/static/docs/en/html/search/functions_3.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_3.js +0 -9
- data/vendor/fastText/website/static/docs/en/html/search/functions_4.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_4.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/functions_5.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_5.js +0 -7
- data/vendor/fastText/website/static/docs/en/html/search/functions_6.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_6.js +0 -17
- data/vendor/fastText/website/static/docs/en/html/search/functions_7.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_7.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/functions_8.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_8.js +0 -8
- data/vendor/fastText/website/static/docs/en/html/search/functions_9.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_9.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/functions_a.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_a.js +0 -8
- data/vendor/fastText/website/static/docs/en/html/search/functions_b.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_b.js +0 -10
- data/vendor/fastText/website/static/docs/en/html/search/functions_c.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_c.js +0 -10
- data/vendor/fastText/website/static/docs/en/html/search/functions_d.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_d.js +0 -6
- data/vendor/fastText/website/static/docs/en/html/search/functions_e.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_e.js +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_f.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/functions_f.js +0 -6
- data/vendor/fastText/website/static/docs/en/html/search/mag_sel.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/search/namespaces_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/namespaces_0.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/nomatches.html +0 -12
- data/vendor/fastText/website/static/docs/en/html/search/search.css +0 -271
- data/vendor/fastText/website/static/docs/en/html/search/search.js +0 -791
- data/vendor/fastText/website/static/docs/en/html/search/search_l.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/search/search_m.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/search/search_r.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/search/searchdata.js +0 -42
- data/vendor/fastText/website/static/docs/en/html/search/typedefs_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/typedefs_0.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/typedefs_1.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/typedefs_1.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/variables_0.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_0.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/variables_1.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_1.js +0 -6
- data/vendor/fastText/website/static/docs/en/html/search/variables_10.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_10.js +0 -8
- data/vendor/fastText/website/static/docs/en/html/search/variables_11.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_11.js +0 -11
- data/vendor/fastText/website/static/docs/en/html/search/variables_12.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_12.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/variables_13.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_13.js +0 -10
- data/vendor/fastText/website/static/docs/en/html/search/variables_2.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_2.js +0 -9
- data/vendor/fastText/website/static/docs/en/html/search/variables_3.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_3.js +0 -9
- data/vendor/fastText/website/static/docs/en/html/search/variables_4.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_4.js +0 -7
- data/vendor/fastText/website/static/docs/en/html/search/variables_5.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_5.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/variables_6.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_6.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/variables_7.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_7.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/search/variables_8.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_8.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/search/variables_9.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_9.js +0 -10
- data/vendor/fastText/website/static/docs/en/html/search/variables_a.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_a.js +0 -14
- data/vendor/fastText/website/static/docs/en/html/search/variables_b.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_b.js +0 -17
- data/vendor/fastText/website/static/docs/en/html/search/variables_c.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_c.js +0 -6
- data/vendor/fastText/website/static/docs/en/html/search/variables_d.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_d.js +0 -10
- data/vendor/fastText/website/static/docs/en/html/search/variables_e.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_e.js +0 -11
- data/vendor/fastText/website/static/docs/en/html/search/variables_f.html +0 -26
- data/vendor/fastText/website/static/docs/en/html/search/variables_f.js +0 -6
- data/vendor/fastText/website/static/docs/en/html/splitbar.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/structfasttext_1_1Node-members.html +0 -108
- data/vendor/fastText/website/static/docs/en/html/structfasttext_1_1Node.html +0 -194
- data/vendor/fastText/website/static/docs/en/html/structfasttext_1_1Node.js +0 -8
- data/vendor/fastText/website/static/docs/en/html/structfasttext_1_1entry-members.html +0 -107
- data/vendor/fastText/website/static/docs/en/html/structfasttext_1_1entry.html +0 -178
- data/vendor/fastText/website/static/docs/en/html/structfasttext_1_1entry.js +0 -7
- data/vendor/fastText/website/static/docs/en/html/sync_off.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/sync_on.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/tab_a.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/tab_b.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/tab_h.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/tab_s.png +0 -0
- data/vendor/fastText/website/static/docs/en/html/tabs.css +0 -1
- data/vendor/fastText/website/static/docs/en/html/utils_8cc.html +0 -121
- data/vendor/fastText/website/static/docs/en/html/utils_8cc.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/utils_8h.html +0 -122
- data/vendor/fastText/website/static/docs/en/html/utils_8h.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/utils_8h_source.html +0 -104
- data/vendor/fastText/website/static/docs/en/html/vector_8cc.html +0 -121
- data/vendor/fastText/website/static/docs/en/html/vector_8cc.js +0 -4
- data/vendor/fastText/website/static/docs/en/html/vector_8h.html +0 -126
- data/vendor/fastText/website/static/docs/en/html/vector_8h.js +0 -5
- data/vendor/fastText/website/static/docs/en/html/vector_8h_source.html +0 -120
- data/vendor/fastText/website/static/fasttext.css +0 -48
- data/vendor/fastText/website/static/img/authors/armand_joulin.jpg +0 -0
- data/vendor/fastText/website/static/img/authors/christian_puhrsch.png +0 -0
- data/vendor/fastText/website/static/img/authors/edouard_grave.jpeg +0 -0
- data/vendor/fastText/website/static/img/authors/piotr_bojanowski.jpg +0 -0
- data/vendor/fastText/website/static/img/authors/tomas_mikolov.jpg +0 -0
- data/vendor/fastText/website/static/img/blog/2016-08-18-blog-post-img1.png +0 -0
- data/vendor/fastText/website/static/img/blog/2016-08-18-blog-post-img2.png +0 -0
- data/vendor/fastText/website/static/img/blog/2017-05-02-blog-post-img1.jpg +0 -0
- data/vendor/fastText/website/static/img/blog/2017-05-02-blog-post-img2.jpg +0 -0
- data/vendor/fastText/website/static/img/blog/2017-10-02-blog-post-img1.png +0 -0
- data/vendor/fastText/website/static/img/cbo_vs_skipgram.png +0 -0
- data/vendor/fastText/website/static/img/fasttext-icon-api.png +0 -0
- data/vendor/fastText/website/static/img/fasttext-icon-bg-web.png +0 -0
- data/vendor/fastText/website/static/img/fasttext-icon-color-square.png +0 -0
- data/vendor/fastText/website/static/img/fasttext-icon-color-web.png +0 -0
- data/vendor/fastText/website/static/img/fasttext-icon-faq.png +0 -0
- data/vendor/fastText/website/static/img/fasttext-icon-tutorial.png +0 -0
- data/vendor/fastText/website/static/img/fasttext-icon-white-web.png +0 -0
- data/vendor/fastText/website/static/img/fasttext-logo-color-web.png +0 -0
- data/vendor/fastText/website/static/img/fasttext-logo-white-web.png +0 -0
- data/vendor/fastText/website/static/img/logo-color.png +0 -0
- data/vendor/fastText/website/static/img/model-black.png +0 -0
- data/vendor/fastText/website/static/img/model-blue.png +0 -0
- data/vendor/fastText/website/static/img/model-red.png +0 -0
- data/vendor/fastText/website/static/img/ogimage.png +0 -0
- data/vendor/fastText/website/static/img/oss_logo.png +0 -0
- data/vendor/fastText/wikifil.pl +0 -57
- data/vendor/fastText/word-vector-example.sh +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 597a9c73a6720397b11fb9bd0492c33ed458783747d904deef74618a6f319133
|
4
|
+
data.tar.gz: b03ab1e051cda71fafc499dbf0847d3da1c27050646e949eac148a5548460054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 844ae824ad06aa270a5c58b6dc109701660b2bb0e5bfe63e285df57bc5db854028703c1c0476a845d5b0e8c32dd02ac42e1c8b1c5c0684713928c895c776b1da
|
7
|
+
data.tar.gz: 7f7a07f0041981eb046e84f6b44f4207192eb9e8a786edf41b53ae15b370eb875f5b4d578248c90a371805697ad3f0fa076532d1f6789c44d336d72402a54333
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
-
## 0.1
|
1
|
+
## 0.2.1 (2021-05-23)
|
2
|
+
|
3
|
+
- Improved performance
|
4
|
+
|
5
|
+
## 0.2.0 (2021-05-17)
|
6
|
+
|
7
|
+
- Updated to Rice 4
|
8
|
+
- Dropped support for Ruby < 2.6
|
9
|
+
|
10
|
+
## 0.1.3 (2020-04-28)
|
11
|
+
|
12
|
+
- Updated fastText to 0.9.2
|
13
|
+
- Added support for autotune
|
14
|
+
- Added `--with-optflags` option
|
15
|
+
|
16
|
+
## 0.1.2 (2020-01-10)
|
17
|
+
|
18
|
+
- Fixed installation error with Ruby 2.7
|
19
|
+
|
20
|
+
## 0.1.1 (2019-10-26)
|
21
|
+
|
22
|
+
- Fixed installation
|
23
|
+
- Reduced gem size
|
24
|
+
- Added support for multiple documents to `predict` method
|
25
|
+
|
26
|
+
## 0.1.0 (2019-10-26)
|
2
27
|
|
3
28
|
- First release
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
Copyright (c) 2019 Andrew Kane
|
2
|
-
|
3
1
|
MIT License
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
Copyright (c) 2016-present, Facebook, Inc.
|
4
|
+
Copyright (c) 2019-2021 Andrew Kane
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
12
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
14
|
+
copies or substantial portions of the Software.
|
15
15
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
OF
|
22
|
-
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
[fastText](https://fasttext.cc) - efficient text classification and representation learning - for Ruby
|
4
4
|
|
5
|
+
[![Build Status](https://github.com/ankane/fastText/workflows/build/badge.svg?branch=master)](https://github.com/ankane/fastText/actions)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application’s Gemfile:
|
@@ -10,6 +12,13 @@ Add this line to your application’s Gemfile:
|
|
10
12
|
gem 'fasttext'
|
11
13
|
```
|
12
14
|
|
15
|
+
## Getting Started
|
16
|
+
|
17
|
+
fastText has two primary use cases:
|
18
|
+
|
19
|
+
- [text classification](#text-classification)
|
20
|
+
- [word representations](#word-representations)
|
21
|
+
|
13
22
|
## Text Classification
|
14
23
|
|
15
24
|
Prep your data
|
@@ -68,6 +77,12 @@ model.labels
|
|
68
77
|
|
69
78
|
> Use `include_freq: true` to get their frequency
|
70
79
|
|
80
|
+
Search for the best hyperparameters
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
model.fit(x, y, autotune_set: [x_valid, y_valid])
|
84
|
+
```
|
85
|
+
|
71
86
|
Compress the model - significantly reduces size but sacrifices a little performance
|
72
87
|
|
73
88
|
```ruby
|
@@ -112,6 +127,12 @@ Get a word vector
|
|
112
127
|
model.word_vector("carrot")
|
113
128
|
```
|
114
129
|
|
130
|
+
Get a sentence vector
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
model.sentence_vector("sentence text")
|
134
|
+
```
|
135
|
+
|
115
136
|
Get words
|
116
137
|
|
117
138
|
```ruby
|
@@ -157,9 +178,13 @@ FastText::Classifier.new(
|
|
157
178
|
thread: 3, # number of threads
|
158
179
|
lr_update_rate: 100, # change the rate of updates for the learning rate
|
159
180
|
t: 0.0001, # sampling threshold
|
160
|
-
label_prefix: "__label__"
|
181
|
+
label_prefix: "__label__", # label prefix
|
161
182
|
verbose: 2, # verbose
|
162
|
-
pretrained_vectors: nil
|
183
|
+
pretrained_vectors: nil, # pretrained word vectors (.vec file)
|
184
|
+
autotune_metric: "f1", # autotune optimization metric
|
185
|
+
autotune_predictions: 1, # autotune predictions
|
186
|
+
autotune_duration: 300, # autotune search time in seconds
|
187
|
+
autotune_model_size: nil # autotune model size, like 2M
|
163
188
|
)
|
164
189
|
```
|
165
190
|
|
@@ -191,7 +216,7 @@ FastText::Vectorizer.new(
|
|
191
216
|
Input can be read directly from files
|
192
217
|
|
193
218
|
```ruby
|
194
|
-
model.fit("train.txt")
|
219
|
+
model.fit("train.txt", autotune_set: "valid.txt")
|
195
220
|
model.test("test.txt")
|
196
221
|
```
|
197
222
|
|
@@ -213,7 +238,7 @@ __label__spam text from document three
|
|
213
238
|
|
214
239
|
## Pretrained Models
|
215
240
|
|
216
|
-
There are a number of [pretrained models](https://fasttext.cc/docs/en/
|
241
|
+
There are a number of [pretrained models](https://fasttext.cc/docs/en/supervised-models.html) you can download
|
217
242
|
|
218
243
|
### Language Identification
|
219
244
|
|
@@ -229,14 +254,6 @@ Get language predictions
|
|
229
254
|
model.predict("bon appétit")
|
230
255
|
```
|
231
256
|
|
232
|
-
## rbenv
|
233
|
-
|
234
|
-
This library uses [Rice](https://github.com/jasonroelofs/rice) to interface with the fastText C++ library. Unfortunately, Rice and rbenv don’t play nicely together. This is actively [being addressed](https://github.com/rbenv/ruby-build/pull/1368), but in the meantime, if you encounter an error during installation, reinstall your Ruby version with the `--enabled-shared` flag.
|
235
|
-
|
236
|
-
```sh
|
237
|
-
CONFIGURE_OPTS="--enable-shared" rbenv install 2.6.5
|
238
|
-
```
|
239
|
-
|
240
257
|
## History
|
241
258
|
|
242
259
|
View the [changelog](https://github.com/ankane/fasttext/blob/master/CHANGELOG.md)
|
@@ -249,3 +266,13 @@ Everyone is encouraged to help improve this project. Here are a few ways you can
|
|
249
266
|
- Fix bugs and [submit pull requests](https://github.com/ankane/fasttext/pulls)
|
250
267
|
- Write, clarify, or fix documentation
|
251
268
|
- Suggest or add new features
|
269
|
+
|
270
|
+
To get started with development:
|
271
|
+
|
272
|
+
```sh
|
273
|
+
git clone --recursive https://github.com/ankane/fastText.git
|
274
|
+
cd fastText
|
275
|
+
bundle install
|
276
|
+
bundle exec rake compile
|
277
|
+
bundle exec rake test
|
278
|
+
```
|
data/ext/fasttext/ext.cpp
CHANGED
@@ -1,97 +1,84 @@
|
|
1
|
+
// stdlib
|
2
|
+
#include <cmath>
|
3
|
+
#include <iterator>
|
4
|
+
#include <sstream>
|
5
|
+
#include <stdexcept>
|
6
|
+
|
7
|
+
// fasttext
|
1
8
|
#include <args.h>
|
9
|
+
#include <autotune.h>
|
2
10
|
#include <densematrix.h>
|
3
11
|
#include <fasttext.h>
|
4
|
-
#include <rice/Data_Type.hpp>
|
5
|
-
#include <rice/Constructor.hpp>
|
6
|
-
#include <rice/Array.hpp>
|
7
|
-
#include <rice/Hash.hpp>
|
8
12
|
#include <real.h>
|
9
13
|
#include <vector.h>
|
10
|
-
#include <cmath>
|
11
|
-
#include <iterator>
|
12
|
-
#include <sstream>
|
13
|
-
#include <stdexcept>
|
14
14
|
|
15
|
-
|
15
|
+
// rice
|
16
|
+
#include <rice/rice.hpp>
|
17
|
+
#include <rice/stl.hpp>
|
16
18
|
|
17
|
-
|
18
|
-
inline
|
19
|
-
long long from_ruby<long long>(Object x)
|
20
|
-
{
|
21
|
-
return NUM2LL(x);
|
22
|
-
}
|
19
|
+
using fasttext::FastText;
|
23
20
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
using Rice::Array;
|
22
|
+
using Rice::Constructor;
|
23
|
+
using Rice::Hash;
|
24
|
+
using Rice::Module;
|
25
|
+
using Rice::Object;
|
26
|
+
using Rice::define_class_under;
|
27
|
+
using Rice::define_module;
|
28
|
+
using Rice::define_module_under;
|
30
29
|
|
31
|
-
|
32
|
-
inline
|
33
|
-
unsigned long long from_ruby<unsigned long long>(Object x)
|
30
|
+
namespace Rice::detail
|
34
31
|
{
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
Array a;
|
52
|
-
a.push(v.first);
|
53
|
-
a.push(v.second);
|
54
|
-
ret.push(a);
|
55
|
-
}
|
56
|
-
return ret;
|
32
|
+
template<>
|
33
|
+
class To_Ruby<std::vector<std::pair<fasttext::real, std::string>>>
|
34
|
+
{
|
35
|
+
public:
|
36
|
+
VALUE convert(std::vector<std::pair<fasttext::real, std::string>> const & x)
|
37
|
+
{
|
38
|
+
Array ret;
|
39
|
+
for (const auto& v : x) {
|
40
|
+
Array a;
|
41
|
+
a.push(v.first);
|
42
|
+
a.push(v.second);
|
43
|
+
ret.push(a);
|
44
|
+
}
|
45
|
+
return ret;
|
46
|
+
}
|
47
|
+
};
|
57
48
|
}
|
58
49
|
|
59
50
|
fasttext::Args buildArgs(Hash h) {
|
60
51
|
fasttext::Args a;
|
61
52
|
|
62
|
-
|
63
|
-
Hash::iterator it = h.begin();
|
64
|
-
Hash::iterator end = h.end();
|
65
|
-
|
66
|
-
for(; it != end; ++it)
|
53
|
+
for (const auto& it : h)
|
67
54
|
{
|
68
|
-
|
69
|
-
|
55
|
+
auto name = it.key.to_s().str();
|
56
|
+
auto value = (it.value).value();
|
70
57
|
|
71
58
|
if (name == "input") {
|
72
|
-
a.input =
|
59
|
+
a.input = Rice::detail::From_Ruby<std::string>().convert(value);
|
73
60
|
} else if (name == "output") {
|
74
|
-
a.output =
|
61
|
+
a.output = Rice::detail::From_Ruby<std::string>().convert(value);
|
75
62
|
} else if (name == "lr") {
|
76
|
-
a.lr =
|
63
|
+
a.lr = Rice::detail::From_Ruby<double>().convert(value);
|
77
64
|
} else if (name == "lr_update_rate") {
|
78
|
-
a.lrUpdateRate =
|
65
|
+
a.lrUpdateRate = Rice::detail::From_Ruby<int>().convert(value);
|
79
66
|
} else if (name == "dim") {
|
80
|
-
a.dim =
|
67
|
+
a.dim = Rice::detail::From_Ruby<int>().convert(value);
|
81
68
|
} else if (name == "ws") {
|
82
|
-
a.ws =
|
69
|
+
a.ws = Rice::detail::From_Ruby<int>().convert(value);
|
83
70
|
} else if (name == "epoch") {
|
84
|
-
a.epoch =
|
71
|
+
a.epoch = Rice::detail::From_Ruby<int>().convert(value);
|
85
72
|
} else if (name == "min_count") {
|
86
|
-
a.minCount =
|
73
|
+
a.minCount = Rice::detail::From_Ruby<int>().convert(value);
|
87
74
|
} else if (name == "min_count_label") {
|
88
|
-
a.minCountLabel =
|
75
|
+
a.minCountLabel = Rice::detail::From_Ruby<int>().convert(value);
|
89
76
|
} else if (name == "neg") {
|
90
|
-
a.neg =
|
77
|
+
a.neg = Rice::detail::From_Ruby<int>().convert(value);
|
91
78
|
} else if (name == "word_ngrams") {
|
92
|
-
a.wordNgrams =
|
79
|
+
a.wordNgrams = Rice::detail::From_Ruby<int>().convert(value);
|
93
80
|
} else if (name == "loss") {
|
94
|
-
std::string str =
|
81
|
+
std::string str = Rice::detail::From_Ruby<std::string>().convert(value);
|
95
82
|
if (str == "softmax") {
|
96
83
|
a.loss = fasttext::loss_name::softmax;
|
97
84
|
} else if (str == "ns") {
|
@@ -104,7 +91,7 @@ fasttext::Args buildArgs(Hash h) {
|
|
104
91
|
throw std::invalid_argument("Unknown loss: " + str);
|
105
92
|
}
|
106
93
|
} else if (name == "model") {
|
107
|
-
std::string str =
|
94
|
+
std::string str = Rice::detail::From_Ruby<std::string>().convert(value);
|
108
95
|
if (str == "supervised") {
|
109
96
|
a.model = fasttext::model_name::sup;
|
110
97
|
} else if (str == "skipgram") {
|
@@ -115,25 +102,35 @@ fasttext::Args buildArgs(Hash h) {
|
|
115
102
|
throw std::invalid_argument("Unknown model: " + str);
|
116
103
|
}
|
117
104
|
} else if (name == "bucket") {
|
118
|
-
a.bucket =
|
105
|
+
a.bucket = Rice::detail::From_Ruby<int>().convert(value);
|
119
106
|
} else if (name == "minn") {
|
120
|
-
a.minn =
|
107
|
+
a.minn = Rice::detail::From_Ruby<int>().convert(value);
|
121
108
|
} else if (name == "maxn") {
|
122
|
-
a.maxn =
|
109
|
+
a.maxn = Rice::detail::From_Ruby<int>().convert(value);
|
123
110
|
} else if (name == "thread") {
|
124
|
-
a.thread =
|
111
|
+
a.thread = Rice::detail::From_Ruby<int>().convert(value);
|
125
112
|
} else if (name == "t") {
|
126
|
-
a.t =
|
113
|
+
a.t = Rice::detail::From_Ruby<double>().convert(value);
|
127
114
|
} else if (name == "label_prefix") {
|
128
|
-
a.label =
|
115
|
+
a.label = Rice::detail::From_Ruby<std::string>().convert(value);
|
129
116
|
} else if (name == "verbose") {
|
130
|
-
a.verbose =
|
117
|
+
a.verbose = Rice::detail::From_Ruby<int>().convert(value);
|
131
118
|
} else if (name == "pretrained_vectors") {
|
132
|
-
a.pretrainedVectors =
|
119
|
+
a.pretrainedVectors = Rice::detail::From_Ruby<std::string>().convert(value);
|
133
120
|
} else if (name == "save_output") {
|
134
|
-
a.saveOutput =
|
135
|
-
|
136
|
-
|
121
|
+
a.saveOutput = Rice::detail::From_Ruby<bool>().convert(value);
|
122
|
+
} else if (name == "seed") {
|
123
|
+
a.seed = Rice::detail::From_Ruby<int>().convert(value);
|
124
|
+
} else if (name == "autotune_validation_file") {
|
125
|
+
a.autotuneValidationFile = Rice::detail::From_Ruby<std::string>().convert(value);
|
126
|
+
} else if (name == "autotune_metric") {
|
127
|
+
a.autotuneMetric = Rice::detail::From_Ruby<std::string>().convert(value);
|
128
|
+
} else if (name == "autotune_predictions") {
|
129
|
+
a.autotunePredictions = Rice::detail::From_Ruby<int>().convert(value);
|
130
|
+
} else if (name == "autotune_duration") {
|
131
|
+
a.autotuneDuration = Rice::detail::From_Ruby<int>().convert(value);
|
132
|
+
} else if (name == "autotune_model_size") {
|
133
|
+
a.autotuneModelSize = Rice::detail::From_Ruby<std::string>().convert(value);
|
137
134
|
} else {
|
138
135
|
throw std::invalid_argument("Unknown argument: " + name);
|
139
136
|
}
|
@@ -147,11 +144,11 @@ void Init_ext()
|
|
147
144
|
Module rb_mFastText = define_module("FastText");
|
148
145
|
Module rb_mExt = define_module_under(rb_mFastText, "Ext");
|
149
146
|
|
150
|
-
define_class_under<
|
151
|
-
.define_constructor(Constructor<
|
147
|
+
define_class_under<FastText>(rb_mExt, "Model")
|
148
|
+
.define_constructor(Constructor<FastText>())
|
152
149
|
.define_method(
|
153
150
|
"words",
|
154
|
-
|
151
|
+
[](FastText& m) {
|
155
152
|
std::shared_ptr<const fasttext::Dictionary> d = m.getDictionary();
|
156
153
|
std::vector<int64_t> freq = d->getCounts(fasttext::entry_type::word);
|
157
154
|
|
@@ -169,7 +166,7 @@ void Init_ext()
|
|
169
166
|
})
|
170
167
|
.define_method(
|
171
168
|
"labels",
|
172
|
-
|
169
|
+
[](FastText& m) {
|
173
170
|
std::shared_ptr<const fasttext::Dictionary> d = m.getDictionary();
|
174
171
|
std::vector<int64_t> freq = d->getCounts(fasttext::entry_type::label);
|
175
172
|
|
@@ -187,12 +184,12 @@ void Init_ext()
|
|
187
184
|
})
|
188
185
|
.define_method(
|
189
186
|
"test",
|
190
|
-
|
187
|
+
[](FastText& m, const std::string& filename, int32_t k) {
|
191
188
|
std::ifstream ifs(filename);
|
192
189
|
if (!ifs.is_open()) {
|
193
190
|
throw std::invalid_argument("Test file cannot be opened!");
|
194
191
|
}
|
195
|
-
fasttext::Meter meter;
|
192
|
+
fasttext::Meter meter(false);
|
196
193
|
m.test(ifs, k, 0.0, meter);
|
197
194
|
ifs.close();
|
198
195
|
|
@@ -204,17 +201,21 @@ void Init_ext()
|
|
204
201
|
})
|
205
202
|
.define_method(
|
206
203
|
"load_model",
|
207
|
-
|
204
|
+
[](FastText& m, const std::string& s) {
|
205
|
+
m.loadModel(s);
|
206
|
+
})
|
208
207
|
.define_method(
|
209
208
|
"save_model",
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
.define_method("
|
214
|
-
.define_method("
|
209
|
+
[](FastText& m, const std::string& s) {
|
210
|
+
m.saveModel(s);
|
211
|
+
})
|
212
|
+
.define_method("dimension", &FastText::getDimension)
|
213
|
+
.define_method("quantized?", &FastText::isQuant)
|
214
|
+
.define_method("word_id", &FastText::getWordId)
|
215
|
+
.define_method("subword_id", &FastText::getSubwordId)
|
215
216
|
.define_method(
|
216
217
|
"predict",
|
217
|
-
|
218
|
+
[](FastText& m, const std::string& text, int32_t k, float threshold) {
|
218
219
|
std::stringstream ioss(text);
|
219
220
|
std::vector<std::pair<fasttext::real, std::string>> predictions;
|
220
221
|
m.predictLine(ioss, predictions, k, threshold);
|
@@ -222,14 +223,14 @@ void Init_ext()
|
|
222
223
|
})
|
223
224
|
.define_method(
|
224
225
|
"nearest_neighbors",
|
225
|
-
|
226
|
+
[](FastText& m, const std::string& word, int32_t k) {
|
226
227
|
return m.getNN(word, k);
|
227
228
|
})
|
228
|
-
.define_method("analogies", &
|
229
|
-
.define_method("ngram_vectors", &
|
229
|
+
.define_method("analogies", &FastText::getAnalogies)
|
230
|
+
// .define_method("ngram_vectors", &FastText::getNgramVectors)
|
230
231
|
.define_method(
|
231
232
|
"word_vector",
|
232
|
-
|
233
|
+
[](FastText& m, const std::string& word) {
|
233
234
|
int dimension = m.getDimension();
|
234
235
|
fasttext::Vector vec = fasttext::Vector(dimension);
|
235
236
|
m.getWordVector(vec, word);
|
@@ -242,7 +243,7 @@ void Init_ext()
|
|
242
243
|
})
|
243
244
|
.define_method(
|
244
245
|
"subwords",
|
245
|
-
|
246
|
+
[](FastText& m, const std::string& word) {
|
246
247
|
std::vector<std::string> subwords;
|
247
248
|
std::vector<int32_t> ngrams;
|
248
249
|
std::shared_ptr<const fasttext::Dictionary> d = m.getDictionary();
|
@@ -256,7 +257,7 @@ void Init_ext()
|
|
256
257
|
})
|
257
258
|
.define_method(
|
258
259
|
"sentence_vector",
|
259
|
-
|
260
|
+
[](FastText& m, const std::string& text) {
|
260
261
|
std::istringstream in(text);
|
261
262
|
int dimension = m.getDimension();
|
262
263
|
fasttext::Vector vec = fasttext::Vector(dimension);
|
@@ -270,22 +271,28 @@ void Init_ext()
|
|
270
271
|
})
|
271
272
|
.define_method(
|
272
273
|
"train",
|
273
|
-
|
274
|
-
|
274
|
+
[](FastText& m, Hash h) {
|
275
|
+
auto a = buildArgs(h);
|
276
|
+
if (a.hasAutotune()) {
|
277
|
+
fasttext::Autotune autotune(std::shared_ptr<fasttext::FastText>(&m, [](fasttext::FastText*) {}));
|
278
|
+
autotune.train(a);
|
279
|
+
} else {
|
280
|
+
m.train(a);
|
281
|
+
}
|
275
282
|
})
|
276
283
|
.define_method(
|
277
284
|
"quantize",
|
278
|
-
|
285
|
+
[](FastText& m, Hash h) {
|
279
286
|
m.quantize(buildArgs(h));
|
280
287
|
})
|
281
288
|
.define_method(
|
282
289
|
"supervised?",
|
283
|
-
|
290
|
+
[](FastText& m) {
|
284
291
|
return m.getArgs().model == fasttext::model_name::sup;
|
285
292
|
})
|
286
293
|
.define_method(
|
287
294
|
"label_prefix",
|
288
|
-
|
295
|
+
[](FastText& m) {
|
289
296
|
return m.getArgs().label;
|
290
297
|
});
|
291
298
|
}
|