A python library for converting text to braille.
Project description
TouchMap
TouchMap is a Python library for converting textual data into Braille representations.
It supports both Grade 1 and 2 Braille. Grade 2 support is under active development.
Features
- Converts plain text (including numbers, punctuation, and scientific notation) into Grade 1 and 2 Braille.
- Supports both Unicode Braille and binary (dot) representation.
- Handles context-sensitive characters like
",x,*,/, and-. - Graceful handling of unsupported characters.
Installation
pip install touchmap
Usage
Import the Function
from touchmap import text_to_braille
Function Signature
def text_to_braille(text: Any, grade: int = 1, characterError: bool = True, binary: bool = False) -> str:
...
Parameters
| Argument | Data Type | Default Value | Required | Description |
|---|---|---|---|---|
text |
Any |
— | Yes | Input to be converted. Accepts strings, numbers, and booleans. |
grade |
1 or 2 |
1 |
No | Braille grade to use - 1 or 2 |
characterError |
bool |
True |
No | If True, raises error on unsupported characters; if False, replaces with space. |
binary |
bool |
False |
No | If True, returns binary (6-dot) format; if False, returns Unicode Braille. |
Example
from touchmap import text_to_braille
text = "The value is -3.14e+10 and x is not multiplication."
braille1 = text_to_braille(text)
braille2 = text_to_braille(text, grade=2)
binary1 = text_to_braille(text, binary=True)
binary2 = text_to_braille(text, grade=2, binary=True)
print("Grade 1 Braille:", braille1)
print("\nGrade 2 Braille:", braille2)
print("\n\nGrade 1 Binary:", binary1)
print("\nGrade 2 Binary:", binary2)
Grade 1 Braille: ⠠⠞⠓⠑ ⠧⠁⠇⠥⠑ ⠊⠎ ⠼⠐⠤⠉⠲⠁⠙ ⠐⠦ ⠼⠁⠚⠈⠢⠼⠐⠖⠁⠚ ⠁⠝⠙ ⠭ ⠊⠎ ⠝⠕⠞ ⠍⠥⠇⠞⠊⠏⠇⠊⠉⠁⠞⠊⠕⠝⠲
Grade 2 Braille: ⠠⠮ ⠧⠁⠇⠥⠑ ⠊⠎ ⠼⠐⠤⠉⠲⠁⠙ ⠐⠦ ⠼⠁⠚⠈⠢⠼⠐⠖⠁⠚ ⠯ ⠭ ⠊⠎ ⠝ ⠍⠥⠇⠞⠊⠏⠇⠊⠉⠁⠞⠊⠕⠝⠲
Grade 1 Binary: 000001011110101100100100000000101011100000101010100011100100000000011000011010000000010111000100000011110000001101100000110100000000000100001011000000010111100000011100010000001001010111000100001110100000011100000000100000110110110100000000110011000000011000011010000000110110100110011110000000110010100011101010011110011000111010101010011000110000100000011110011000100110110110001101
Grade 2 Binary: 000001011011000000101011100000101010100011100100000000011000011010000000010111000100000011110000001101100000110100000000000100001011000000010111100000011100010000001001010111000100001110100000011100000000111011000000110011000000011000011010000000110110000000110010100011101010011110011000111010101010011000110000100000011110011000100110110110001101
Roadmap
- Implementation of partial word conversion in grade 2.
- Development of a web API for trying TouchMap online.
- Bugfixes
Meta
License: Apache License 2.0
Author: Yajat Pathak
By Kayak for Braillent
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
touchmap-0.3.5.tar.gz
(10.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
touchmap-0.3.5-py3-none-any.whl
(12.7 kB
view details)
File details
Details for the file touchmap-0.3.5.tar.gz.
File metadata
- Download URL: touchmap-0.3.5.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7804587b4148dc5d0c4775c833fb2803e42342097254c3d3bfa9f426019b71d
|
|
| MD5 |
daf8494504e1906d883e416b77eb13bd
|
|
| BLAKE2b-256 |
6d64035ae238f103a64bf774b6d9fdbedb6ecfba40416664f8f6e9ee954941c5
|
File details
Details for the file touchmap-0.3.5-py3-none-any.whl.
File metadata
- Download URL: touchmap-0.3.5-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eca1996c5034c31f765e75d3ed6ca00ac3ec3cee75ea33698a8d7026ad8e778
|
|
| MD5 |
c30dfcbead2a02a56b9a4b69add8a6b8
|
|
| BLAKE2b-256 |
6d0fe0c329d3ee334a15a3a95c1ed00d2a5529d1ba367e9058247c35c1746152
|