@ainova-mya/unicode
v1.0.3
Published
Myanmar Unicode processing library
Readme
@ainova-mya/unicode
မြန်မာစာ Unicode processing အတွက် JavaScript / TypeScript library ဖြစ်ပါတယ်။
Myanmar Unicode processing library for JavaScript and TypeScript.
Table of Contents
မြန်မာဘာသာ
အကြောင်းအရာ
@ainova-mya/unicode သည် မြန်မာ Unicode စာသားများကို JavaScript နှင့် TypeScript တွင် စီမံခန့်ခွဲရန်အတွက် ဖန်တီးထားသော library ဖြစ်ပါတယ်။
မြန်မာစာသားများကို:
- Unicode normalization
- Text cleaning
- Unicode validation
- Unicode repair
- Text segmentation
- Tokenization
တို့အတွက် အသုံးပြုနိုင်ပါတယ်။
ဒီ project ရဲ့ ရည်ရွယ်ချက်က မြန်မာစာ processing အတွက် ယုံကြည်စိတ်ချရသော အခြေခံ layer တစ်ခုကို တည်ဆောက်ပေးရန် ဖြစ်ပါတယ်။
အသုံးပြုနိုင်သောနေရာများမှာ:
- OCR စာသားပြုပြင်ခြင်း
- Myanmar Unicode normalization
- Unicode validation
- Text cleaning
- စာသားခွဲခြမ်းခြင်း
- Document processing
- AI pipeline များ
- Search system များ
- RAG system များ
- NLP system များ
လုပ်ဆောင်ချက်များ
Unicode Normalization
မြန်မာ Unicode စာသားများကို တူညီသော format တစ်ခုအဖြစ် ပြောင်းလဲပေးပါသည်။
import { normalizeUnicode } from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
const normalized = normalizeUnicode(text);
console.log(normalized);Whitespace Cleanup
အပို space များ၊ zero-width character များနှင့် line ending များကို ပြင်ဆင်ပေးပါသည်။
import { normalizeWhitespace } from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ မြန်မာစာ';
const cleaned = normalizeWhitespace(text);
console.log(cleaned);Unicode Repair
OCR မှ ထွက်လာသော စာသားများနှင့် text cleaning အတွက် အခြေခံ Unicode repair utilities များ ပါဝင်ပါတယ်။
ပါဝင်သောအရာများမှာ:
- ထပ်နေသော Myanmar mark များ ဖယ်ရှားခြင်း
- ပုံစံတူ character များ ပြင်ဆင်ခြင်း
import { fixConfusable, removeDuplicateMarks } from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
const fixed = fixConfusable(text);
const cleaned = removeDuplicateMarks(fixed);
console.log(cleaned);Validation
Myanmar Unicode စာသားများကို စစ်ဆေးနိုင်ပါတယ်။
import {
containsMyanmar,
containsLatin,
isMyanmarOnly,
isValidUnicode,
} from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
console.log(containsMyanmar(text));
console.log(containsLatin(text));
console.log(isMyanmarOnly(text));
console.log(isValidUnicode(text));အသုံးပြုနိုင်သော API များ:
containsMyanmar()containsLatin()isMyanmarOnly()isValidUnicode()
Segmentation
မြန်မာစာသားများကို အခြေခံအဆင့် ခွဲခြမ်းနိုင်ပါတယ်။
ပါဝင်သော API များ:
segmentLine()segmentParagraph()segmentSentence()segmentSyllable()segmentWord()tokenize()
ဥပမာ:
import {
segmentSentence,
segmentSyllable,
tokenize,
} from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ။ မြန်မာစာကို လေ့လာနေပါတယ်။';
const sentences = segmentSentence(text);
const syllables = segmentSyllable(text);
const tokens = tokenize(text);
console.log(sentences);
console.log(syllables);
console.log(tokens);ထည့်သွင်းခြင်း
npm ဖြင့်
npm install @ainova-mya/unicodepnpm ဖြင့်
pnpm add @ainova-mya/unicodeyarn ဖြင့်
yarn add @ainova-mya/unicodeအသုံးပြုပုံ
TypeScript
import {
normalizeUnicode,
normalizeWhitespace,
tokenize,
} from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
const clean = normalizeWhitespace(normalizeUnicode(text));
console.log(clean);
const result = tokenize(clean);
console.log(result);JavaScript
import {
normalizeUnicode,
normalizeWhitespace,
tokenize,
} from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
const clean = normalizeWhitespace(normalizeUnicode(text));
console.log(clean);
const result = tokenize(clean);
console.log(result);Text Processing Pipeline
Library ထဲက function များကို ပေါင်းစပ်ပြီး မြန်မာစာ processing pipeline တစ်ခုအဖြစ် အသုံးပြုနိုင်ပါတယ်။
import {
normalizeUnicode,
normalizeWhitespace,
fixConfusable,
removeDuplicateMarks,
tokenize,
} from '@ainova-mya/unicode';
const input = 'မင်္ဂလာပါ';
const normalized = normalizeUnicode(input);
const cleaned = normalizeWhitespace(normalized);
const repaired = fixConfusable(cleaned);
const finalText = removeDuplicateMarks(repaired);
const tokens = tokenize(finalText);
console.log(finalText);
console.log(tokens);အခြေခံ processing flow:
Input Text
↓
Unicode Normalization
↓
Whitespace Cleaning
↓
Unicode Repair
↓
Duplicate Mark Removal
↓
Segmentation / Tokenization
↓
Processed Myanmar Textအသုံးပြုနိုင်သော API များ
Normalization
normalizeUnicode(text);
normalizeWhitespace(text);Unicode Repair
fixConfusable(text);
removeDuplicateMarks(text);Validation
containsMyanmar(text);
containsLatin(text);
isMyanmarOnly(text);
isValidUnicode(text);Segmentation
segmentLine(text);
segmentParagraph(text);
segmentSentence(text);
segmentSyllable(text);
segmentWord(text);
tokenize(text);API အကျဉ်းချုပ်
| API | လုပ်ဆောင်ချက် |
| ------------------------ | ---------------------------------------------- |
| normalizeUnicode() | Myanmar Unicode စာသားကို normalize လုပ်ခြင်း |
| normalizeWhitespace() | Space နှင့် line ending များကို သန့်ရှင်းခြင်း |
| fixConfusable() | ပုံစံတူ character များကို ပြင်ဆင်ခြင်း |
| removeDuplicateMarks() | ထပ်နေသော Myanmar mark များ ဖယ်ရှားခြင်း |
| containsMyanmar() | Myanmar character ပါ/မပါ စစ်ခြင်း |
| containsLatin() | Latin character ပါ/မပါ စစ်ခြင်း |
| isMyanmarOnly() | Myanmar စာသားသာ ဖြစ်/မဖြစ် စစ်ခြင်း |
| isValidUnicode() | Unicode စာသား မှန်ကန်မှု စစ်ခြင်း |
| segmentLine() | Line အလိုက် ခွဲခြင်း |
| segmentParagraph() | Paragraph အလိုက် ခွဲခြင်း |
| segmentSentence() | Sentence အလိုက် ခွဲခြင်း |
| segmentSyllable() | Syllable အလိုက် ခွဲခြင်း |
| segmentWord() | Word အလိုက် ခွဲခြင်း |
| tokenize() | Token များအဖြစ် ခွဲခြင်း |
TypeScript Support
ဒီ library ကို TypeScript project များတွင် အသုံးပြုနိုင်ပြီး TypeScript types များလည်း support လုပ်ထားပါတယ်။
import { normalizeUnicode, tokenize } from '@ainova-mya/unicode';
const text: string = 'မင်္ဂလာပါ';
const normalized: string = normalizeUnicode(text);
const tokens = tokenize(normalized);
console.log(tokens);အသုံးပြုနိုင်သောနေရာများ
OCR Processing
OCR မှရရှိလာသော မြန်မာစာသားများကို ပြန်လည်သန့်ရှင်းရန် processing layer အဖြစ် အသုံးပြုနိုင်ပါတယ်။
OCR Output
↓
Unicode Normalization
↓
Whitespace Cleaning
↓
Unicode Repair
↓
Myanmar TextSearch
Myanmar text ကို search engine ထဲသို့ index မလုပ်မီ preprocessing layer အဖြစ် အသုံးပြုနိုင်ပါတယ်။
Raw Text
↓
Normalize
↓
Clean
↓
Segment / Tokenize
↓
Search IndexAI / RAG
Embedding သို့မဟုတ် retrieval မလုပ်မီ မြန်မာစာသားများကို normalize နှင့် clean လုပ်နိုင်ပါတယ်။
Document
↓
Text Extraction
↓
Myanmar Unicode Processing
↓
Text Segmentation
↓
Chunking
↓
Embedding
↓
Vector DatabaseDocument Processing
Document processing pipeline များတွင် foundation layer အဖြစ် အသုံးပြုနိုင်ပါတယ်။
PDF / DOCX / Image
↓
Text Extraction
↓
Myanmar Unicode Processing
↓
Text Segmentation
↓
Structured TextProject Status
Current Version: v1.0.0
Version 1 တွင် အဓိကအားဖြင့်:
- Unicode foundation
- Text cleaning
- Unicode validation
- Unicode repair
- Basic text segmentation
- Basic tokenization
တို့ကို အဓိကထားပြီး တည်ဆောက်ထားပါတယ်။
Future Plans
နောက်လာမည့် version များတွင် အောက်ပါ features များကို ထပ်မံထည့်သွင်းရန် ရည်ရွယ်ထားပါတယ်။
- Advanced Myanmar word segmentation
- Dictionary-based NLP
- Advanced Unicode repair engine
- Spell checking
- OCR optimization
- Myanmar tokenizer improvements
- Advanced Myanmar NLP utilities
License
MIT License
This project is open source and available for personal and commercial use.
ဒီ project ကို MIT License အောက်တွင် open source အဖြစ် ဖြန့်ချိထားပါတယ်။
ကိုယ်ပိုင် project များနှင့် commercial project များတွင် အသုံးပြုနိုင်ပါတယ်။
English
Overview
@ainova-mya/unicode is a Myanmar Unicode processing library for JavaScript and TypeScript.
It provides utilities for processing, cleaning, validating, normalizing, and segmenting Myanmar Unicode text.
The goal of this project is to provide a reliable foundation layer for Myanmar language text processing.
It can be used as a foundation for:
- OCR text processing
- Myanmar text normalization
- Unicode validation
- Text cleaning
- Text segmentation
- Document processing
- AI pipelines
- Search systems
- RAG systems
- Natural Language Processing (NLP)
Features
Unicode Normalization
Normalize Myanmar Unicode text into a consistent format.
import { normalizeUnicode } from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
const normalized = normalizeUnicode(text);
console.log(normalized);Whitespace Cleaning
Remove unnecessary whitespace, zero-width characters, and normalize line endings.
import { normalizeWhitespace } from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ မြန်မာစာ';
const cleaned = normalizeWhitespace(text);
console.log(cleaned);Unicode Repair
Provides basic Unicode repair utilities for OCR output and text cleaning.
Current repair features include:
- Duplicate Myanmar mark removal
- Confusable character correction
import { fixConfusable, removeDuplicateMarks } from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
const fixed = fixConfusable(text);
const cleaned = removeDuplicateMarks(fixed);
console.log(cleaned);Validation
Check Myanmar Unicode content and identify different types of text.
import {
containsMyanmar,
containsLatin,
isMyanmarOnly,
isValidUnicode,
} from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
console.log(containsMyanmar(text));
console.log(containsLatin(text));
console.log(isMyanmarOnly(text));
console.log(isValidUnicode(text));Available validation APIs:
containsMyanmar()containsLatin()isMyanmarOnly()isValidUnicode()
Segmentation
Provides basic Myanmar text segmentation utilities.
Available segmentation APIs:
segmentLine()segmentParagraph()segmentSentence()segmentSyllable()segmentWord()tokenize()
Example:
import {
segmentSentence,
segmentSyllable,
tokenize,
} from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ။ မြန်မာစာကို လေ့လာနေပါတယ်။';
const sentences = segmentSentence(text);
const syllables = segmentSyllable(text);
const tokens = tokenize(text);
console.log(sentences);
console.log(syllables);
console.log(tokens);Installation
npm
npm install @ainova-mya/unicodepnpm
pnpm add @ainova-mya/unicodeyarn
yarn add @ainova-mya/unicodeUsage
TypeScript
import {
normalizeUnicode,
normalizeWhitespace,
tokenize,
} from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
const clean = normalizeWhitespace(normalizeUnicode(text));
console.log(clean);
const result = tokenize(clean);
console.log(result);JavaScript
import {
normalizeUnicode,
normalizeWhitespace,
tokenize,
} from '@ainova-mya/unicode';
const text = 'မင်္ဂလာပါ';
const clean = normalizeWhitespace(normalizeUnicode(text));
console.log(clean);
const result = tokenize(clean);
console.log(result);Processing Pipeline
A typical Myanmar text processing pipeline can be built by combining the provided utilities.
import {
normalizeUnicode,
normalizeWhitespace,
fixConfusable,
removeDuplicateMarks,
tokenize,
} from '@ainova-mya/unicode';
const input = 'မင်္ဂလာပါ';
const normalized = normalizeUnicode(input);
const cleaned = normalizeWhitespace(normalized);
const repaired = fixConfusable(cleaned);
const finalText = removeDuplicateMarks(repaired);
const tokens = tokenize(finalText);
console.log(finalText);
console.log(tokens);The general processing flow is:
Input Text
↓
Unicode Normalization
↓
Whitespace Cleaning
↓
Unicode Repair
↓
Duplicate Mark Removal
↓
Segmentation / Tokenization
↓
Processed Myanmar TextAvailable APIs
Normalization
normalizeUnicode(text);
normalizeWhitespace(text);Unicode Repair
fixConfusable(text);
removeDuplicateMarks(text);Validation
containsMyanmar(text);
containsLatin(text);
isMyanmarOnly(text);
isValidUnicode(text);Segmentation
segmentLine(text);
segmentParagraph(text);
segmentSentence(text);
segmentSyllable(text);
segmentWord(text);
tokenize(text);API Overview
| API | Description |
| ------------------------ | ------------------------------------------------ |
| normalizeUnicode() | Normalize Myanmar Unicode text |
| normalizeWhitespace() | Clean whitespace and line endings |
| fixConfusable() | Repair confusable characters |
| removeDuplicateMarks() | Remove duplicate Myanmar marks |
| containsMyanmar() | Check whether text contains Myanmar characters |
| containsLatin() | Check whether text contains Latin characters |
| isMyanmarOnly() | Check whether text contains only Myanmar content |
| isValidUnicode() | Validate Unicode text |
| segmentLine() | Segment text by lines |
| segmentParagraph() | Segment text by paragraphs |
| segmentSentence() | Segment text by sentences |
| segmentSyllable() | Segment Myanmar text into syllables |
| segmentWord() | Segment Myanmar text into words |
| tokenize() | Tokenize Myanmar text |
TypeScript Support
The library is written with TypeScript support and provides TypeScript types.
import { normalizeUnicode, tokenize } from '@ainova-mya/unicode';
const text: string = 'မင်္ဂလာပါ';
const normalized: string = normalizeUnicode(text);
const tokens = tokenize(normalized);
console.log(tokens);Use Cases
OCR Processing
Useful as a post-processing layer for OCR output.
OCR Output
↓
Unicode Normalization
↓
Whitespace Cleaning
↓
Unicode Repair
↓
Myanmar TextSearch
The library can be used as a preprocessing layer before indexing Myanmar text into search engines.
Raw Text
↓
Normalize
↓
Clean
↓
Segment / Tokenize
↓
Search IndexAI / RAG
Myanmar text can be normalized and cleaned before embedding or retrieval.
Document
↓
Text Extraction
↓
Myanmar Unicode Processing
↓
Text Segmentation
↓
Chunking
↓
Embedding
↓
Vector DatabaseDocument Processing
It can also be used as a foundation layer in document processing pipelines.
PDF / DOCX / Image
↓
Text Extraction
↓
Myanmar Unicode Processing
↓
Text Segmentation
↓
Structured Text