Braillify Korean Braille Translation Library

repository·main·Indexed 41 days ago

https://github.com/dev-five-git/braillify

A real-time, open-source Korean Braille translation library built in Rust and designed according to the 2024 revised Korean Braille regulations. It provides cross-platform support for Node.js, Python, Rust, WebAssembly, .NET (C#), Java, Kotlin, and C/C++ bindings.

Tokens
44.9K
Snippets
110
Records
238
Agent score
51%

What's inside Braillify

  1. Overview of Braillify

    main

    Braillify is a fully open-source Korean Braille translation library. It is designed to comply with the 2024 revised Korean Braille regulations and is licensed under the Apache License 2.0.

    Key features include:

    • Compliance: Adheres to the 2024 revised Korean Braille standards.
    • Open Source: Fully open-source under Apache License 2.0.
    • Performance: Built with Rust for native performance.
    • Multi-language Support: Provides bindings for popular languages including Node.js, Python, C, Go, Java/Kotlin (JVM), and .NET.
  2. Overview of braillify features

    main

    braillify is a real-time Korean Braille translation library. Key features include:

    • 2024 Revised Korean Braille Standards: Designed and implemented based on the latest 2024 regulations, providing context-aware and accurate translations.
    • Fully Open Source: Unlike many existing Braille translators that rely on closed-source APIs, braillify is fully open-source, allowing for local execution and community improvement.
    • Rust-based Cross-platform Support: Built with Rust, it supports Node.js, Rust, and Python environments. It also supports WebAssembly (Wasm), enabling local execution without network dependencies.
  3. Overview of the 2025 NIKL Corpus Analysis and Inquiry

    main

    This document outlines an inquiry regarding the 2025 National Institute of Korean Language (NIKL) Korean-Braille parallel corpus. The goal is to reconcile the corpus's braille reference values with the 2024 Revised Korean Braille Regulations.

    The analysis aims to prevent automated braille translators from creating arbitrary exception rules by categorizing discrepancies into three types:

    1. Cases where the braille form can be determined by current regulations, requiring only a check of the corpus reference value.
    2. Cases requiring external semantic information (e.g., pronunciation, document genre, or whether a string is a mathematical formula) to determine the braille form.
    3. Cases involving characters or boundaries not specified in current regulations that require new interpretation.

    For each discrepancy, the inquiry seeks the correct braille cell arrangement, the specific regulation clause applied, and whether the corpus value needs correction.

  4. Handle consecutive Roman uppercase-word re-entry

    main

    Korean rule 29 specifies that for consecutive Roman items, the Roman indicator is placed only before the first item and the terminator only after the last (e.g., Los Angeles).

    The Re-entry Problem: A duplicate-event boundary can occur when the character emitter is already in Roman mode (e.g., after a mixed Korean/punctuation word) and encounters a later uppercase word. This can cause the system to incorrectly insert an explicit Roman-entry event.

    The Fix: The EnterEnglish event is made idempotent. If the final emit state is already inside a Roman section, the event neither names an input nor changes the entry of a new section. This prevents duplicate events without changing the underlying multiword ASCII text processing.

  5. Interpret Number + ASCII Suffixes (Units, Identifiers, Fractions)

    main

    The system must distinguish between measurement units, model names, variables, and mathematical fractions when encountering ASCII characters immediately following numbers.

    Decision Criteria:

    • Units: Suffixes like m, M, G, p, bp, or GB change meaning based on case and domain. Determine if they should be treated as units or part of a name.
    • Ranges: In patterns like 3.5~8.5m, identify the boundaries for the range symbol and the unit.
    • Fractions: Determine if 1/2 is a simple slash notation or a mathematical fraction. If it is a fraction, apply the appropriate Braille rules even if the input is not LaTeX.
    • Ambiguity: For ambiguous cases like 98M (could be a quantity, model name, or variable), metadata may be required to ensure correct translation.
    • Case Sensitivity: Decide if the case of the unit (e.g., m vs M) must be preserved to produce different Braille outputs.
  6. Understand corpus analysis classification policies

    main

    The corpus analysis tool classifies results into several primary categories to guide debugging and rule verification. These classes act as evidence gates for determining if an issue is a bug, an unsupported character, or a rule that needs clarification.

    Primary Classes

    • exact: The output matches the expected reference exactly.
    • corpus_suspect: Reserved for independently detectable contradictions, such as conflicting duplicate references or localized reference-cell signatures that contradict explicit PDF/UEB rules.
    • pending_rule_review: Contains candidates (foreign text, numbers, punctuation, Korean) that have not yet been resolved against the PDF.
    • unsupported_character_review: Encoding failures caused by singleton characters whose support obligation has not been confirmed from the PDF.
    • unclassified_encoding_error_review: Other encoding failures that lack a PDF-backed implementation obligation or a reproducible corpus issue.
    • implementation_defect: Restricted to defects independently confirmed from the PDF (e.g., specific rule ordering signatures).

    Reproducible Reasons

    When a record is not exact, it is further categorized by a specific reason, such as:

    • foreign_text_rule_review
    • number_rule_review
    • punctuation_rule_review
    • rule34_roman_indicator_before_opening_parenthesis
    • ueb_capitalized_passage_written_as_separate_capital_words
    • ueb_grade1_before_nonstanding_opening_parenthesis
    • roman_ellipsis_uses_korean_cells_in_roman_enclosure
  7. Korean-to-Roman hyphen boundary routing

    main

    When handling Roman text within a Korean sentence at a hyphen boundary, the engine uses the following routing logic based on Korean rules 29, 33, and 35-36:

    Input TypeRouting PathExample
    Capital-led or multi-letter Roman identifierProse하쿠토-R, 기장-KBO, 온다-life
    Single lowercase variableMathematics값-x
    Token with explicit mathematical operatorMathematics값-X+1

    Note on Compatibility: The analyzer applies U+2160-U+217F compatibility expansion before testing word grammar. For example, 천궁-Ⅱ is audited as the equivalent 천궁-II boundary.

  8. Handle Ampersand (&) and Roman Character/Number Sequences

    main

    When processing ampersands in Braille translation, determine if the ampersand is part of a single Roman character run or a standalone symbol.

    Key considerations:

    • Integrated Sequences: Patterns like A&B, S&P500, R&D, or AT&T5G may be treated as a single Roman character run.
    • Right-side only: Structures like &c (where only the right side has Roman characters) require specific boundary handling.
    • Contextual Priority: When an ampersand is attached to Korean characters (e.g., 과학&ICT), a standalone symbol (e.g., 종이접기 & 클레이아트), or inside parentheses (e.g., &TEAM), the priority of Braille rules must be determined based on whether it is treated as a symbol or part of a Roman run.
    • Numeric Continuity: If a number follows an ampersand (e.g., S&P500), check if the Roman-to-Number continuity rules (Rule 35) apply.
  9. Identify foreign text rule review candidates

    main

    A significant portion of mismatches in the NIKL 2025 v1.0 corpus are flagged as pending_rule_review with the sub-reason foreign_text_rule_review. These typically occur when the engine processes alphanumeric strings, acronyms (e.g., SPRi, SSEn, COO, CTO), or mixed-language contexts.

    When debugging, check the first differing cell (zero-based) to pinpoint exactly where the Braille translation deviates from the expected standard for foreign/alphanumeric text.

  10. Understand NIKL 2025 v1.0 Corpus Analysis Results

    main

    The NIKL 2025 v1.0 corpus analysis is used to evaluate the accuracy of the Braillify engine against expected Braille outputs. The analysis categorizes results into three primary states:

    • exact: The actual Braille output matches the expected output perfectly.
    • localized_mismatch: The output differs from the expected output, often due to specific rule triggers (e.g., foreign_text_rule_review). These are often flagged as pending_rule_review.
    • mismatch: General discrepancies that may be caused by suspected corpus issues or specific rule violations (e.g., rule34_roman_indicator_before_opening_parenthesis).

    When debugging, the first differing cell (zero-based) index identifies exactly where the engine's output diverged from the expected sequence.

  11. Understand Korean Rule 37 and UEB capitalization context

    main

    According to NIKL Q&A #325, the six lower wordsigns specified by Korean Rule 37 remain expanded when Roman words are discussed within a Korean context.

    In contrast, a recognizable English title or phrase follows UEB 10.5 and uses a lower wordsign only when it stands alone and satisfies the lower-sign adjacency restriction. The encoder distinguishes these contexts based on input structure, capitalization, and enclosure boundaries, rather than analyzer references or competitor fields.

  12. Handle Roman text joined by ampersands (&)

    main

    According to UEB 8.4.2, capitals-word mode terminates at a nonalphabetic symbol. For segments joined by an ampersand (e.g., AT&T or B&B), the Roman mode remains continuous, but capitalization restarts for each ASCII-letter segment.

    Braillify's detector for this pattern:

    • Accepts only complete uppercase ASCII segments joined directly by &.
    • Requires the run to begin at its whitespace-delimited token.
    • Excludes occurrences that are Korean-attached or punctuation-prefixed.