spaCyEx
spaCyEx is a powerful extension for spaCy, designed to make pattern matching as flexible and easy as using regular expressions. It builds upon the existing capabilities of spaCy's Matcher, enhancing it with a more accessible syntax for defining complex patterns. spaCyEx allows for intuitive and detailed text pattern specifications, perfect for extracting detailed linguistic features from texts.
Installation
You can install spaCyEx via pip:
pip install spacyex
Features
- Create complex matching patterns using a simple syntax.
- Supports all dictionary properties that are used by spaCy's
Matcher. - Easy integration with existing spaCy pipelines.
Usage
Here is a simple example to get started with spaCyEx:
import spacyex as se
import spacy
nlp = spacy.load("en_core_web_sm")
text = "John Smith runs fast, but Jacob Smith walks slowly."
pattern = "(ent_type=person|op={2}) (lemma=in[run,walk]) (pos=ADV)"
results = se.search(pattern, text, nlp)
for match in results:
print(match[0].text, "Start:", match[1], "End:", match[2])
This code will match sequences in the text based on the defined pattern, using named entities, lemmas, and parts of speech.
Roadmap
- Support for all dictionary properties in patterns.
- Additional utilities and helper functions for more complex pattern scenarios.
Metadata
Release files for spacyex 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spacyex-0.0.2.tar.gz | 2.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spacyex-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.7 kB
Release files / spacyex-0.0.2.tar.gz
| Download URL | spacyex-0.0.2.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6331f90f6cdedaa1e0462fbe4d4179db06c3e545dc009deb3dfa860c87f95a35
|
|
BLAKE2b-256 checksum How to use checksums |
96412f569240372beb4567e797265e9fae66f89e12187516985edc2af5cbece4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / spacyex-0.0.2-py3-none-any.whl
| Download URL | spacyex-0.0.2-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
105f7d5c553efe62d8db64fbb26745d2b76a139d149fbf40d79497d594d344b1
|
|
BLAKE2b-256 checksum How to use checksums |
f42521b1548540af49a3192924957e4d420b4c8d946b1230abdcef9e83103e2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|