Skip to main content

treg utilizes trie structured regex patterns to search texts for a potientially large number of words and phrases.

Project description

treg 0.0.3

treg utilizes trie structured regex patterns to search texts for a potientially large number of words and phrases.

Experimental state

This project is in an early and experimental state and might be subject substantial changes in the future.

Documentation

Documentation is available at https://treg.readthedocs.io

Getting started

from treg import Treg, Phrase, Match

# Initialize a new pattern
treg = Treg()
# Add some phrases
treg.add_phrases([
    Phrase(phrase='afternoon tea', meta={'fun': 1}),
    Phrase(phrase='tea party', meta={'fun': 3}),
    # ...
])
# Compile the pattern
treg.compile()
# Happy searching!
for match in treg.find_iter(
        "A long collection of afternoon tea party recipes ...",
        overlapped=True):
    print(match)

# Output
Match(phrases=[Phrase(phrase='afternoon tea', meta={'fun': 1})], start=16, end=29)
Match(phrases=[Phrase(phrase='tea party', meta={'fun': 3})], start=26, end=35)

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

treg-0.0.3.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

treg-0.0.3-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file treg-0.0.3.tar.gz.

File metadata

  • Download URL: treg-0.0.3.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for treg-0.0.3.tar.gz
Algorithm Hash digest
SHA256 216ee78ffc1a7b5562084dd8b619e6f646bb876ef3cde9a5425d1ddd0e242878
MD5 4c419563501638d180a1f39aebb2725d
BLAKE2b-256 7939c6863e9860c141e74cb68aaf2eae7f04e701be125d499f399baaadeebd4f

See more details on using hashes here.

File details

Details for the file treg-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: treg-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for treg-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2359255d413dac00987ed2770c9c6c6f186fc9a8cbdc17b5239717e8c9f96f81
MD5 27e28186860458b1f650a28fa6a6661e
BLAKE2b-256 a1842e5ae179ed553eb2104c4c16c08604f432931f128f6e31927b63cb91ea5b

See more details on using hashes here.

Supported by

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