Cutting-edge experimental spaCy components and features
Project description
spacy-experimental: Cutting-edge experimental spaCy components and features
This package includes experimental components and features for spaCy v3.x, for example model architectures, pipeline components and utilities.
Installation
Install with pip
:
python -m pip install -U pip setuptools wheel
python -m pip install spacy-experimental
Using spacy-experimental
Components and features may be modified or removed in any release, so always specify the exact version as a package requirement if you're experimenting with a particular component, e.g.:
spacy-experimental==0.147.0
Then you can add the experimental components to your config or import from
spacy_experimental
:
[components.experimental_edit_tree_lemmatizer]
factory = "experimental_edit_tree_lemmatizer"
Components
Edit tree lemmatizer
[components.experimental_edit_tree_lemmatizer]
factory = "experimental_edit_tree_lemmatizer"
# token attr to use as backoff with the predicted trees are not applicable; null to leave unset
backoff = "orth"
# prune trees that are applied less than this frequency in the training data
min_tree_freq = 2
# whether to overwrite existing lemma annotation
overwrite = false
scorer = {"@scorers":"spacy.lemmatizer_scorer.v1"}
# try to apply at most the k most probable edit trees
top_k = 1
Trainable character-based tokenizers
Two trainable tokenizers represent tokenization as a sequence tagging problem over individual characters and use the existing spaCy tagger and NER architectures to perform the tagging.
In the spaCy pipeline, a simple "pretokenizer" is applied as the pipeline
tokenizer to split each doc into individual characters and the trainable
tokenizer is a pipeline component that retokenizes the doc. The pretokenizer
needs to be configured manually in the config or with spacy.blank()
:
nlp = spacy.blank(
"en",
config={
"nlp": {
"tokenizer": {"@tokenizers": "spacy-experimental.char_pretokenizer.v1"}
}
},
)
The two tokenizers currently reset any existing tag or entity annotation respectively in the process of retokenizing.
Character-based tagger tokenizer
In the tagger version experimental_char_tagger_tokenizer
, the tagging problem
is represented internally with character-level tags for token start (T
),
token internal (I
), and outside a token (O
). This representation comes from
Elephant: Sequence Labeling for Word and Sentence
Segmentation (Evang et al., 2013).
This is a sentence.
TIIIOTIOTOTIIIIIIIT
With the option annotate_sents
, S
replaces T
for the first token in each
sentence and the component predicts both token and sentence boundaries.
This is a sentence.
SIIIOTIOTOTIIIIIIIT
A config excerpt for experimental_char_tagger_tokenizer
:
[nlp]
pipeline = ["experimental_char_tagger_tokenizer"]
tokenizer = {"@tokenizers":"spacy-experimental.char_pretokenizer.v1"}
[components]
[components.experimental_char_tagger_tokenizer]
factory = "experimental_char_tagger_tokenizer"
annotate_sents = true
scorer = {"@scorers":"spacy-experimental.tokenizer_senter_scorer.v1"}
[components.experimental_char_tagger_tokenizer.model]
@architectures = "spacy.Tagger.v1"
nO = null
[components.experimental_char_tagger_tokenizer.model.tok2vec]
@architectures = "spacy.Tok2Vec.v2"
[components.experimental_char_tagger_tokenizer.model.tok2vec.embed]
@architectures = "spacy.MultiHashEmbed.v2"
width = 128
attrs = ["ORTH","LOWER","IS_DIGIT","IS_ALPHA","IS_SPACE","IS_PUNCT"]
rows = [1000,500,50,50,50,50]
include_static_vectors = false
[components.experimental_char_tagger_tokenizer.model.tok2vec.encode]
@architectures = "spacy.MaxoutWindowEncoder.v2"
width = 128
depth = 4
window_size = 4
maxout_pieces = 2
Character-based NER tokenizer
In the NER version, each character in a token is part of an entity:
T B-TOKEN
h I-TOKEN
i I-TOKEN
s I-TOKEN
O
i B-TOKEN
s I-TOKEN
O
a B-TOKEN
O
s B-TOKEN
e I-TOKEN
n I-TOKEN
t I-TOKEN
e I-TOKEN
n I-TOKEN
c I-TOKEN
e I-TOKEN
. B-TOKEN
A config excerpt for experimental_char_ner_tokenizer
:
[nlp]
pipeline = ["experimental_char_ner_tokenizer"]
tokenizer = {"@tokenizers":"spacy-experimental.char_pretokenizer.v1"}
[components]
[components.experimental_char_ner_tokenizer]
factory = "experimental_char_ner_tokenizer"
scorer = {"@scorers":"spacy-experimental.tokenizer_scorer.v1"}
[components.experimental_char_ner_tokenizer.model]
@architectures = "spacy.TransitionBasedParser.v2"
state_type = "ner"
extra_state_tokens = false
hidden_width = 64
maxout_pieces = 2
use_upper = true
nO = null
[components.experimental_char_ner_tokenizer.model.tok2vec]
@architectures = "spacy.Tok2Vec.v2"
[components.experimental_char_ner_tokenizer.model.tok2vec.embed]
@architectures = "spacy.MultiHashEmbed.v2"
width = 128
attrs = ["ORTH","LOWER","IS_DIGIT","IS_ALPHA","IS_SPACE","IS_PUNCT"]
rows = [1000,500,50,50,50,50]
include_static_vectors = false
[components.experimental_char_ner_tokenizer.model.tok2vec.encode]
@architectures = "spacy.MaxoutWindowEncoder.v2"
width = 128
depth = 4
window_size = 4
maxout_pieces = 2
The NER version does not currently support sentence boundaries, but it would be
easy to extend using a B-SENT
entity type.
Biaffine parser
A biaffine dependency parser, similar to that proposed in [Deep Biaffine Attention for Neural Dependency Parsing](Deep Biaffine Attention for Neural Dependency Parsing) (Dozat & Manning, 2016). The parser consists of two parts: an edge predicter and an edge labeler. For example:
[components.experimental_arc_predicter]
factory = "experimental_arc_predicter"
[components.experimental_arc_labeler]
factory = "experimental_arc_labeler"
The arc predicter requires that a previous component (such as senter
) sets
sentence boundaries during training. Therefore, such a component must be
added to annotating_components
:
[training]
annotating_components = ["senter"]
The biaffine parser sample project provides an example biaffine parser pipeline.
Architectures
None currently.
Other
Tokenizers
spacy-experimental.char_pretokenizer.v1
: Tokenize a text into individual characters.
Scorers
spacy-experimental.tokenizer_scorer.v1
: Score tokenization.spacy-experimental.tokenizer_senter_scorer.v1
: Score tokenization and sentence segmentation.
Bug reports and issues
Please report bugs in the spaCy issue tracker or open a new thread on the discussion board for other issues.
Older documentation
See the READMEs in earlier tagged versions for details about components in earlier releases.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for spacy_experimental-0.4.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45b0dafe2e68cf5443a4b443868daf64fa14f537ee290c22988a0ad9d560697b |
|
MD5 | 5f161120a8b1eac33b52a422bc911daf |
|
BLAKE2b-256 | f432efc2d79365cfd06e1c3c40902ac8738cf9972a15e630bc5e32f3aa8590d0 |
Hashes for spacy_experimental-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35d63e2aba04c047c9a1fa5274221ef86608885eaae3745f65ab75ead1e6b6e8 |
|
MD5 | e7f54597363966e8f48a4107a01e38c9 |
|
BLAKE2b-256 | 5066631483fa65aa86434115b600cf23438a53b035e1f24a819f8b8a2d3a6440 |
Hashes for spacy_experimental-0.4.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df5a969adf3de3befe3e7b916ac2adc5f11f0a1af9ad07349382f2496da89b07 |
|
MD5 | 347e35afbcfb5460aca98de4f8b22c22 |
|
BLAKE2b-256 | 767a0bbdd397e52ca24b1f4d66c7556a231f391adf70d1732fc87c864b4c4866 |
Hashes for spacy_experimental-0.4.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f3dd83241ea86ddcd2ea99f5d346460570e10349c7fc6d7446d84c709ff9f1a |
|
MD5 | 8fcb31932b184a49ef032db35fdb1066 |
|
BLAKE2b-256 | dea8fdce01daf3c2d2d859fc8b7117191b92cf640f3f4c4dc4230d0a7de5d538 |
Hashes for spacy_experimental-0.4.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb68325f9b656e543b010d4270ad5e793d31f5c8ec135e62c5baa77297be5f19 |
|
MD5 | cec258f9098ef65a59b676e3217e1aee |
|
BLAKE2b-256 | a8c45e8d456ecc2019cbbdcdf0ed8719ed57b7e4414400b1bbb8e8509d59f766 |
Hashes for spacy_experimental-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2068d052082d157b7de0fe05282107aed4203198357648bd9619581f2b0fba0a |
|
MD5 | ce4a1d2e469db2d4a794c04ce4ea0675 |
|
BLAKE2b-256 | fd01d2cb301f17ca81f1b2252b5a01a4b7cc7a3f734da884321142b471a6cadc |
Hashes for spacy_experimental-0.4.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 523bf9a0ca419c7232bc0bd70b85f4bff07c1de5b52817faa618a839a05e70e7 |
|
MD5 | fcded039c0a4d42f7d6bcbf0cf4dedb3 |
|
BLAKE2b-256 | ef51dc73fec5f6aacb1c67487454a9ce3ef432197525ebaa9dc3fa77802090bf |
Hashes for spacy_experimental-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90ffbbda69330a5e7b195dbafa44a50ce9beff7d4d60026b62f1305a3f34d334 |
|
MD5 | b151586affa675743399a0331f834443 |
|
BLAKE2b-256 | e82ddff13097f27d0e957a4b7a777434896d0cebdee31d7e2df59fa4f5e39612 |
Hashes for spacy_experimental-0.4.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95438909caaeb66beab25643f559b64447f15fe1994d3739ba5c6c64c9daa739 |
|
MD5 | b2202c58acf0b7f5f4840ccacc5cb0da |
|
BLAKE2b-256 | 5d80a190d7c0119e8cb8b9d812ef4cd81048485cc2668c93ce8e8d82a1e06232 |
Hashes for spacy_experimental-0.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31ae583f41cb316e6bc120e401de192e01ab84a9d10a1443e7c8185bfd7ce9a7 |
|
MD5 | 717e2dab4bf982bb54a6b7c2dd32a033 |
|
BLAKE2b-256 | 5937e2400067fc0fe449c9e41a886d73393fd2c238b643ccf774aafa2d043419 |
Hashes for spacy_experimental-0.4.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 150279a0a2da42ce2cc87e16cc70deadcdde66fe60c4b3a49609c6f052b4e58e |
|
MD5 | b3252a56c497ff62310f1f00c2c19756 |
|
BLAKE2b-256 | 7f2f962f2dc1a43e8871ff7f6d59fb7696329acb7254401653a1a45f9b1c9f54 |
Hashes for spacy_experimental-0.4.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 226e5ae003130b22d3df9699f4ec891d897bf94b42d11f14cc30cdc57e70c795 |
|
MD5 | cbd8eee11ba8cb1178afae159e9adcfc |
|
BLAKE2b-256 | 89a0cfddf64ba4b6677618b9ca6630828dbdab6de0db2744027b2b64717a0c88 |
Hashes for spacy_experimental-0.4.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 347d8901d3a1c592f7b4365cbfa10c5198ab0764b0acafaaf17577d1b4f3c366 |
|
MD5 | 10c6469b98f5f795523b93a8cf1bf5c4 |
|
BLAKE2b-256 | 6b8ba59984680faf983f289679c9e313a30c1136544d51507a69dfea464f233a |
Hashes for spacy_experimental-0.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99a163765edbfccca36f60b1e1ac101f1bb54991d0d66eedc364422bf25f55fe |
|
MD5 | 56a1e2fb2c2933c64ed27a1b98117163 |
|
BLAKE2b-256 | b65f3b5289c6b1fa3f7f48a6a32103094a16e55ad9281ba54379295c4cbdfd23 |
Hashes for spacy_experimental-0.4.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8c667a21a54af11a00346a8e89f6c1ba45a0af25fb1f3967c27ac9dcaf7a2a0 |
|
MD5 | bbde74b37c7d82bdcee4e5d4906ffa1d |
|
BLAKE2b-256 | 9b4376d1de788c5c6030101bebcd2bb7eb0c0df041007d53f8cbad2ab8b30a63 |
Hashes for spacy_experimental-0.4.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8c820a6e1671cd33a46099e97193f39e7f551bdb1e13af7edde6ff07832a759 |
|
MD5 | a0606cbe226da6864fcd4dfa7814e3dd |
|
BLAKE2b-256 | 1195d862bb211738c6132ca9595073e9de88a66a480be288dfa36bbc887e6059 |
Hashes for spacy_experimental-0.4.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0eb41150d4893afee25e6b1796fd7b760a632ff8eb219cb82ae5a2e7d3478d1c |
|
MD5 | 8820755e545ba9c52f894f9c8de94aa5 |
|
BLAKE2b-256 | d393028b0cf6bcb6c700f1585607610ec6bcbd52468f90d5abd5c862ad081455 |
Hashes for spacy_experimental-0.4.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16da4a4a16d8abc41c6b9eb505903a8714c9de755b9125df75d4291eda322395 |
|
MD5 | 98301ebba22449bed4a915d58a3a0b8f |
|
BLAKE2b-256 | da4055eb28e520675dc0a353bbab073d26c6459bca06cb62fc382157aebaccff |