Skip to main content

Lucytok

Lucene's boring English tokenizers recreated for Python. Compatible with SearchArray.

Lets you configure a handful of normal tokenization rules like ascii folding, posessive removal, both types of porter stemming, English stopwords, etc.

Usage

Creating a tokenizer close to Elasticsearch's default english analyzer

from lucytok import tokenizer
es_english = tokenizer("Nsp|NNN|ls1")
tokenized = es_english("The quick brown fox jumps over the lazy døg")
print(tokenized)

Outputs

['_', 'quick', 'brown', 'fox', 'jump', 'over', '_', 'lazi', 'døg']

Make a tokenizer with ASCII folding...

from lucytok import tokenizer
es_english_folded = tokenizer("asp|NNN|ls1")
print(es_english_folded("The quick brown fox jumps over the lazy døg"))
['_', 'quick', 'brown', 'fox', 'jump', 'over', '_', 'lazi', 'dog']

Spec

Create a tokenizer using the following settings (these concepts correspond to their Elasticsearch counterparts):


#  |- ASCII fold (a) or not (N)
#  ||- Standard (s) or WS tokenizer (w)
#  ||- Remove possessive suffixes (p) or not (N)
#  |||
# "NsN|NNN|NNNN"
#      ||| ||||
#      ||| ||||- Porter stem version (1) or version (2) vs N/0 for none
#      ||| |||- Manually convert irregular plurals (p) or not (N)
#      ||| ||- Blank out stopwords (s) or not (N)
#      ||| |- Lowercase (l) or not (N)
#      |||- Split on letter/number transitions (n) or not (N)
#      ||- Split on case changes (c) or not (N)
#      |- Split on punctuation (p) or not (N)

Download files

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

Source Distribution

lucytok-0.1.2.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

lucytok-0.1.2-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file lucytok-0.1.2.tar.gz.

File metadata

  • Download URL: lucytok-0.1.2.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Darwin/24.0.0

File hashes

Hashes for lucytok-0.1.2.tar.gz
Algorithm Hash digest
SHA256 31e08b72e1b80fe90e5fe26f16f2fdad9ab58c47cafce275785516efa39d2fd6
MD5 93e78d2fa8927f140f1ff9f9aa8d9213
BLAKE2b-256 bea3da755f9db232781125e4548bb96c8a52077618fd63ad445f631a08fea5c5

See more details on using hashes here.

File details

Details for the file lucytok-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: lucytok-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Darwin/24.0.0

File hashes

Hashes for lucytok-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a6659e7123cfb315d12db59795c61393b7d67e4181fce6c4cf324a61498b1511
MD5 4910e8e4474b3b9250c18e805af47d1e
BLAKE2b-256 8e65c6a58e710430e8b965916a05f2a6981b27b86f27762a1c9d9594958b1305

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 Sentry Error logging StatusPage Status page