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_char_ner_tokenizer]
factory = "experimental_char_ner_tokenizer"
Components
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.
Span Finder
The SpanFinder is a new experimental component that identifies span boundaries by tagging potential start and end tokens. It's an ML approach to suggest candidate spans with higher precision.
SpanFinder
uses the following parameters:
threshold
: Probability threshold for predicted spans.predicted_key
: Name of the SpanGroup the predicted spans are saved to.training_key
: Name of the SpanGroup the training spans are read from.max_length
: Max length of the predicted spans. No limit when set to0
. Defaults to0
.min_length
: Min length of the predicted spans. No limit when set to0
. Defaults to0
.
Here is a config excerpt for the SpanFinder
together with a SpanCategorizer
:
[nlp]
lang = "en"
pipeline = ["tok2vec","span_finder","spancat"]
batch_size = 128
disabled = []
before_creation = null
after_creation = null
after_pipeline_creation = null
tokenizer = {"@tokenizers":"spacy.Tokenizer.v1"}
[components]
[components.tok2vec]
factory = "tok2vec"
[components.tok2vec.model]
@architectures = "spacy.Tok2Vec.v1"
[components.tok2vec.model.embed]
@architectures = "spacy.MultiHashEmbed.v2"
width = ${components.tok2vec.model.encode.width}
attrs = ["ORTH", "SHAPE"]
rows = [5000, 2500]
include_static_vectors = false
[components.tok2vec.model.encode]
@architectures = "spacy.MaxoutWindowEncoder.v2"
width = 96
depth = 4
window_size = 1
maxout_pieces = 3
[components.span_finder]
factory = "experimental_span_finder"
threshold = 0.35
predicted_key = "span_candidates"
training_key = ${vars.spans_key}
min_length = 0
max_length = 0
[components.span_finder.scorer]
@scorers = "spacy-experimental.span_finder_scorer.v1"
predicted_key = ${components.span_finder.predicted_key}
training_key = ${vars.spans_key}
[components.span_finder.model]
@architectures = "spacy-experimental.SpanFinder.v1"
[components.span_finder.model.scorer]
@layers = "spacy.LinearLogistic.v1"
nO=2
[components.span_finder.model.tok2vec]
@architectures = "spacy.Tok2VecListener.v1"
width = ${components.tok2vec.model.encode.width}
[components.spancat]
factory = "spancat"
max_positive = null
spans_key = ${vars.spans_key}
threshold = 0.5
[components.spancat.model]
@architectures = "spacy.SpanCategorizer.v1"
[components.spancat.model.reducer]
@layers = "spacy.mean_max_reducer.v1"
hidden_size = 128
[components.spancat.model.scorer]
@layers = "spacy.LinearLogistic.v1"
nO = null
nI = null
[components.spancat.model.tok2vec]
@architectures = "spacy.Tok2VecListener.v1"
width = ${components.tok2vec.model.encode.width}
[components.spancat.suggester]
@misc = "spacy-experimental.span_finder_suggester.v1"
predicted_key = ${components.span_finder.predicted_key}
This package includes a spaCy project which shows how
to train and use the SpanFinder
together with SpanCategorizer
.
Coreference Components
The CoreferenceResolver and SpanResolver are designed to be used together to build a corerefence pipeline, which allows you to identify which spans in a document refer to the same thing. Each component also includes an architecture and scorer. For more details, see their pages in the main spaCy docs.
For an example of how to build a pipeline with the components, see the example coref project.
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.
Misc
Suggester functions for spancat:
Subtree suggester: Uses dependency annotation to suggest tokens with their syntactic descendants.
spacy-experimental.subtree_suggester.v1
spacy-experimental.ngram_subtree_suggester.v1
Chunk suggester: Suggests noun chunks using the noun chunk iterator, which requires POS and dependency annotation.
spacy-experimental.chunk_suggester.v1
spacy-experimental.ngram_chunk_suggester.v1
Sentence suggester: Uses sentence boundaries to suggest sentence spans.
spacy-experimental.sentence_suggester.v1
spacy-experimental.ngram_sentence_suggester.v1
The package also contains a
merge_suggesters
function which can be used to combine suggestions from multiple suggesters.
Here are two config excerpts for using the subtree suggester
with and without
the ngram functionality:
[components.spancat.suggester]
@misc = "spacy-experimental.subtree_suggester.v1"
[components.spancat.suggester]
@misc = "spacy-experimental.ngram_subtree_suggester.v1"
sizes = [1, 2, 3]
Note that all the suggester functions are registered in @misc
.
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.6.4-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb98ddb7d660ead8efc68e839513cfcca0fdbb315badfb92caf522234641f132 |
|
MD5 | 94d542a97a3bf741d0757f0eae92e561 |
|
BLAKE2b-256 | 0efd306b5f250d3c51f003c71037ab0ab8b4ec58f9e42f5639a7fcc86039b7f7 |
Hashes for spacy_experimental-0.6.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e3b9ea485c96baa36b7cd7b957fa17ad50e9403730d218d182b4470952ac1be |
|
MD5 | 738c2ed9ea29be65ade0d02a085b6544 |
|
BLAKE2b-256 | fa33cfd1753a69e481d1480b0507974d4a937bbf0e929c80dc8f35ca96a2a988 |
Hashes for spacy_experimental-0.6.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c54d734b1804dd869264a8ec58b10b25ea98af8b65db82a55f71f6dff1fd6275 |
|
MD5 | 330e30564aa3663e28cafa3119b25373 |
|
BLAKE2b-256 | cde82f81852f465c827e9e68d0d73f309b19c0ae368a71a885defb962359b519 |
Hashes for spacy_experimental-0.6.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb923f5a45af5a834fa15866bb4d5afea387deca35fe69ac37b16b93c1659ccb |
|
MD5 | 281c6da4b17e799781597ce01c337aaf |
|
BLAKE2b-256 | 56155dfa5f7c671ae3c2e1069572143517571aa6e172fb6c8e82f71f138d98c7 |
Hashes for spacy_experimental-0.6.4-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6932c233e6f33f77485760a68cf6944bc03ce1fa0f36cc00bedae4267630b269 |
|
MD5 | 5e54eb71884aa79b81118f6d13940a4c |
|
BLAKE2b-256 | dd383f74c6267222b43ab49abc5593f2c6a993dee6687104bdf9813c8b19466d |
Hashes for spacy_experimental-0.6.4-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2943997cdc20803bb1ec619c5f076416063bc994e59786d1990296b65adeed90 |
|
MD5 | e83d98e71adec4888c6a467008725200 |
|
BLAKE2b-256 | 8a8b6c8d4ca03f3cddd74a3c017e80e51099382af3ae6493cd3e1f72364988a1 |
Hashes for spacy_experimental-0.6.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59a5e2668b1159be631244fee8d21549e7dee66a252266a77a4345ad61990559 |
|
MD5 | ffd36831ec7962df1e5ee8cc9a3e3c1f |
|
BLAKE2b-256 | fff79a7933b8b082b1625b22d31da8aaad9ade82f7c60dd7a3272c5921be7796 |
Hashes for spacy_experimental-0.6.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c25b0ef8138f3b843c1ec08be0614aa6c5c202b19845e435f95a936d2c7e092a |
|
MD5 | 9bfaf0ee5fae1a487d1fc99ac9281ee7 |
|
BLAKE2b-256 | 5a9659850a48598ed62bc55ac3c427f300dd893bf75f50914817ce6ece1c5f98 |
Hashes for spacy_experimental-0.6.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b042045e5ceff95998e54941592591fa2344f0f4138c29fef91aba0473d3587 |
|
MD5 | 69ec43738948b463249d60b946254d1d |
|
BLAKE2b-256 | 95a33db4b0d53a9fa7e357b49ffe6bf3a4c89a72e468153f575eeca862423739 |
Hashes for spacy_experimental-0.6.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b2e8e0634b8591dfe61d5c37b3a4637be9e1744565efc7e89a3e805e212fd89 |
|
MD5 | 98c55e56ca4574be9674a1dc0d0e8aab |
|
BLAKE2b-256 | 785ef2dda45f2e788902abc134bbb23d4f9c78c8c2a97d55dc6600f755b53070 |
Hashes for spacy_experimental-0.6.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd3bf159365c5dae0c0e2162ca02012ba8ede76d6ecf788f1543fd1c44cdf60c |
|
MD5 | 42db8baea9f1d720a50f88316cb07ba7 |
|
BLAKE2b-256 | e9be833216e598ecc0b83b442defaef2ef21faf3ccb258fbe52bc7607cd9ad5a |
Hashes for spacy_experimental-0.6.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14ec4efde588bd02afd1e1d44164d1f0ba4be894dbd9da657db6a8ff5c62247d |
|
MD5 | 8ab81bd34e17aaac95248f7dbc1bded7 |
|
BLAKE2b-256 | 2b7ef87e8bc8bffb644ae6fad6da40c3b817e177b68df7917b23ae10ad825c25 |
Hashes for spacy_experimental-0.6.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fbe8e715d79742ad3182d7ba672d2794bcaca6f3c6079e172aa366e2a410fb0 |
|
MD5 | 3dff6ec0ddf8bcdd2476bd0dd1d4b5be |
|
BLAKE2b-256 | 00454cad2ed36fa74872a328f7f4fcb4d2e77f035faff3fd0674dbf249f736aa |
Hashes for spacy_experimental-0.6.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39fa1c4274f1b540a3ecd82976c66d408b8bac873c1c5323849708146a8e9c16 |
|
MD5 | e6aeeb816fede93fc66db543cac46bf1 |
|
BLAKE2b-256 | e03172f4bf227ffcd1c1b208400d814a7089f363bec26f3f9707627ac14c1e84 |
Hashes for spacy_experimental-0.6.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46ba2d8feeee910e52774c2f1fe31817e3b124a04bd8ccc53ec9685ba96c00ec |
|
MD5 | fb923908f2ef3af0023a836faa667632 |
|
BLAKE2b-256 | 2f873c94f80f8b4d2de740e725ceedc58b01eb7464c4bc723849d5e8772237ec |
Hashes for spacy_experimental-0.6.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f076bb12f994f9d63619ed1b4aeb4396bf8ad9059c886d77283375c9467b332b |
|
MD5 | 7037e373dee46cfd9f9049aaac084ffc |
|
BLAKE2b-256 | b5558f531df6bde3450a3b35b4affcb630ec63c90a5dbc102d8dd1d3a3833de5 |
Hashes for spacy_experimental-0.6.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d7a1367739d7326e1fa0126ea5de45517542a7c8fabc9aabbda7c93f4b6a533 |
|
MD5 | 9ce5f71a2a601ce4037551614ded23a5 |
|
BLAKE2b-256 | 16bee9eec4c9d2fd93aaf71f1d9f1b3eea6cb864e0cd7c3d2e556818c0af4564 |
Hashes for spacy_experimental-0.6.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ec901159b05d9bef52a7e98fc131f93a43266dae17482846940b00b2602d226 |
|
MD5 | f0f2c297946847a89aaad71ad60fc658 |
|
BLAKE2b-256 | 262fc8b94f0573580bf2511e10fc3b1b23bd71bdeecf3d81eb97c54fb6709aeb |
Hashes for spacy_experimental-0.6.4-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc48a0e6687a40535bd648079bde841144379a1c0c10de7720449a8cbb90319b |
|
MD5 | b987e1de6566b1a1d2b2f4c5ab147e9a |
|
BLAKE2b-256 | 1a322be043aabaacc2ba285313f1dd1391df98a577b7a2827bd71123eef69342 |
Hashes for spacy_experimental-0.6.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38d681c41012e3d2175fdb2125a58beb75f892ad0732d270b1f0c091e0d17100 |
|
MD5 | f0e33571a4e960ba77d10c3e104501f9 |
|
BLAKE2b-256 | b7d2ba6e03ed102bc9c917c34d1c0942e24b099773fd10ec2ebcd9df1e5b612a |
Hashes for spacy_experimental-0.6.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91b7948f81c4a61d6abe3a7da0704bdde5e781791b8a46e2004109268e762579 |
|
MD5 | 28efb7be9765acea455b6517a30a7e56 |
|
BLAKE2b-256 | 28b856ea5118ae23c3efdbcacc090ef20cd7fecb79c10c280d70591d2c763510 |
Hashes for spacy_experimental-0.6.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 870de86fe3b9235c1837b8a9679a11d9b63c8e444b78ef3416a6502690c962b4 |
|
MD5 | eeb7525aca87e3abe249d60ea8b7efc6 |
|
BLAKE2b-256 | 44ec3ef2cc8746ebd5abaf0879b3b296784519b722b1704fb12dc0be3362dbd9 |
Hashes for spacy_experimental-0.6.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d7d642fea5cd0c090001524653e11fce522ba3eea3a1fe6e981a8b044320233 |
|
MD5 | f21be67619927b326d7ab6c0fecbacdd |
|
BLAKE2b-256 | 62886251516c8ac5ce68265596c59f86acc7f5821f6f463bda931c4f095e77eb |
Hashes for spacy_experimental-0.6.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fda08eec0a7149d4e30255dceb85c07eb5ed535a5566b5a3f0639ff320e08a3 |
|
MD5 | edd34c4788113e8bebdd59013528d1dd |
|
BLAKE2b-256 | 3b86200757090de96252efb6de1720cc0925017d4c79ce350ab65ba27e6fe7a2 |
Hashes for spacy_experimental-0.6.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 156b19e2d383b40d3c70dd670b3f7b2c8c3c22f13ad119ec9fc1399b2a24908d |
|
MD5 | 734d88670a0c0c48ac526f2028b63e04 |
|
BLAKE2b-256 | 02e0bbce4974aafc81d20aabe6fe30e18bd24b8781b8c42ef9111f451d3fd2d6 |
Hashes for spacy_experimental-0.6.4-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2aaa3e113e1c425762e89de920045358cc5c47352d5716d01d736c8af7074292 |
|
MD5 | 6c31b7f3be82595256bc81c0f177ff24 |
|
BLAKE2b-256 | 38ca53fcc941344bc3e329ebb121dee2a443df64e6c97694754924aef5b6157b |
Hashes for spacy_experimental-0.6.4-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55c9ae75fec46238e582297ab9a90ea31dc59e47ad8335e81e8ea94b885cc943 |
|
MD5 | 18168e694fc6ba3550ae24e3f606dfea |
|
BLAKE2b-256 | f0ae99ea1af519b34deb992f1e63b680573d257b0c834b144896721492a2e710 |
Hashes for spacy_experimental-0.6.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5d69128d81955e843d0f61804fd0eacf98dd77565ea880335a3cb6083a81366 |
|
MD5 | 88d781bfaddd279beeb298fce21c70d6 |
|
BLAKE2b-256 | 993556c636d99bff55751ea62ed490b8b27fcc0f131730edb59a1f02d1a0ed76 |