Skip to main content

Segment text with Unicode TR29-compliant segmenters.

Project description

Unicode Segment

Segment text with Unicode TR29-compliant segmenters.

Usage

from unicode_segment import SentenceSegmenter

text = """This, that, the other thing, etc. Another sentence... A, b, c, \
etc., and more. D, e, f, etc. and more. One, i. e. two. Three, i. e., four. \
Five, i.e. six. You have 4.2 messages. Property access: `a.b.c`."""

segmenter = SentenceSegmenter()
segments = segmenter.segment(text)

assert list(segments) == [
    (0, "This, that, the other thing, etc. "),
    (34, "Another sentence... "),
    (54, "A, b, c, etc., and more. "),
    (79, "D, e, f, etc. and more. "),
    (103, "One, i. e. two. "),
    (119, "Three, i. e., four. "),
    (139, "Five, i.e. six. "),
    (155, "You have 4.2 messages. "),
    (178, "Property access: `a.b.c`."),
]

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

unicode_segment-0.2.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

unicode_segment-0.2.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file unicode_segment-0.2.0.tar.gz.

File metadata

  • Download URL: unicode_segment-0.2.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for unicode_segment-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cdf74ede174aafd7a02ad7ffdb5ebe398e97ea3eb2ed472e1be9a07378eb0632
MD5 4c1061246bb0b1ea668fb6c9a7dfe0f8
BLAKE2b-256 f44f448797bd67246e72e56d24046e47de19a0a605bdcf4cbf35fa05958e352f

See more details on using hashes here.

File details

Details for the file unicode_segment-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for unicode_segment-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4ae97164a03cc4a25fb2a9931bb7470f43b471ccbe2f822be5f1b6145272633
MD5 301d4a6ec2d0e25fe94057b74d8363e5
BLAKE2b-256 c3077e2bf26c6fb86a551cc8d90cc630ba186ee41a653b58c7b006ccb262ad3f

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