mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 01:48:04 +03:00 
			
		
		
		
	Update fastText example and add to examples in docs
This commit is contained in:
		
							parent
							
								
									db843735d3
								
							
						
					
					
						commit
						cc2917c9e8
					
				| 
						 | 
				
			
			@ -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()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -199,6 +199,7 @@
 | 
			
		|||
            "Information Extraction": "information-extraction",
 | 
			
		||||
            "Pipeline": "pipeline",
 | 
			
		||||
            "Training": "training",
 | 
			
		||||
            "Vectors & Similarity": "vectors",
 | 
			
		||||
            "Deep Learning": "deep-learning"
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user