explosion/spaCy: v2.1.0a10: New models, ULMFit/BERT/Elmo-like pretraining, joint word segmentation and parsing, better Matcher, bug fixes & more
Authors/Creators
- Matthew Honnibal1
- Ines Montani1
- Matthew Honnibal1
- Henning Peters
- Maxim Samsonov
- Jim Geovedi
- Jim Regan
- GyΓΆrgy Orosz2
- SΓΈren Lind Kristiansen
- Paul O'Leary McCann
- Duygu Altinok3
- Roman4
- GrΓ©gory Howard
- Alex5
- Sam Bozek
- Explosion Bot6
- Mark Amery
- Leif Uwe Vogelsang
- Pradeep Kumar Tippa
- GregDubbin
- Wannaphong Phatthiyaphaibun7
- Vadim Mazaev
- Jens Dahl MΓΈllerhΓΈj8
- wbwseeker
- Magnus Burton
- mpuels9
- Tom Dong10
- thomasO
- Ramanan Balakrishnan11
- Avadh Patel12
- 1. Founder @explosion
- 2. LogMeIn, Meltwater
- 3. German Autolabs
- 4. @kouchtv
- 5. ChatMe.ai
- 6. @explosion
- 7. @PyThaiNLP
- 8. mollerhoj
- 9. @yoyolabsio
- 10. Quora
- 11. @Semantics3
- 12. SUNY Binghamton - Computer Science
Description
π This is an alpha pre-release of spaCy v2.1.0 and available on pip as spacy-nightly. It's not intended for production use. See here for the updated nightly docs.
pip install -U spacy-nightly
If you want to test the new version, we recommend using a new virtual environment. Also make sure to download the new models β see below for details and benchmarks.
β¨ New features and improvements Tagger, Parser, NER and Text Categorizerβ οΈ Due to difficulties linking our new
blisfor faster platform-independent matrix multiplication, this nightly release currently doesn't work on Python 2.7 on Windows. We expect this to be corrected in the future.
- NEW: Experimental ULMFit/BERT/Elmo-like pretraining (see #2931) via the new
spacy pretraincommand. This pre-trains the CNN using BERT's cloze task. A new trick we're calling Language Modelling with Approximate Outputs is used to apply the pre-training to smaller models. The pre-training outputs CNN and embedding weights that can be used inspacy train, using the new-t2vargument. - NEW: Allow parser to do joint word segmentation and parsing. If you pass in data where the tokenizer over-segments, the parser now learns to merge the tokens.
- Make parser, tagger and NER faster, through better hyperparameters.
- Add simpler, GPU-friendly option to
TextCategorizer, and allow settingexclusive_classesandarchitecturearguments on initialization. - Add
EntityRecognizer.labelsproperty. - Remove document length limit during training, by implementing faster Levenshtein alignment.
- Use Thinc v7.0, which defaults to single-thread with fast
bliskernel for matrix multiplication. Parallelisation should be performed at the task level, e.g. by running more containers.
- NEW: 2-3 times faster tokenization across all languages at the same accuracy!
- NEW: Small accuracy improvements for parsing, tagging and NER for 6+ languages.
- NEW: The English and German models are now available under the MIT license.
- NEW: Statistical models for Greek.
- NEW: Alpha support for Tamil, Ukrainian and Kannada, and base language classes for Afrikaans, Bulgarian, Czech, Icelandic, Lithuanian, Latvian, Slovak, Slovenian and Albanian.
- Improve loading time of
Frenchby ~30%.
- NEW:
pretraincommand for ULMFit/BERT/Elmo-like pretraining (see #2931). - NEW: New
ud-traincommand, to train and evaluate using the CoNLL 2017 shared task data. - Check if model is already installed before downloading it via
spacy download. - Pass additional arguments of
downloadcommand topipto customise installation. - Improve
traincommand by lettingGoldCorpusstream data, instead of loading into memory. - Improve
init-modelcommand, including support for lexical attributes and word-vectors, using a variety of formats. This replaces thespacy vocabcommand, which is now deprecated. - Add support for multi-task objectives to
traincommand. - Add support for data-augmentation to
traincommand.
- NEW: Enhanced pattern API for rule-based
Matcher(see #1971). - NEW:
Doc.retokenizecontext manager for merging and splitting tokens more efficiently. - NEW: Add support for custom pipeline component factories via entry points (#2348).
- NEW: Implement fastText vectors with subword features.
- NEW: Built-in rule-based NER component to add entities based on match patterns (see #2513).
- NEW: Allow
PhraseMatcherto match on token attributes other thanORTH, e.g.LOWER(for case-insensitive matching) or evenPOSorTAG. - NEW: Replace
ujson,msgpack,msgpack-numpy,pickle,cloudpickleanddillwith our own packagesrslyto centralise dependencies and allow binary wheels. - NEW:
Doc.to_json()method which outputs data in spaCy's training format. This will be the only place where the format is hard-coded (see #2932). - NEW: Built-in
EntityRulercomponent to make it easier to build rule-based NER and combinations of statistical and rule-based systems. - NEW:
gold.spans_from_biluo_tagshelper that returnsSpanobjects, e.g. to overwrite thedoc.ents. - Add warnings if
.similaritymethod is called with empty vectors or without word vectors. - Improve rule-based
Matcherand addreturn_matcheskeyword argument toMatcher.pipeto yield(doc, matches)tuples instead of onlyDocobjects, andas_tuplesto add context to theDocobjects. - Make stop words via
Token.is_stopandLexeme.is_stopcase-insensitive. - Accept
"TEXT"as an alternative to"ORTH"inMatcherpatterns. - Use
blackfor auto-formatting.pysource and optimse codebase usingflake8. You can now runflake8 spacyand it should return no errors or warnings. SeeCONTRIBUTING.mdfor details.
- Fix issue #1487: Add
Doc.retokenize()context manager. - Fix issue #1537: Make
Span.as_docreturn a copy, not a view. - Fix issue #1574: Make sure stop words are available in medium and large English models.
- Fix issue #1585: Prevent parser from predicting unseen classes.
- Fix issue #1642: Replace
regexwithreand speed up tokenization. - Fix issue #1665: Correct typos in symbol
Animacy_inanand addAnimacy_nhum. - Fix issue #1748, #1798, #2756, #2934: Add simpler GPU-friendly option to
TextCategorizer. - Fix issue #1773: Prevent tokenizer exceptions from setting
POSbut notTAG. - Fix issue #1782, #2343: Fix training on GPU.
- Fix issue #1816: Allow custom
Languagesubclasses via entry points. - Fix issue #1865: Correct licensing of
it_core_news_smmodel. - Fix issue #1889: Make stop words case-insensitive.
- Fix issue #1903: Add
relcldependency label to symbols. - Fix issue #1963: Resize
Doc.tensorwhen merging spans. - Fix issue #1971: Update
Matcherengine to support regex, extension attributes and rich comparison. - Fix issue #2014: Make
Token.pos_writeable. - Fix issue #2329: Correct
TextCategorizerandGoldParseAPI docs. - Fix issue #2369: Respect pre-defined warning filters.
- Fix issue #2390: Support setting lexical attributes during retokenization.
- Fix issue #2396: Fix
Doc.get_lca_matrix. - Fix issue #2464, #3009: Fix behaviour of
Matcher's?quantifier. - Fix issue #2482: Fix serialization when parser model is empty.
- Fix issue #2603: Improve handling of missing NER tags.
- Fix issue #2644: Add table explaining training metrics to docs.
- Fix issue #2648: Fix
KeyErrorinVectors.most_similar. - Fix issue #2671, #2675: Fix incorrect match ID on some patterns.
- Fix issue #2693: Only use
'sentencizer'as built-in sentence boundary component name. - Fix issue #2728: Fix HTML escaping in
displacyNER visualization and correct API docs. - Fix issue #2754, #3028: Make
NORMaTokenattribute instead of aLexemeattribute to allow setting context-specific norms in tokenizer exceptions. - Fix issue #2769: Fix issue that'd cause segmentation fault when calling
EntityRecognizer.add_label. - Fix issue #2772: Fix bug in sentence starts for non-projective parses.
- Fix issue #2779: Fix handling of pre-set entities.
- Fix issue #2782: Make
like_numwork with prefixed numbers. - Fix issue #2833: Raise better error if
TokenorSpanare pickled. - Fix issue #2838: Add
Retokenizer.splitmethod to split one token into several. - Fix issue #2869: Make
doc[0].is_sent_start == True. - Fix issue #2870: Make it illegal for the entity recognizer to predict whitespace tokens as
B,LorU. - Fix issue #2871: Fix vectors for reserved words.
- Fix issue #2901: Fix issue with first call of
nlpin Japanese (MeCab). - Fix issue #2924: Make IDs of displaCy arcs more unique to avoid clashes.
- Fix issue #3012: Fix clobber of
Doc.is_taggedinDoc.from_array. - Fix issue #3027: Allow
Spanto take unicode value forlabelargument. - Fix issue #3048: Raise better errors for uninitialized pipeline components.
- Fix issue #3064: Allow single string attributes in
Doc.to_array. - Fix issue #3093, #3067: Set
vectors.namecorrectly when exporting model via CLI. - Fix issue #3112: Make sure entity types are added correctly on GPU.
- Fix issue #3122: Correct docs of
Token.subtreeandSpan.subtree. - Fix issue #3128: Improve error handling in converters.
- Fix issue #3248: Fix
PhraseMatcherpickling and make__len__consistent. - Fix issue #3274: Make
Token.sentwork as expected without the parser. - Fix issue #3277: Add en/em dash to tokenizer prefixes and suffixes.
- Fix serialization of custom tokenizer if not all functions are defined.
- Fix bugs in beam-search training objective.
- Fix problems with model pickling.
- This version of spaCy requires downloading new models. You can use the
spacy validatecommand to find out which models need updating, and print update instructions. - If you've been training your own models, you'll need to retrain them with the new version.
- Due to difficulties linking our new
blisfor faster platform-independent matrix multiplication, v2.1.x currently doesn't work on Python 2.7 on Windows. We expect this to be corrected in the future. - While the
MatcherAPI is fully backwards compatible, its algorithm has changed to fix a number of bugs and performance issues. This means that theMatcherinv2.1.xmay produce different results compared to theMatcherinv2.0.x. - The deprecated
Doc.mergeandSpan.mergemethods still work, but you may notice that they now run slower when merging many objects in a row. That's because the merging engine was rewritten to be more reliable and to support more efficient merging in bulk. To take advantage of this, you should rewrite your logic to use theDoc.retokenizecontext manager and perform as many merges as possible together in thewithblock. ```diff - doc[1:5].merge()
- doc[6:8].merge()
- with doc.retokenize() as retokenizer:
- retokenizer.merge(doc[1:5])
- retokenizer.merge(doc[6:8]) ```
- For better compatibility with the Universal Dependencies data, the lemmatizer now preserves capitalization, e.g. for proper nouns (see #3256).
- The keyword argument
n_threadson the.pipemethods is now deprecated, as the v2.x models cannot release the global interpreter lock. (Future versions may introduce an_processargument for parallel inference via multiprocessing.) - The
Doc.print_treemethod is not deprecated in favour of a unifiedDoc.to_jsonmethod, which outputs data in the same format as the expected JSON training data. - The built-in rule-based sentence boundary detector is now only called
'sentencizer'β the name'sbd'is deprecated. ```diff - sentence_splitter = nlp.create_pipe('sbd')
- sentence_splitter = nlp.create_pipe('sentencizer') ```
- The
is_sent_startattribute of the first token in aDocnow correctly defaults toTrue. It previously defaulted toNone. - The
spacy traincommand now lets you specify a comma-separated list of pipeline component names, instead of separate flags like--no-parserto disable components. This is more flexible and also handles custom components out-of-the-box. ```diff - $ spacy train en /output train_data.json dev_data.json --no-parser
- $ spacy train en /output train_data.json dev_data.json --pipeline tagger,ner ```
- The
spacy init-modelcommand now uses a--jsonl-locargument to pass in a a newline-delimited JSON (JSONL) file containing one lexical entry per line instead of a separate--freqs-locand--clusters-loc. ```diff - $ spacy init-model en ./model --freqs-loc ./freqs.txt --clusters-loc ./clusters.txt
- $ spacy init-model en ./model --jsonl-loc ./vocab.jsonl ```
- Also note that some of the model licenses have changed:
it_core_news_smis now correctly licensed under CC BY-NC-SA 3.0, and all English and German models are now published under the MIT license.
en_core_web_sm
English
2.1.0a7
91.6
89.7
96.8
85.5
π
10 MB
en_core_web_md
English
2.1.0a7
91.8
90.0
96.9
86.3
β
90 MB
en_core_web_lg
English
2.1.0a7
91.9
90.1
97.0
86.6
β
788 MB
de_core_news_sm
German
2.1.0a7
91.7
89.5
97.3
83.4
π
10 MB
de_core_news_md
German
2.1.0a7
92.3
90.4
97.4
83.8
β
210 MB
es_core_news_sm
Spanish
2.1.0a7
90.2
87.1
97.0
89.1
π
10 MB
es_core_news_md
Spanish
2.1.0a7
91.2
88.4
97.2
89.4
β
69 MB
pt_core_news_sm
Portuguese
2.1.0a7
89.5
86.2
80.1
89.0
π
12 MB
fr_core_news_sm
French
2.1.0a7
87.3
84.4
94.7
83.0
π
14 MB
fr_core_news_md
French
2.1.0a7
89.1
86.2
95.3
83.3
β
82 MB
it_core_news_sm
Italian
2.1.0a7
91.1
87.2
96.0
86.3
π
10 MB
nl_core_news_sm
Dutch
2.1.0a7
83.9
77.6
91.5
87.0
π
10 MB
el_core_news_sm
Greek
2.1.0a7
85.1
81.5
94.5
73.3
π
10 MB
el_core_news_md
Greek
2.1.0a7
88.2
85.1
96.7
78.1
β
126 MB
xx_ent_wiki_sm
Multi
2.1.0a7
-
-
-
81.6
π
3 MB
π Documentation and examplesπ¬ UAS: Unlabelled dependencies (parser). LAS: Labelled dependencies (parser). POS: Part-of-speech tags (fine-grained tags, i.e.
Token.tag_). NER F: Named entities (F-score). Vec: Model contains word vectors. Size: Model file size (zipped archive).
Although it looks pretty much the same, we've rebuilt the entire documentation using Gatsby and MDX. It's now an even faster progressive web app and allows us to write all content entirely in Markdown, without having to compromise on easy-to-use custom UI components. We're hoping that the Markdown source will make it even easier to contribute to the documentation. For more details, check out the styleguide and source.
While converting the pages to Markdown, we've also fixed a bunch of typos, improved the existing pages and added some new content:
- Usage Guide: Rule-based Matching. How to use the
Matcher,PhraseMatcherand the newEntityRuler, and write powerful components to combine statistical models and rules. - Usage Guide: Saving and Loading. Everything you need to know about serialization, and how to save and load pipeline components, package your spaCy models as Python modules and use entry points.
- Usage Guide: Merging and Splitting. How to retokenize a
Docusing the newretokenizecontext manager and merge spans into single tokens and split single tokens into multiple. - Universe: Videos and Podcasts
- API:
EntityRuler - API:
SentenceSegmenter - API: Pipeline functions
Thanks to @DuyguA, @giannisdaras, @mgogoulos, @louridas, @skrcode, @gavrieltal, @svlandeg, @jarib, @alvaroabascar, @kbulygin, @moreymat, @mirfan899, @ozcankasal, @willprice, @alvations, @amperinet, @retnuh, @Loghijiaha, @DeNeutoy, @gavrieltal, @boena, @BramVanroy, @pganssle, @foufaster, @adrianeboyd, @maknotavailable, @pierremonico, @lauraBaakman, @juliamakogon, @Gizzio, @Abhijit-2592, @akki2825, @grivaz, @roshni-b, @mpuig and @mikelibg for the pull requests and contributions.
Files
explosion/spaCy-v2.1.0a10.zip
Files
(27.8 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:1e87532c9f9cbd8db4f85f8c763a4a4a
|
27.8 MB | Preview Download |
Additional details
Related works
- Is supplement to
- https://github.com/explosion/spaCy/tree/v2.1.0a10 (URL)