python-bidiBi-directional (BiDi) layout implementation in pure Python | |
Download |
python-bidi Ranking & Summary
Advertisement
- License:
- LGPL
- Price:
- FREE
- Publisher Name:
- Meir Kriheli
- Publisher web site:
- http://github.com/mksoft/
python-bidi Tags
python-bidi Description
Bi-directional (BiDi) layout implementation in pure Python python-bidi is a bi-directional layout implementation in pure Python.APIThe algorithm starts with a single entry point bidi.algorithm.get_display.Required arguments: * unicode_or_str: The orginal unicode or string (i.e: storage). If it's a string use the optional argument encoding to specify it's encoding.Optional arguments: * encoding: If unicode_or_str is a string, specifies the encdoing. The algorithm uses unicodedata which requires unicode. This encoding will be used to decode and encode back to string before returning (default: "utf-8"). * upper_is_rtl: True to treat upper case chars as strong 'R' for debugging (default: False). * debug: True to display (using sys.stderr) the steps taken with the algorithm (default: False).Returns the display layout, either as unicode or encoding encoded string (depending on the type of unicode_or_str').Example:>>> from bidi.algorithm import get_display>>> get_display(u'car is THE CAR in arabic', upper_is_rtl=True)u'car is RAC EHT in arabic'CLIpybidi is a command line utility (calling bidi.main) for running the bidi algorithm. the script can get a string as a parameter or read text from stdin. Usage:$ pybidi -hUsage: pybidi Options: -h, --help show this help message and exit -e ENCODING, --encoding=ENCODING Text encoding (default: utf-8) -u, --upper-is-rtl treat upper case chars as strong 'R' for debugging (default: False). -d, --debug Display the steps taken with the algorithmExamples: $ pybidi -u 'car is THE CAR in arabic' car is RAC EHT in arabic $ cat ~/Documents/example.txt | pybidi ...Running tests--------------To run the tests:python -m bidi.tests Requirements: · Python What's New in This Release: · Test for surrogate pairs · Fix indentation in documentations · Specify license in setup.py
python-bidi Related Software