# uniseg-python

A pure Python module to determine Unicode text segmentations

## Features

This package provides:

• Functions to get Unicode Character Database (UCD) properties concerned with text segmentations.
• Functions to determin segmentation boundaries of Unicode strings.
• Classes that help implement Unicode-aware text wrapping on both console (monospace) and graphical (monospace / propotional) font environments.

Supporting segmentations are:

code point
Code point is "any value in the Unicode codespace." It is the basic unit for processing Unicode strings.
grapheme cluster
Grapheme cluster approximately represents "user-perceived character." They may be made up of single or multiple Unicode code points. e.g. "G" + acute-accent is a user-perceived character.
word break
Word boundaries are familiar segmentation in many common text operations. e.g. Unit for text highlighting, cursor jumping etc. Note that words are not determinable only by spaces or punctuations in text in some languages. Such languages like Thai or Japanese require dictionaries to determine appropriate word boundaries. Though the package only provides simple word breaking implementation which is based on the scripts and doesn't use any dictionaires, it also provides ways to customize its default behaviours.
sentensce break
Sentence breaks are also common in text processing but they are more contextual and less formal. The sentence breaking implementation (which is specified in UAX: Unicode Standard Annex) in the package is simple and formal too. But it must be still useful in some usages.
line break
Implementing line breaking algorithm is one of the key features of this package. The feature is important in many general text presentations in both CLI and GUI applications.

## Requirements

• Python 2.7 / 3.3

Source distribution (PyPI)
https://pypi.python.org/pypi/uniseg
All sources and build tools etc. (Bitbucket)
https://bitbucket.org/emptypage/uniseg-python

## Install

# python setup.py install


## Changes

0.6.2 (2013-06-09)
• Python 3.3
0.6.1 (2013-06-08)
• Unicode 6.2.0

## References

UAX #14: Unicode Line Breaking Algorithm (6.2.0)
http://www.unicode.org/reports/tr14/tr14-30.html
UAX #29 Unicode Text Segmentation (6.2.0)
http://www.unicode.org/reports/tr29/tr29-21.html