Skip to main content

An extension for spaCy, making pattern matching as flexible as using regular expressions.

Project description

spaCyEx

spacy ex logo

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spacyex-0.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

spacyex-0.0.1-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file spacyex-0.0.1.tar.gz.

File metadata

  • Download URL: spacyex-0.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for spacyex-0.0.1.tar.gz
Algorithm Hash digest
SHA256 04e1b2ab58046062a1c81bb5b8dd31f9c47e63dd5b66a48d39ffddc17fa11f76
MD5 bba4d25389cf4a20ce263fd12b6b80b6
BLAKE2b-256 b1430a7c482df499e6b6d1f169ead986af3452ac09c7f2eec9286609ea8395aa

See more details on using hashes here.

File details

Details for the file spacyex-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: spacyex-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for spacyex-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6978deea16055bc9f05fcac723161c71a2f3d17c4226a52b316ce41dc2e44229
MD5 e994428a19260a646661dafca09f2400
BLAKE2b-256 e09ce768a38d0d5da002e73021062410dc664afe6065b58a720b0491cca306a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page