Skip to main content

Fast and Efficient Sentence Tokenization

Project description

Fast Sentence Tokenizer (fast-sentence-tokenize)

Best in class tokenizer

Usage

Import

from fast_sentence_tokenize import fast_sentence_tokenize

Call Tokenizer

results = fast_sentence_tokenize("isn't a test great!!?")

Results

[
   "isn't",
   "a",
   "test",
   "great",
   "!",
   "!",
   "?"
]

Note that whitespace is not preserved in the output by default.

This generally results in a more accurate parse from downstream components, but may make the reassembly of the original sentence more challenging.

Preserve Whitespace

results = fast_sentence_tokenize("isn't a test great!!?", eliminate_whitespace=False)

Results

[
   "isn't ",
   "a ",
   "test ",
   "great",
   "!",
   "!",
   "?"
]

This option preserves whitespace.

This is useful if you want to re-assemble the tokens using the pre-existing spacing

assert ''.join(tokens) == input_text

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

fast_sentence_tokenize-0.1.15.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

fast_sentence_tokenize-0.1.15-py3-none-any.whl (13.9 kB view hashes)

Uploaded Python 3

Supported by

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