spaCy/website/usage/_models/_quickstart.jade

18 lines
1.1 KiB
Plaintext
Raw Normal View History

2017-10-03 15:26:20 +03:00
//- 💫 DOCS > USAGE > MODELS > QUICKSTART
- QUICKSTART_MODELS[0].options = Object.keys(MODELS).map(m => ({ id: m, title: LANGUAGES[m], checked: m == 'en'}))
+quickstart(QUICKSTART_MODELS, "Quickstart", "Install a default model, get the code to load it from within spaCy and an example to test it. For more options, see the section on available models below.")
for models, lang in MODELS
- var package = models[0]
+qs({lang: lang}) spacy download #{lang}
+qs({lang: lang}, "divider")
+qs({lang: lang, load: "module"}, "python") import #{package}
+qs({lang: lang, load: "module"}, "python") nlp = #{package}.load()
+qs({lang: lang, load: "spacy"}, "python") nlp = spacy.load('#{lang}')
+qs({lang: lang, config: "example"}, "python") doc = nlp(u"#{EXAMPLE_SENTENCES[lang]}")
if lang != "xx"
+qs({lang: lang, config: "example"}, "python") print([(w.text, w.pos_) for w in doc])
else
+qs({lang: lang, config: "example"}, "python") print([(ent.text, ent.label) for ent in doc.ents])