Update fastText example and add to examples in docs

This commit is contained in:
ines 2017-10-26 18:47:02 +02:00
parent db843735d3
commit cc2917c9e8
3 changed files with 16 additions and 2 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
# coding: utf8
"""Load vectors for a language trained using FastText
"""Load vectors for a language trained using fastText
https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md
"""
from __future__ import unicode_literals
@ -10,7 +10,8 @@ import numpy
import from spacy.language import Language
@plac.annotations(vectors_loc=("Path to vectors", "positional", None, str))
@plac.annotations(
vectors_loc=("Path to vectors", "positional", None, str))
def main(vectors_loc):
nlp = Language()

View File

@ -199,6 +199,7 @@
"Information Extraction": "information-extraction",
"Pipeline": "pipeline",
"Training": "training",
"Vectors & Similarity": "vectors",
"Deep Learning": "deep-learning"
}
}

View File

@ -119,6 +119,18 @@ include ../_includes/_mixins
+github("spacy", "examples/training/train_textcat.py")
+section("vectors")
+h(3, "fasttext") Loading pre-trained FastText vectors
p
| This simple snippet is all you need to be able to use the Facebook's
| #[+a("https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md") fastText vectors]
| (294 languages, pre-trained on Wikipedia) with spaCy. Once they're
| loaded, the vectors will be available via spaCy's built-in
| #[code similarity()] methods.
+github("spacy", "examples/vectors_fast_text.py")
+section("deep-learning")
+h(3, "keras") Text classification with Keras