Skip to content

BUG BrailleConverter output is ambiguous: "1a" encodes the same as "11", and "$" uses the period cell #3532

Open

Description

@barkha1research-ai

Describe the bug

BrailleConverter produces the same braille for different inputs in two cases, so the encoded prompt cannot be read back unambiguously:

  1. A letter from a to j directly after a number is written without the letter sign (dots 56, ⠰). In braille the letters a to j share their cells with the digits 1 to 0, so 1a and 11 both become ⠼⠁⠁.
  2. $ is mapped to ⠲, the period cell, so $5 and .5 both become ⠲⠼⠑. The Unified English Braille dollar sign is dot 4 followed by dots 234 (⠈⠎), which is also how liblouis's UEB table (en-ueb-chardefs.uti: sign $ 4-234) defines it.

liblouis's UEB grade 1 table (en-ueb-g1.ctb) marks a to j as the letters that need the letter sign after a number (numericnocontchars, nonumsign 56).

Steps/Code to Reproduce

import asyncio

from pyrit.converter import BrailleConverter


async def main():
    converter = BrailleConverter()
    for prompt in ["1a", "11", "$5", ".5"]:
        result = await converter.convert_async(prompt=prompt)
        print(prompt, result.output_text)


asyncio.run(main())

Expected Results

1a ⠼⠁⠰⠁
11 ⠼⠁⠁
$5 ⠈⠎⠼⠑
.5 ⠲⠼⠑

Actual Results

1a ⠼⠁⠁
11 ⠼⠁⠁
$5 ⠲⠼⠑
.5 ⠲⠼⠑

Versions

  • PyRIT version: installed from main (246b659e) in editable mode
  • Python version: 3.12

I have a fix for both and would like to open a PR for it.

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions