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.4.1.tar.gz (16.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.4.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: unicode_segment-0.4.1.tar.gz
  • Upload date:
  • Size: 16.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.4.1.tar.gz
Algorithm Hash digest
SHA256 6182bbd2b8cc1888809f9ec3b753939c8b4e005eda046f08aca873a2ab505d1e
MD5 d5dee76e09d84a1e7ab9d3891226c551
BLAKE2b-256 62ef2021ed549430eaf51ff1b42195446cf2ced105b6f836cdf265042670aa34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for unicode_segment-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 20c98583b8d7239a0eb1b87c7ca1ff1384ee2a60792bcfe05a743073f98e7755
MD5 e49cdacd14185350f934cb4a4853f68b
BLAKE2b-256 638f01170e1662a02316cccbb14aa80e07fa0d40d6ced952c5c0f08bd37831b4

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