Loading

Well, Its Level 5 Now (Swine Flu)

http://www.cnn.com/2009/HEALTH/04/29/swine.flu/index.html

ဒါေပမယ့္ H1N1 ေသနွုန္းကေတာ့ ငွက္တုပ္ေကြးေလာက္ မျပင္းဘူးလို့ျကားမိပါတယ္။ အရမ္းမဆိုးရြားသြားေလာက္ဘူး ထင္ရပါတယ္။

H1N1 ပ်ံ့နွံ့မွု အေျခအေန

# Picture taken from http://www.healthmap.org/en which is using Google Maps.


တကယ်သာ လူလူခြင်း လေထဲက ကူးတယ်ဆိုရင် ၃လအတွင်း တကမ္ဘာလံုး လူတဈဝက်လာေက် လာ့ေျသွားနိုင်တယ်။

Spell Suggestion with Client/Server Theory

C:\spell> server.py
"Spell Suggestion Server Started"

C:\spell> client.py
>>> ကခ်ြာေကခြွတ်
%%% ကခ်ာေျကခွျတ်
>>>
>>> အကြပ်အတည်း
%%% အကျပ်အတည်း
>>>

Spell Correction is same as my other posts, but Main Point of doing as Client/Server Program is the speed of data load.

for eg., ဥပမာ စာလံုး ၃ သာေင်းရိတယ်ဆိုပါစို့။ အဲဒီစာလံုးတွေကို disk ကနေ memory ပ်ါေကိုဖတ်တင်ဖို့ အျခိန်လိုမယ်။ စာလံုးတိုင်းကို တဈခါ ပြန် load လုပ်ရတယ်ဆိုမဟုတ်သးေဘူး။ ဥပမာ web page ဆိုရင် user request တိုင်းမာ ဒေတာတွေ ပြန်ပြန်ဖတ်နေရင် ဆာဗာအတွက်ရာေ ကြာတဲ့အျခိန်အတွက်ရာေ မကာေင်းဘူး။ အကယ်၍ စာလံုး ၃သိန်းဆိုရင် ပိုနးေသွားမာပါ့ေ။

Spell Server အနေနဲ့ Run ထားရင် တဈခါတည်း memory ပ်ါေမာ တင်ထားပြီးသားဖြဈတဲ့ အတွက်ကြာေင့် လိုတာလးေရာလိုက်ရံုပဲ။

Web Server ပ်ါေမာ Spell Server ကို Run ထားပြီး Web Server ပ်ါေက script ကနေပြီး spell server ကို client အနေနဲ့ လမ်းျခိတ် ပြီး စာလံုးပါေင်းတွေ ပြန်ထုတ်ပးေတဲ့နည်းပါ။

Web Server နဲ့ Spell Server စက်တဈလံုးတည်း ဖြဈဖို့လိုပါတယ်။ မတူရင် ဘာမ အဓိပ္ပါယ်မရိပါဘူး။

Cheers,
Soe Min

ဝက္တုပ္ေကြး Phase 3 မွ Phase 4 အဆင့္သို့ေရာက္ရွိေနပံုေပါ္

http://www.yomiuri.co.jp/world/news/20090428-OYT1T00154.htm?from=top

http://www.who.int/csr/disease/avian_influenza/phase/en/index.html

အဆင့္ ၆ဆင့္ရွိျပီး ၄ ဟာ နိုင္ငံတစ္ခုကတစ္ခု အစုလိုက္အျပံုလိုက္ ကူးစက္နိုင္တယ္လို့လဲေရးထားပါတယ္။

ေနာက္ျပီး verified human-to-human transmission လူလူျခင္းကူးနိုင္တယ္လို့လဲ ဆိုထားပါတယ္။

ယံုတာမယံုတာေတာ့ its up to you :-)

for me I still dont care :D

Making Myanmar Syllables to fit in 16 bit

//3 bit 0-7
enum vow1{A=0,AR,I,U,O,AWW,AW,AY}
အ၊ အာ၊ အိ or အီ၊ အု or အူ၊ အို၊ အာေ၊ အ်ာေ၊ အေ

//4 bit 0-15
char cons1{1,1,1,1,
2,3,3,3,3,4,4,5,6,5,
5,7,5,6,5,5,7,8,9,8,
8,10,11,11,12,13,14,15,12,0}

၃၃လံုးကို ၁၆ လံုး မဖြဈဖြဈအာေင်လုပ်ထားရပါတယ်။ စိတ်တိုင်းမကဩးေပါဘူး။
ဗျည်းတွေကို အသံထွက်တာဆင်တာနဲ့ အသံပာ့ေျအသံမာတွေကို အားလံုးပါေင်းပဈမ ၁၆ လံုးနဲ့ရပါတယ်။

က၊ ခ၊ ဂ၊ ဃ - ၁
င - ၂
စ၊ ဆ၊ ဇ၊ ဈ - ၃
ဉ၊ ည - ၄
ဋ၊ ဍ၊ ဎ၊ တ၊ ဒ၊ ဓ - ၅
ဌ၊ ထ - ၆
ဏ၊ န - ၇
ပ၊ ဗ၊ ဘ - ၈
ဖ - ၉
မ - ၁၀
ယ၊ ရ - ၁၁
လ၊ ဠ - ၁၂
ဝ - ၁၃
သ - ၁၄
ဟ - ၁၅
အ - ၀

အသတ်အတွက်လည်း နာေက်ထပ် ၄ bit လိုပါတယ်။

3 bit + 4 bit + 4 bit = 11 bit ဖြဈနေပါပြီ။

အာေက်ကမြဈ၊
ဝဈစပါေက်၊
ရရဈသို့ ရပင်း၊
ဝဆွဲ
ဟထိုး

ဆိုတဲ့ ငါးလံုးဟာ တွဲချင်တဲ့ စာလံုးမာ တွဲနိုင်တာကြာေင့် သူတို့ကို သပ်သပ် 1 bit စီပးေမရပါမယ်။

//5bit
#define AUTMYIT1 0x01
#define WITSAPAUT1 0x02
#define YPYY1 0x04
#define WASWEL1 0x08
#define HAHTOE1 0x10

၁၆ bit အကုန်ပြည့်သွားပါပြီ။ သိပ်စိတ်တိုင်းမကဩးေဘူး။ ဗျည်းတွေကို နာေက်ထပ် 1 bit လာေက်ပးေနိုင်ရင် ပိုသပ်သပ်ရပ်ရပ် ရလာမယ်။

# အဲ.. အဲဒီလို့ ၁၆ bit အနေနဲ့ ခွဲနိုင်ခြင်းအားဖြင့် ဘာလုပ်လို့ရနိုင်လဲဆိုတာ့ေ syllable list မလိုပဲနဲ့ syllable ကို နံပါတ်ပြာေင်း နံပါတ်ကနေ syllable အဖြဈ လျင်မြန်စွာ ပြာေင်းနိုင်ပါတယ်။

ဘယ်လိုမ မတတ်သာရင်တာ့ေ 32 bit နဲ့လုပ်ပြီး အကုန်လံုးမသံုးပဲနဲ့ 18 bit လာေက်အထိသံုးထားနိုင်ရင် အဆင်ပြေမယ်ထင်ပါတယ်။

ဘာလို့ bit ျမားျမားမသံုးချင်တာလဲဆိုရင်တာ့ေ memory ပ်ါေမာ အလုပ်လုပ်ရတာ သက်သာအာေင်ပါ။
16 bit ဆိုရင် 2^16 = 65536 = 64KB
18 bit ဆိုရင် 2^18 = 262144 = 262KB
32 bit ဆိုရင် 2^32 = 4GB ဘယ်လိုမ 4GB memory သံုးဖို့မဖြဈနိုင်ပါဘူး။ ဒါကြာေင့်နဲနိုင်သမျနဲအာေင် လုပ်ရတယ်။

I am Listening ...

絢香 - I BELIEVE
http://www.youtube.com/watch?v=qSobb9w_4JE

絢香 - 三日月
http://www.youtube.com/watch?v=cGGIBgCuTTs

小田和正 -たしかなこと
http://www.youtube.com/watch?v=I-yHDph56Rk

Memo# Running Python under Apache and Displaying Unicode Characters

# Running like cgi scripts not using mod_python
# Running under Unix/Linux

Codes, I am using to test those

#!/usr/bin/python
- Need to put exact python location, use which python to check

# coding: utf8
- need to have 3 parts coding, :, utf8, others like -*- in -*- coding: utf-8 -*- are just bla bla.

print "Content-type: text/html"
print
- to print out html, need to have put Content-type and blank line for end of Header

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">'
- print out meta tag to tell browser about UTF-8 encoding

print "က" # direct output 
print "\xe1\x80\x80" # utf8 encoding for က
print u"\u1000".encode("utf8") #ucs2 or ucs4 to utf8 encoding
print "&#x1000;" #html entity hex
print "&#4096;" #html entity numeric
- many ways to print out unicode characters like above :-)

import cburglish
print cburglish.detect(u"\u1000\u1031") # က - 13 - Unicode 5.1
print cburglish.detect(u"\u1031\u1000") # ေက - 6 - Zawgyi
print cburglish.zawgyi2unicode(u"\u1031\u1000") # ေက - to - က
- just testing my cburglish library

import cgi
f=cgi.FieldStorage()
print f
- to get information like form input or query string.

- save this .py file itself as utf8 encoding

- and finally file need to be executable, use chmod +x test.py for that.

Cheers,
Soe Min

ငွက္တုပ္ေကြးျပီးေတာ့ ဝက္တုတ္ေကြးလား

http://www.anzen.mofa.go.jp/info/spot_top5.asp?id=221&num=1

【最新スポット情報】
メキシコ及び米国の一部の州:H1N1亜型由来豚インフルエンザの発生について (2009/04/25)
မက္ကဆီကို အျခို့နေရာျမားတွင် ဖြဈပွားခြင်းတွ့ေရိ (ဧပြီလ ၂၅ရက်)
၈၈၂မုခန့်ဖြဈပွား။ ၆၂ယာေက်သေ။ အဲဒီအထဲက ၉ယာေက်ကို ဝက်တုတ်ကွးေလို့ စဈဆးေဆံုးဖြတ်ထား။
                            
ငက်တုပ်ကွးေလိုမဟုတ်ဘဲ လူလူခြင်းကူးနိုင်တယ်လို့လဲဆိုထားပါတယ်။

ကျန်ာေပံုမန်ဆိုရင် သိပ်အလးေမထားတတ်ပါဘူး။ ဒီလိုသတင်းျမိုးကို။ :D

ဒါပေမယ့် ဘာလို့လဲမသိဘူး ဂျပန်အစိုးက တ်ာေတ်ာေသတိထားတယ်။

လွန်ခဲ့တဲ့တဈလလာေက်က ကုမ္ပဏီမာ လူလူခြင်းကူးနိုင်တဲ့ ငက်တုပ်ကွးေဖြဈပွားခဲ့ရင် ဘာတွေ ဘယ်လိုလုပ်ရမယ်၊ အလုပ်သွားရင် ဘယ်လိုသတိထားရမယ်။ အိမ်နားပတ်ဝန်းကျင်းထွက်ရင် ဘယ်လိုသတိထားရမယ်။ ဆိုးလာရင် အလုပ်ပါ ဆိုင်းထားပြီး။ ကာကွယ်ဆးေထုတ်တာကို ၃လခန့် စာေင့်ရမယ်၊ ကာကွယ်ဆးေက ပိုးကို မတွ့ေမခြင်းထုတ်လို့မရဘူး။ စတာတွေကို အထက်လူကြီးျမားမ တဈဆင့် ကြားသိရပါတယ်။

ကဲ။ ဘာလုပ်ကြမလဲ။ :P

Compile Once, Write Once, Enjoy Everytime!

Write Once Compile Anywhere, I love C/C++!

Write Once Run Anywhere, I love Python!

I love C/C++ and Python Bridge Programming, Its the best of the best!

Write Best & Fastest Code with C/C++ and
Run as Prettiest & Lightest Python Codes, Its Extremely Great! :D

Compile Once, Write Once, Enjoy Everytime :-)

Cheers,
Soe Min

Memo# Py_Unicode Object & wchar_t

Py_UNICODE

- Py_UNICODE is a typedef alias for either unsigned short (UCS2) or unsigned long (UCS4).
- UCS2 and UCS4 Python builds are not binary compatible.

To compile Python with UCS4,
./configure --enable-unicode=ucs4
make && make install

wchar_t

In Unix/Linux
wchar_t is unsigned long (32 bits, 4 bytes)

In Windows
wchar_t is unsigned short (16 bits, 2 bytes)

If you use wchar_t C/C++ in codes and when need to convert to Py_Unicode, your python need to be UCS4 binary.

Cheers,

Auto Correct Burmese Words in 7 Lines of Python Codes ပိုင္သြန္ကုတ္ လိုင္း ရလိုင္းျဖင့္ ျမန္မာစာလံုးေပါင္းသတ္ပံု ျပုျပင္ျခင္း

Auto Correct Burmese Words in 7 Lines of Python Codes

ပိုင္သြန္ကုတ္ လိုင္း ရလိုင္းျဖင့္ ျမန္မာစာလံုးေပါင္းသတ္ပံု ျပုျပင္ျခင္း

# Codes - Soe Min (Mark)
# License - Only for Research, Not Redistributable, Not Allowed for Commercial/Advertisment Use for any part of the codes.

Line 1, Import some libraries, including my cburglish library
import re,codecs,cburglish,collections

Line 2, Initialize variables, ဒစ္ရွင္နရီဖိုင္ကိုဖတ္
s,m,w,c={},collections.defaultdict(lambda:[]),{},codecs.open('my-MM.dic',"rb+",'utf8').read()

Line 3, ဒစ္ရွင္နရီကေန ျမန္မာစာလံုး (Word Level) ေတြဆြဲထုတ္
for x in re.findall(u'[\u1000-\u103f]+',c):w[x]=1

Line 4, ဒစ္ရွင္နရီကေနပဲ ျမန္မာ Syllable ေတြဆြဲထုတ္
for x in cburglish.syllable(re.sub(u'[^\u1000-\u103f]+','',c)).split("|"):s[x]=1

Line 5, Build Reverse Lookup HashTable from Magic Keys to Syllables
[m[cburglish.magic(x)].append(x) for x in s.keys() if cburglish.magic(x)>0]

Line 6, ျဖစ္နိုင္္တဲ့စာလံုးေတြ Generate လုပ္
t=lambda x:len(x)<2 and x[0] or len(x)>2 and t([[j+i for j in x[0] for i in x[1]]]+x[2:]) or [j+i for j in x[0] for i in x[1]]

Line 7, Syllablize Input String, Generate Magic Codes, Make Combinations, ဒစ္ရွင္နရီမွာ ေတြ့ရင္ ေပါင္းထည့္ျပီး Array အေနနဲ့ return ျပန္
correct=lambda y:[x for x in t([m[cburglish.magic(x)] for x in cburglish.syllable(y).split("|") if cburglish.magic(x) in m]) if x in w]

---

Usages, for Unicode 5.1
>>> correct(u"ကခ်ြာေကခြွတ်")
[u"ကခ်ာေျကခွျတ်"]

And its superfast, if you loop 10000 times, its only take a second. :-) 10000 Words per second
>>> for i in range(10000):
>>> x=correct(u"ကခ်ြာေကခြွတ်")

1. Download above codes as file
correct.7z

2. Download my cburglish Library for Python 2.5 Win32 for Syllable Breaker and Magic Code Generator for Unicode 5.1
cburglish-syllable-magic-py2.5.7z
#extract cburglish.pyd and copy to Python site-packages folder, eg, C:\Python25\Lib\site-packages\
# cburglish library is only for Research and Not Redistributable and Not allowed to use Commercial/Advertisement related things. If you don't agree, don't use it.

3. Download spell dictionary zip file from OpenOffice by Ko Wunna Ko Ko and Keith Stribley, my-MMDict.oxt and extract my-MM.dic

# If you are looking for English spell corrector, find Peter Norvig's 21 lines of Python Codes
http://norvig.com/spell-correct.html

Cheers,
Soe Min

စာလံုးေပါင္း သတ္ပံုျပုျပင္ျခင္း (၃) Word Level Auto Correction သီအိုရီ

ျပုျပင္ဖို့စာလံုးတစ္လံုးကို ေရြးပါမယ္။ ဥပမာ
အက်ီးအျကယ္ 

အဲဒီစာလံုးကို Syllable break လုပ္ပါတယ္။ ေဟာဒီလိုပါ
အ|က်ီး|အ|ျကယ္

အဲဒါကို တစ္လံုးစီ Magic Code ထုတ္ယူပါတယ္။
အ - 0x14000000
က်ီး - 0x1000105
အ - 0x14000000
ျကယ္ - 0x11a0001

အဲဒီကေနမွ တစ္ဆင့္ အျခား ဆင္တူတာေတြ ဆြဲထုတ္ပါတယ္။
အ - 0x14000000 - [အ]
က်ီး - 0x1000105 - [ျကီး,က်ီး]
အ - 0x14000000 - [အ]
ျကယ္ - 0x11a0001 - [က်ယ္,ျကယ္]

အဲဒီကမွ တစ္ဆင့္ ရွိသမ်ွ combination ေတြကို generate လုပ္ပါတယ္။
အျကီးအက်ယ္
အျကီးအျကယ္
အက်ီးအက်ယ္
အက်ီးအျကယ္

အဲဒီတစ္ခုစီကို စာလံုး အဘိဓာန္မွာ ျပန္တိုက္ပါတယ္။

အဲဒီကေနတစ္ဆင့္ ေဟာဒီစာလံုးကို ရရွိေစပါတယ္။
အျကီးအက်ယ္

Cheers,
Soe Min

စာလံုးေပါင္း သတ္ပံုျပုျပင္ျခင္း (၂) Generating Magic Codes from Syllables & Syllable Level Autocorrecting

စာလံုးေတြကို Magic Codes လို့ေခါ္တဲ့ (က်ေနာ္ေခါ္ထားတဲ့ :P) 4 bytes unsigned interger ကိုေျပာင္းပါတယ္။

ကဏ္ [ကန္,ကံ,ကဏ္] [228,59,1] (0x1000008)
ကတ္ [ကတ္,ကက္] [56,20] (0x1010000)
ကန္ [ကန္,ကံ,ကဏ္] [228,59,1] (0x1000008)
ကန့္ [ကန့္,ကံ့] [45,6] (0x1000018)
ကန္း [ကမ္း,ကန္း] [73,57] (0x1000108)
...
လ်ွမ္း [ရွမ္း,ရွံး,ရြွန္း,လ်ွမ္း,ရြွမ္း] [22,16,12,4,2] (0x18000108)
လ်ွာ [ရွာ,လ်ွာ,လ်ာ,ရြွာ] [42,40,17,1] (0x18000020)
လ်ွား [ရွား,လ်ား,လ်ွား,သ်ွား] [51,39,4,2] (0x18000120)
လ်ွို [လ်ွို,ရွို,သ်ွို] [17,1,1] (0x18000006)
...

4 bytes means 4 octet :P 0x FF FF FF FF

I use first Most Significant Octet to store Consonents for example က - for 1
အဲဒါေျကာင့္ [ကဏ္ (0x1000008)] မွာ 0x1000000 = 0x1 00 00 00 ဆိုတာ ပါေနတာေပါ့။

ဒုတိယ Octet ကိုေတာ့ အသတ္ေတြ အတြက္သံုးပါတယ္။ က သတ္ ဆိုရင္ 1 for eg
အဲဒါေျကာင့္ [ကက္ (0x1010000)] မွာ 0x1 01 ဆိုတာပါေနတယ္။

ဒါနဲ့ Octet ဆိုတာ Networking ေလာကမွာ 8bit ပါတဲ့ စာလံုးတစ္ခုကို ညြန္ျပတဲ့အေနနဲ့ သံုးပါတယ္။ သံုးေနက်မို့လို့ပါ :P

ေနာက္ဆံုး Octet ၂ ခုကိုေတာ့ အျခား အစိတ္အပိုင္းေတြျဖစ္တဲ့

ေရးခ်၊ လံုးျကီးတင္၊ တစ္ေခ်ာင္းငင္၊ သေဝထိုး၊ ေနာက္ပစ္၊ ေသးေသးတင္၊ ေအာက္ျမစ္၊ ဝစ္စေပါက္၊ ဝဆြဲ၊ ဟထိုး၊
စတာေတြမွာသံုးပါတယ္။

-ာ္ ေရွ့ထိုးလို့ေခါ္တဲ့ အသတ္နဲ့တူတဲ့ စာလံုးကို လည္းသပ္သပ္တစ္လံုးအေနနဲ့ သံုးထားပါတယ္။ ဖြန့္ေတြမွာ သပ္သပ္မွ မပါပဲကိုး။

#ps ယူနီကုတ္ ၅.၁ ေနာက္ဆံုးထြက္ထားတဲ့ ဖြန့္မွာ အဲဒီ ေရွ့ထိုး ကိစဿစ ကို ေျဖရွင္းဖို့ ေအာက္ကျမစ္နဲ့ အသတ္ကို ေျပာင္းျပန္ထားထားတယ္လို့ ယူဆပါတယ္။ ေဟာသလို ကင့္နဲ့ေကာ္ ဆိုတဲ့စာလံုးကို က---င---့--္ ၊ --ေက--ာ--္ အသတ္ေရွ့မွာ ေရးခ်တို့ ေအာက္ကျမစ္တို့ရွိသင့္ျပီး ဗ်ည္းမရွိသင့္ဘူး ဆိုသလိုလုပ္ထားပါတယ္။
က်ေနာ္ အဲဒါကို အခုအခ်ိန္အထိ လက္မခံေသးပါဘူး။ Its doesnot make sense for me.
အသတ္ေရွ့မွာ ဗ်ည္းရွိကိုရွိရပါမယ္။ ေရးခ်အေပါ္ကဟာျဖစ္တဲ့ ေရွ့ထိုးဆိုတဲ့ စာလံုးသပ္သပ္ရွိသင့္ပါတယ္။

အခုနဟာဆက္ေျပာပါမယ္
(ကဏ္ [ကန္,ကံ,ကဏ္] [228,59,1] (0x1000008))

ကဏ္ ဆိုတဲ့ စာလံုးကို ေတြ့ရင္ 0x1000008 ဆိုတဲ့ magic code ကို ထုတ္ေပးျပီး အဲဒီကေန [ကန္,ကံ,ကဏ္] ကို ျပန္ဆြဲထုတ္ပါတယ္။ အဲဒီ ကန္ ကအသံုးအမ်ားျကီးျဖစ္တာေျကာင့္ အေရွ့ဆံုးမွာု ထားပါတယ္။
အသံုးအမ်ားဆံုးကို စာလံုးေတြထဲမွာပဲ ဘယ္နွျကိမ္သံုးထားသလဲဆိုတာကို ေရတြက္ထားပါတယ္။ အဲဒါေျကာင့္ ကန္ က ၂၂၈ လံုး ကံ က ၅၉ လံုး ကဏ္ က ၁ လံုးေတြ့ပါတယ္။

အဲဒီနည္းနဲ့ syllable level auto correcting လုပ္ပါတယ္။

C နဲ့ ေရးထားတာတခ်ို့ကို တင္ျပပါမယ္။

unsigned int map[]={    1,2,3,4,
5,SA,SA,6,7,NYA,NYA,8,9,10,
11,NA,12,13,DA,DA,NA,14,15,BA,
BA,16,YA,YA,LA,17,18,19,LA,20,YAYCHA,
YAYCHA,LGLG,LGLG,T1T2,T1T2,THAWAYHTOE,NAUTPYIT,0,0,0,
ANAN,AUTMYIT,WITSAPAUT,0,0,YPYY,YPYY,WASWEL,HAHTOE
}

NYA တို့ ဘာတို့ဟာ နံပါတ္ေတြကို သတ္မွတ္ထားရံုပါပဲ၊ ဥပမာ

#define NYA 23

ေနာက္ျပီး Magic Codes ထုတ္တဲ့ သေဘာတရားကေတာ့ ေဟာသလိုမ်ိုးေရးပါတယ္။
do{
if(*s>=0x1000 && *s<=0x103e){
if(s[1]==0x103a){
if(*s<=0x1021)//a that
ret|=map[*s-0x1000]<<KILLER,s++;
}else if(map[*s-0x1000]!=0 && *s>0x1021){//parts
ret|=map[*s-0x1000];
}else{//consonents
ret|=map[*s-0x1000]<<CONS;
}
}
}while(*s++);

CONS နဲ့ KILLER က bit ေတြ shift လုပ္ထားရံုပါပဲ။

#define CONS 24 
#define KILLER 16

ပိုင္သြန္အပိုင္းကေတာ့ Magic Codes ေတြကို Hash Keys အေနနဲ့ထားျပီး စာလံုးေတြ ျပန္ဆြဲထုတ္ပါတယ္။
ဥပမာ (ကဏ္ [ကန္,ကံ,ကဏ္] [228,59,1] (0x1000008))ဆိုရင္
hash[0x1000008]=[ကန္,ကံ,ကဏ္] စသျဖင့္ေပါ့။

စာလံုးတစ္လံုးလာတာနဲ့ magic code ထုတ္ 0x1000008 ရ၊ အဲဒါကို hash[0x1000008] နဲ့ array ယူ၊ အဲဒီထဲကမွ priority အျမင့္ဆံုးဟာကို ျပန္ယူပါတယ္။ အဲဒီနည္းနဲ့ Syllable Level Spell Correcting လုပ္ပါတယ္။

ေနာက္မွ Word Level Spell Correcting အေျကာင္းေရးပါဦးမယ္။

Cheers,
Soe Min

F# (.NET Platform based Functional Programming)

F# (.NET Platform based Functional Programming)

Language Specifications

http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/spec2.aspx

Seems nice, since I like the Languages. :-)

စာလံုးေပါင္း သတ္ပံုျပုျပင္ျခင္း (၁) Spell Correction In Burmese

က်ေနာ္ ေလာေလာဆယ္ ျမန္မာစာ စာလံုးေပါင္းသတ္ပံုျပင္တဲ့ သီအိုရီတစ္ခုကို ေလ့လာတီထြင္ေနပါတယ္။

က်ေနာ္ကိုယ္တိုင္ ျမန္မာစာကို ငယ္ငယ္ကေလးကတည္းက သင္လာ ဆယ္တန္းမွာ ျမန္မာစာ ဂုဏ္ထူးကို ကပ္ျပီး ရခဲ့ေသာ္ျငားလည္း အမွန္အကန္ စာလံုးေပါင္းတတ္ျခင္း မရွိပါဘူး။ ဘာလို့လဲဆိုေတာ့ကာ ျမန္မာစာ စာလံုးေပါင္းအဘိဓာန္ စတာေတြကို လံုးလံုးမသံုးလို့ပါပဲ။

မွားတတ္တာေတြက မ်ိုးစံုရွိနိုင္ပါတယ္။ က်ေနာ္ ေလာေလာဆယ္ ေလ့လာေတြ့ရွိထားသမ်ွကေတာ့ ...
၁။ မသတ္၊ နသတ္၊ နဲ့ ေသးေသးတင္
၂။ ရပင္း နဲ့ ရရစ္
၃။ ဟထိုးပါတာမပါတာ
၄။ စလံုးနဲ့ဆလိမ္
၅။ ညနဲ့ ငရရစ္ ျင
၆။ ဒေဒြးနဲ့ ဓေအာက္ျခိုက္
၇။ နငယ္နဲ့ ဏျကီး
၈။ ဗထက္ျခိုက္နဲ့ ဘကုန္း
၉။ လ်၊ လ်ွ၊ သ်ွ၊ ရွ
၁၀။ ယပက္လက္နဲ့ ရေကာက္
၁၁။ လနဲ့ ဠျကီး

အဲဒါေတြကို ျပင္နိုင္တဲ့နည္းကို ေလ့လာျပီးလက္ရွိစမ္းေနပါတယ္။

ကေျခာ္ကျခြတ္ (ကေခ်ာ္ကခ်ြတ္) 
ဝန္းေျကာင္း (ဝမ္းေက်ာင္း)
အျခင္းခ်င္း (အခ်င္းခ်င္း)
ထိန္းမ်ား (ထိမ္းျမား)
ကန္းပါး (ကမ္းပါး)
ကန္စန္း (ကံစမ္း)
မိးလ်ံ (မီးလ်ွံ)
အျကပ္အတည္း (အက်ပ္အတည္း)
အျကံုးဝင္ (အက်ံုးဝင္)
အက်ီးအျကယ္ (အျကီးအက်ယ္)
အူပ္ထီမ္းသု (အုပ္ထိန္းသူ)
သ်ွာရွည္ (လ်ွာရွည္)
ရွာရွည္ (လ်ွာရွည္)
ေဗးရမ္ (ေဘးရန္)
ျကိန္လုန္း (ျကိမ္လံုး)
က်ိုးက်ာ (ျကိုးျကာ)
ကုမ္ျမိုးဆံုစီူင္ (ကုန္မ်ိုးစံုဆိုင္)

နည္းလမ္းကေတာ့ က်ေနာ္ ပထမပို့စ္မွာေရးထားတဲ့ စာလံုးကို ဂဏန္းအျဖစ္ေျပာင္းျခင္းပါပဲ။

တူတာေတြဆြဲထုတ္ ျပီးေတာ့ စာလံုးစာရင္းထဲမွာ ျပန္ရွာ တူတာေတြ့ရင္ ထုတ္ေပးျခင္ျဖင့္ အမွန္စာလံုးကို ရရွိေစပါတယ္။

ေနာက္မွ ဒီထက္ အေသးစိတ္ ေရးပါဦးမယ္။

Cheers,
Soe Min

Setting Notepad++ to see both Zawgyi and Myanmar3 Font base on file extension

I use *.mtxt for Myanmar3, and *.ztxt for Zawgyi Files

First, clear global font override setting
Then set for each file extensions


 
  
 

 
 

Cheers,
Soe Min

ျမန္မာစာလံုး ဆင္တူမ်ား ေရြးထုတ္ျခင္း

ကန် [ကန်,ကံ,ကဏ်] 
ကန့် [ကံ့,ကန့်]
ကန်း [ကန်း,ကမ်း]
ကုန်း [ကုန်း,ကံုး]
ကျဉ်း [ကျဉ်း,ကျည်း,ကြည်း,ကြဉ်း]
ျကိုင်း [ျကိုင်း,ကြိုင်း]
ကာေျက် [ကာေျက်,ကြာေက်]
ျကံ့ [ကြံ့,ကြန့်,ျကံ့]
ကွံျ [ကွျန်,ကွံျ]
ကွံး [ကွံး,ကွန်း,ကွမ်း]
ျလာ [ျလာ,ရာ,လာျ]
ျလား [ျလား,လားျ,ရား,သားျ]
ျလူ [ရူ,ရူ,သူျ,ျလူ]
လာေျ [လာေျ,လာေျ,ရာေ]
လာေျက် [လာေျက်,လာေျက်,ရာေက်]

စာလံုးတွေကို ဂဏန်းတဈခုအဖြဈပြာေင်းပြဈတဲ့ နည်းကိုသံုးပါတယ်။

ဥပမာ ကကြီးကို 0x1000000
သးေသးေတင်ရယ် နသတ်ရယ် ဏကြီးသတ်ရယ် မသတ်ရယ်ကို 0x08 လို့ထားပါတယ်
အဲဒီကတဈဆင် ကန်၊ ကံ၊ ကဏ်၊ ဆိုရင် 0x1000008 ဆိုပြီး generate လုပ်ပါတယ်။

C နဲ့ရးေထားပြီး Python ကနေဆွဲယူသံုးထားပါတယ်။

% python
>>> import cburglish
>>> cburglish.magic(u"ကန်")
0x1000008
>>> cburglish.similar(u"ကန်")
[u"ကန်",u"ကံ",u"ကဏ်"]

အဲဒီနည်းနဲ့ စာလံုးတဈလံုးမြင်တိုင်း ဆင်တာတွေဆွဲထုတ်နိုင်ပါတယ်။ နံပါတ်တူနေတာကိုး။

ဒါဟာ အဆင်ပြေလာမယ် ဆိုရင်

level 1 - မြန်မာ syllable autocorrection/suggestion list generator တဈခု
level 2 - မြန်မာ word autocorrection/suggestion list generator တဈခု ရလာနိုင်ပါမယ်။

Cheers,
Soe Min

Crawling the blog html content with python (direct HTML read method, not through RSS)

Crawling the blog html content with python (direct HTML read method, not through RSS)

import codecs,re,urllib2

f = urllib2.urlopen('http://www.soemin.net/2009/04/font-encoding-detection-for-zawgyi-and.html')

htm=re.sub("&#(\d+);",lambda x:unichr(int(x.group(1))),f.read().decode("utf8"))

txt=re.findall('<div[^>]+post-body[^>]+>\s*(.*?)\s*<div[^>]+clear:\s*both[^>]+></div>',htm,re.DOTALL)[0]

codecs.open("crawl.txt", 'w+',"utf8").write(txt)

#its also convert #&4096; to က

results will be like this

ေဇာ္ဂ်ီနဲ့ ယူနီကုတ္ ၅.၁ ခြဲျခားျခင္း (Font Encoding Detection for Zawgyi and Unicode 5.1)

.....

အဓိကအားျဖင့္ကေတာ့
၁။ သေဝထိုး၊ ရရစ္၊ ရပင္းစတာေတြ နဲ့

....

.....

Cheers,

Cheers,
Soe Min

ေဇာ္ဂ်ီနဲ့ ယူနီကုတ္ ၅.၁ ခြဲျခားျခင္း (Font Encoding Detection for Zawgyi and Unicode 5.1)

ေဇာ္ဂ်ီနဲ့ ယူနီကုတ္ ၅.၁ ခြဲျခားျခင္း (Font Encoding Detection for Zawgyi and Unicode 5.1)

do{
if(*s>0x104f) return Zawgyi;
else if(*s==0x1039){
if(*&s[1]>0x1021 || *&s[1]<0x1000) return Zawgyi;
}else if(*s==0x1031){
if(*&s[1]==0x103b) return Zawgyi;
else if(*&s[-1]<0x1000) return Zawgyi;
else if(*&s[-1]>=0x102b && *&s[-1]<=0x103a) return Zawgyi;
}else if(*s==0x103b){
if(*&s[-1]<0x103b && *&s[-1]>=0x102b) return Zawgyi;
}else if(*s==0x1033 || *s==0x1034) return Zawgyi;
else if(*s==0x103e || *s==0x103f) return Myanmar3;
}while(*s++);
return Myanmar3;

အဓိကအားျဖင့္ကေတာ့
၁။ သေဝထိုး၊ ရရစ္၊ ရပင္းစတာေတြ နဲ့
၂။ ေဇာ္ဂ်ီမွာကလြဲျပီး မပါတဲ့ စာလံုးေတြနဲ့
၃။ ယူနီကုတ္ ၅.၁ မွာကလြဲျပီး မပါတာေတြကို စစ္ထားတဲ့နည္းပါ။

# အသတ္နဲ့ ပတ္ဆင့္ေတြက နဲနဲေလး ျပသဿသနာရွိပါေသးတယ္။ စာေျကာင္းေတြဆို ျပသဿသနာမရွိပါဘူး။ စာလံုးတစ္လံုးတည္းဆိုရင္ေတာ့ 0-10% error ရွိတာကို ေတြ့ရွိထားပါတယ္။

# syllable စာရင္းရွိေနတဲ့အတြက္ေျကာင့္ စာလံုးတစ္လံုးစီတိုက္စစ္ျပီး perfectly detect လုပ္မယ္ဆိုရင္ေတာင္ လုပ္လို့ရနိုင္ပါတယ္။ ဒါေပမယ့္ speed ျမန္တာကိုျကည့္မယ္ဆိုရင္ေတာ့ C နဲ့ေရးထားတာနဲ့ပဲ အဆင္ေျပမွာပါ။

Cheers,
Soe Min

If Philosophers Were Programmers

http://developeronline.blogspot.com/2009/04/if-philosophers-were-programmers.html

If Philosophers Were Programmers

ဆိုကေရးတီး The Hardcore Assembly Programmer
အရစဿစတိုတယ္လ္ The Influential C Programmer
ပေလတို The Idealistic C++ Evangelist
......

http://developeronline.blogspot.com/2009/04/if-philosophers-were-programmers.html

ျမန္မာစာ ျကိယာဝိေသသန Pattern Matching

ျမန္မာစာမွာ ေအာက္ပါ စာလံုးေတြလိုမ်ိုး အမ်ားျကီးရွိပါတယ္။ အသစ္ေတြလဲ ထြင္လို့ရပါတယ္။ ဒါေျကာင့္ ဒါေတြကို ဒစ္ရွင္နရီ အားကိုးမယ္ဆိုရင္ ေတာ္ေတာ္ မလြယ္ပါဘူး။

ပလုပ္ပေလာင္း
မ်ိုးမ်ိုးျမက္ျမက္
တခုခု
တိုးတိုးေလး
က်ိက်ိတက္
တဖြဲဖြဲ
ခပ္သည္းသည္း

ဒါေျကာင့္ အဲဒါေတြကို အရင္ syllable break လုပ္

ပ|လုပ္|ပ|ေလာင္း
မ်ိုး|မ်ိုး|ျမက္|ျမက္
တ|ခု|ခု
တိုး|တိုး|ေလး
က်ိ|က်ိ|တက္
တ|ဖြဲ|ဖြဲ
ခပ္|သည္း|သည္း

ျပီးရင္ rule ေတြထဲထည့္
rule 1
ေလးလံုးတြဲမွာ ပထမစာလံုး နဲ့ တတိယစာလံုးတူရင္ ျကိယာဝိေသသန
rule 2
ေလးလံုးတြဲမွာ ၂လံုးစီတူ
rule 3
သံုးလံုးတြဲ ေနာက္၂လံုးတူ
rule 4
သံုးလံုးတြဲ ေရွ့၂လံုးတူ

စသျဖင့္ ခြဲလိုက္ရင္

(ပလုပ္ပေလာင္း)
(မ်ိုးမ်ိုးျမက္ျမက္)
(တခုခု)
(တိုးတိုးေလး)
(က်ိက်ိတက္)
(တဖြဲဖြဲ)
(ခပ္သည္းသည္း)

ဆိုျပီး ဒစ္ရွင္နရီမွာ မပါလဲ ျကိယာဝိေသသနေတြကို ေကာင္းေကာင္းခြဲေပးနိုင္မယ္။

Cheers,
Soe Min

Dictionary ကို အသံုးျပုျပီး ျမန္မာစာ Word Level ပိုင္းျဖတ္ျခင္း

The following Texts are from Ko Nyi Lynn Seck.


ေတာင္ကုန္းေလး တစ္ခုေပါ္က ဘယ္ေတာ့မွ ျပန္မေတြ့ေတာ့တဲ့ ေနျကာပန္းမ်ားအေျကာင္း

(၁)
ရြာသြန္းတဲ့ မိုးေရစက္တိုင္းဟာ
ညီမေလး ျဖစ္သြားတဲ့အခါ
က်ြန္ေတာ္ဟာ ထီးမပါဘဲ လမ္းထြက္ေလ်ွာက္ခဲ့မိတယ္
မိုးရြာထဲမွာေပါ့
ေကာင္းကင္ျကီး တစ္ခုလံုး
ညီမေလးရဲ့ နွုတ္ခမ္းတြန့္ အျပံုးေလးေတြနဲ့ ျပည့္သြားလိုက္တာ
က်ြန္ေတာ့္မွာ နားခိုရာ ရွာဖို့ေတာင္
သတိရမရေတာ့ပါဘူး။


တဖြဲဖြဲနဲ့ ခပ္သည္းသည္း က်လာတဲ့ မိုးေရစက္ေတြေျကာင့္ က်ြန္ေတာ့္ေျခလွမ္းေတြကို အရွိန္ျမွင့္လိုက္တယ္။

....

(ေတာင္ကုန္း)(ေလး) (တစ္)(ခု)(ေပါ္)(က) (ဘယ္)(ေတာ့)(မွ) (ျပန္)(မ)(ေတြ့)(ေတာ့)တဲ့ (ေနျကာ)(ပန္း)(မ်ား)(အေျကာင္း)

(၁)
(ရြာ)(သြန္း)တဲ့ (မိုးေရ)စက္(တိုင္း)(ဟာ)
(ညီမ)(ေလး) (ျဖစ္)(သြား)တဲ့(အခါ)
(က်ြန္ေတာ္)(ဟာ) (ထီး)(မ)(ပါ)(ဘဲ) (လမ္း)(ထြက္)(ေလ်ွာက္)(ခဲ့)(မိ)(တယ္)
(မိုးရြာ)(ထဲ)(မွာ)(ေပါ့)
(ေကာင္းကင္)(ျကီး) (တစ္)(ခု)(လံုး)
(ညီမ)(ေလး)(ရဲ့) (နွုတ္ခမ္း)(တြန့္) (အျပံုး)(ေလး)(ေတြ)(နဲ့) (ျပည့္)(သြား)(လိုက္)(တာ)
(က်ြန္)ေတာ့္(မွာ) (နား)(ခို)(ရာ) (ရွာ)(ဖို့)(ေတာင္)
(သတိရ)(မ)ရ(ေတာ့)(ပါ)(ဘူး)။

....

some more
(၂)
(ျမို့)(ကေလး)(မွာ) (အဲဒီ)(ေန့)(ကေတာ့) (ရာသီဥတု) (သာသာယာယာ) (ရွိ)(ေန)(ခဲ့)(ပါ)(တယ္)။ (ပံုမွန္)(အားျဖင့္)(ဆို)(ရင္)(ျမို့)(ကေလး)(မွာ) (ေနြရာသီ)(က)(လြဲ)(ျပီး) (က်န္)တဲ့(အခ်ိန္) (ေတာ္ေတာ္)(မ်ား)(မ်ား)(မွာ) (မိုးရြာ)(တတ္)(တယ္)။ (ဒီ)(မွာ)(က) (မိုးရြာ)(ျပီ)(ဆို)(ရင္)(လည္း) (မ)(စဲ)(ေတာ့)(ဘဲ) (တရိပ္ရိပ္)(နဲ့) (ရြာ)(ေန)(တတ္)(တာ)(မ်ိုး)။(ျမို့ေတာ္)(ျကီး)(က) (သူငယ္ခ်င္း) (တစ္)(ေယာက္)(ကေတာ့) (မင္း)(တို့)(ျမို့)(ေလး)(ဟာ) လြမ္း(လြမ္းေဆြး)ေဆြး(နဲ့) (အံု့မွိုင္း)(ေန)(တာ)(လို့) (ကဗ်ာဆန္)ဆန္ (ေျပာ)(ဖူး)(တယ္)။ (ဒါ)(ေျကာင့္)(ပဲ)(လား)(ေတာ့) (မ)(သိ)(ဘူး)၊ (တခ်ို့) (ကဗ်ာဆရာ)(ေတြ) (စာေရးဆရာ)(ေတြ) (တ)(ခါ)(တ)(ရံ) (ဒီ)(ျမို့)(ေလး)(မွာ) (ရက္)(ေပါင္း)(မ်ား)(စြာ) (လာ)(ေန)(တတ္)(ျက)(တယ္)။ (က်ြန္)ေတာ့္(အတြက္)(ကေတာ့) (ဒီ)(ျမို့)(ေလး)(ဟာ) (စိတ္)(ရဲ့)(ျငိမ္သက္)(မွု) (တစ္စံုတစ္ခု)(ကို) (ေပး)(နိုင္)(တယ္)(လို့) (ထင္)(မိ)(တယ္)။ (လတ္ဆတ္)တဲ့ (ေလထု)၊ (စိမ္းလန္း)တဲ့ (သစ္ေတာ)အုပ္၊ (အနီ)(ေရာင္)(ရင့္)(ရင့္)(ထ)(ေန)တဲ့ (ေျမျပင္)၊ (ဟန္ေဆာင္)(မွု)(ကင္း)(မဲ့)တဲ့ (တိုင္းရင္းသား)(ေတြ)၊ (နံနက္ခင္း)(ဆို) (မီးခိုး)(ေငြ့)(ေတြ) (တ)(လူ)(လူ)(ထ)(ေန)(တ)တ္(တ)ဲ့ (အိမ္)(ေခါင္မိုး)(ေတြ)၊ (ညေနခင္း)(ဆို) (နနြင္းတက္) (အနံ့)(ေလး)(ေတြ) (လြွမ္းျခံု)(ေန)တဲ့ (မီးလင္းဖို)(ေတြ)(နဲ့)(ျငိမ္သက္)(ဆိတ္)ညိမ္(လို့) (ဆူ)(သံ)(ညံ)(သံ) (ဘာ)(တစ္)(ခု)(မွ) (မ)(ရွိ)(ဘူး)။ (မူးယစ္)(ျပီး) (ဆဲဆို)(ေန)(တတ္)(သူ)(ေတြ) (မ)(ရွိ)(ဘူး)။ (မ)(ျပံုး)(ခ်င္)(ဘဲ) (အတင္း)(ျပံုး)(ျပ)(ေန)(တတ္)တဲ့ (ေကာင္မေလး)(ေတြ) (မ)(ရွိ)(ဘူး)။ ေလာ္(စ)(ပီ)(ကာ)(နဲ့) (တရား)(ရြတ္ဖတ္)(သံ)(ေတြ) (မ)(ရွိ)(ဘူး)။


....

Dictionary ေအနနြင Ko Wunna Ko Ko and Keith Stribley တို့ရဲ့ OpenOffice မြ Spell Dictionary ကို အသ်ံုးပထားသည

Cheers,
Soe Min

စာလံုးစာရင္းကို အသံုးျပုျပီး ျမန္မာ စာလံုးမ်ားဆြဲထုတ္ျခင္း (၂)

The following texts are from Ko Nyi Lynn Seck also.

ေတာင္ကုန္းေလး တစ္ခုေပါ္က ဘယ္ေတာ့မွ ျပန္မေတြ့ေတာ့တဲ့ ေနျကာပန္းမ်ားအေျကာင္း

(၁)
ရြာသြန္းတဲ့ မိုးေရစက္တိုင္းဟာ
ညီမေလး ျဖစ္သြားတဲ့အခါ
က်ြန္ေတာ္ဟာ ထီးမပါဘဲ လမ္းထြက္ေလ်ွာက္ခဲ့မိတယ္
မိုးရြာထဲမွာေပါ့
ေကာင္းကင္ျကီး တစ္ခုလံုး
ညီမေလးရဲ့ နွုတ္ခမ္းတြန့္ အျပံုးေလးေတြနဲ့ ျပည့္သြားလိုက္တာ
က်ြန္ေတာ့္မွာ နားခိုရာ ရွာဖို့ေတာင္
သတိရမရေတာ့ပါဘူး။
.......


တာေင်ကုန်းလး (ေတာေင်ကုန်း,လး)
ေတဈခုပ်ါေက (တဈ,ခု,ပ်ါ,ေက)
ဘယ်တာ့ေမ (ဘယ်,တာ့,ေမ)
ပြန်မတွ့ေတာ့ေတဲ့ (ပြန်,မ,တွ့,ေတာ့)
ေနေကြာပန်းမားျအကြာေင်း (နေကြာ,ပန်း,မား,ျအကြာေင်း)
ရွာသွန်းတဲ့ (ရွာ,သွန်း)
မိုးရေစက်တိုင်းဟာ (မိုးရ,ေရေစက်,တိုင်း,ဟာ)
ညီမလး (ေညီမ,လး)
ေဖြဈသွားတဲ့အခါ (ဖြဈ,သွား,အခါ)
ကွျန်တ်ာေဟာ (ကွျန်တ်ာ,ေဟာ)
ထီးမပါဘဲ (ထီး,မ,ပါ,ဘဲ)
လမ်းထွက်လာေျက်ခဲ့မိတယ် (လမ်း,ထွက်,လာေျက်,ခဲ့,မိ,တယ်)
မိုးရွာထဲမာပါ့ (ေမိုးရွာ,ထဲ,မာ,ပါ့)
ေကာေင်းကင်ကြီး (ကာေင်းကင်,ကြီး)
တဈခုလံုး (တဈ,ခု,လံုး)
ညီမလးေရဲ့ (ညီမ,လး,ေရဲ့)
နုတ်ခမ်းတွန့် (နုတ်ခမ်း,တွန့်)
အပြံုးလးေတွေနဲ့ (အပြံုး,လး,ေတွ,ေနဲ့)
ပြည့်သွားလိုက်တာ (ပြည့်,သွား,လိုက်,တာ)
ကွျန်တ်ာ့ေမာ (ကွျန်,မာ)
နားခိုရာ (နား,ခို,ရာ)
ရာဖို့တာေင် (ရာ,ဖို့,တာေင်)
သတိရမရတာ့ေပါဘူး (သတိရ,မ,တာ့,ေပါ,ဘူး)
တဖွဲဖွဲနဲ့ (ဖွဲ,နဲ့)
ခပ်သည်းသည်း (ခပ်,သည်း,သည်း)
ကျလာတဲ့ (က,ျလာ)
မိုးရေစက်တွေကြာေင့် (မိုးရ,ေရေစက်,တွ,ေကြာေင့်)
ကွျန်တ်ာ့ေခြေလမ်းတွေကို (ကွျန်,ခြေလမ်း,တွ,ေကို)
အရိန်မြင့်လိုက်တယ် (အရိန်,မြင့်,လိုက်,တယ်)

Cheers,
Soe Min

စာလံုးစာရင္းကို အသံုးျပုျပီး ျမန္မာ စာလံုးမ်ားဆြဲထုတ္ျခင္း (၁)

Original Text from Ko Nyi Lynn Seck Blog

http://blog.nyilynnseck.com/2009/04/tropical-storm-bijli.html

Bijli ဘိဂ်လိလို့ နာမည္ရတဲ့ မုန္တိုင္းတစ္လံုး ျမန္မာျပည္ထဲ ဝင္ပါဦးမယ္။ ခန့္မွန္းခ်က္ေတြအရ ရန္ကုန္ကေတာ့ .....
....


နာမည်ရတဲ့ (နာမည်ရ,နာမည်)
မုန်တိုင်းတဈလံုး (မုန်တိုင်း)
မြန်မာပြည်ထဲ (မြန်မာ)
ခန့်မန်းချက်တွေအရ (ခန့်မန်း,မန်းချက်,အရ)
ရန်ကုန်ကတာ့ (ေရန်ကုန်,ကတာ့)
ေရခိုင် (ရခိုင်)
မြန်မာပြည် (မြန်မာ)
အလယ်ပိုင်းကတာ့ (ေအလယ်ပိုင်း,ကတာ့)
ေမုန်တိုင်း (မုန်တိုင်း)
ရိုက်ခတ်တာ (ရိုက်ခတ်)
ခံရနိုင်ပါတယ် (ရနိုင်)
ဒီမုန်တိုင်းဟာ (မုန်တိုင်း)
မြန်မာပြည်ထဲကို (မြန်မာ)
မနက်ဖြန် (မနက်ဖြန်)
မြန်မာနဈသဈကူးန့ေမာ (မြန်မာ,နဈသဈကူး)
မုန်တိုင်းဟာ (မုန်တိုင်း)
အင်အား (အင်အား)
ပြင်းထန်လွန်းတဲ့ (ပြင်းထန်)
မုန်တိုင်းတာ့ (ေမုန်တိုင်း)
တဈနာရီကို (နာရီ)
အဆင့် (အဆင့်)
နဲ့ (နဲ့)
ကတာ့ (ေကတာ့)
ေဒီအချက်အလက်တွေဟာ (အချက်အလက်,အချက်,အလက်)
...
...

Cheers,
Soe Min

Myanmar Syllables မ်ားကို ဂဏန္းတစ္လံုး (Unique Integer or wchar_t) အျဖစ္သို့ အသြင္ေျပာင္းျခင္း

က-K-0x4000-\u1000
ကကဿက-KKX2K-0x4001-\u1000\u1000\u1039\u1000
ကကဿကု-KKX2Ku-0x4002-\u1000\u1000\u1039\u1000\u102f
ကက္-KKX1-0x4003-\u1000\u1000\u103a
ကဂဿဂ-KGX2G-0x4004-\u1000\u1002\u1039\u1002
ကင္-KIN-0x4005-\u1000\u1004\u103a
ကင္း-KIN0-0x4006-\u1000\u1004\u103a\u1038
ကကဿငာ-KINX2KAR1-0x4007-\u1000\u1004\u103a\u1039\u1000\u102c
ကစဿစည္း-KSX2SNYX10-0x4008-\u1000\u1005\u1039\u1005\u100a\u103a\u1038
ကစ္-KSX1-0x4009-\u1000\u1005\u103a
ကဉဿစ-KNY5X2S-0x400a-\u1000\u1009\u1039\u1005
ကဋ္-KTTX1-0x400b-\u1000\u100b\u103a
ကဏဿဋ-KNNX2TT-0x400c-\u1000\u100f\u1039\u100b
ကဏဿဌ-KNNX2HTT-0x400d-\u1000\u100f\u1039\u100c
ကဏဿဍဍ-KNNX2DD-0x400e-\u1000\u100f\u1039\u100d
ကဏဿဏ-KNNX2NN-0x400f-\u1000\u100f\u1039\u100f
ကဏ္-KNNX1-0x4010-\u1000\u100f\u103a
ကတဿတ-KTX2T-0x4011-\u1000\u1010\u1039\u1010
ကတဿတား-KTX2TAR10-0x4012-\u1000\u1010\u1039\u1010\u102c\u1038
ကတဿတီ-KTX2TII-0x4013-\u1000\u1010\u1039\u1010\u102e
ကတဿတူ-KTX2TUu-0x4014-\u1000\u1010\u1039\u1010\u1030
ကတ္-KTX1-0x4015-\u1000\u1010\u103a
ကနဿတ-KNX2T-0x4016-\u1000\u1014\u1039\u1010
ကနဿတာ-KNX2TAR1-0x4017-\u1000\u1014\u1039\u1010\u102c
ကနဿတိ-KNX2TI-0x4018-\u1000\u1014\u1039\u1010\u102d
ကနဿနား-KNX2NAR10-0x4019-\u1000\u1014\u1039\u1014\u102c\u1038
...

ျမန္မာစာမွာ စာလံုးေတြ အသတ္ေတြ နဲ့တစ္လံုးတစ္လံုးကိုယ္တြယ္ရတာ ခက္ပါတယ္။ အဲဒါေျကာင့္ syllable တစ္ခုကို စာလံုးတစ္လံုး for eg. 0x4000 for က . ျဖစ္မယ္ဆိုရင္ အစစအရာရာ လုပ္ရတာ အဆင္ေျပသြားပါမယ္။

အဲဒါကို C/C++ မွာ define နဲ့ အကုန္လံုးကို နာမည္တစ္ခုစီေပးလိုက္မယ္ ဆိုရင္ ဥပမာ K - 0x4000 // က
programmer အတြက္လည္း လုပ္ရတာ အလြန္ အဆင္ေျပသြားပါမယ္။

#define K 0x4000 // က
#define KKX2K 0x4001 // ကကဿက
#define KKX2Ku 0x4002 // ကကဿကု
#define KKX1 0x4003 // ကက္
#define KGX2G 0x4004 // ကဂဿဂ
#define KIN 0x4005 // ကင္
#define KIN0 0x4006 // ကင္း
#define KINX2KAR1 0x4007 // ကကဿငာ
#define KSX2SNYX10 0x4008 // ကစဿစည္း
#define KSX1 0x4009 // ကစ္
#define KNY5X2S 0x400a // ကဉဿစ
#define KTTX1 0x400b // ကဋ္
#define KNNX2TT 0x400c // ကဏဿဋ
#define KNNX2HTT 0x400d // ကဏဿဌ
#define KNNX2DD 0x400e // ကဏဿဍဍ
#define KNNX2NN 0x400f // ကဏဿဏ
#define KNNX1 0x4010 // ကဏ္
#define KTX2T 0x4011 // ကတဿတ
#define KTX2TAR10 0x4012 // ကတဿတား
#define KTX2TII 0x4013 // ကတဿတီ
#define KTX2TUu 0x4014 // ကတဿတူ
#define KTX1 0x4015 // ကတ္
#define KNX2T 0x4016 // ကနဿတ
#define KNX2TAR1 0x4017 // ကနဿတာ
#define KNX2TI 0x4018 // ကနဿတိ
#define KNX2NAR10 0x4019 // ကနဿနား
...

Cheers,
Soe Min

အသံုးအမ္ားဆံုး ်မနဿမာ syllable မ္ား

အသံုးအမ်ားဆံုးဟာ "အ" ျဖစ္ေျကာင္းေတြ့ရွိရပါတယ္။ ၅.၃၂ ရာခိုင္နွုန္းရွိပါတယ္။
ဒုတိယကေတာ့ "မ" ပါ။ တတိယက "က" ျဖစ္္ျပီး ေအာက္ပါအတိုင္းေတြ့နိုင္ပါတယ္။

အ(4755) 5.32%
မ(1289) 1.44%
က(959) 1.07%
သ(940) 1.05%
တ(743) 0.83%
လက္(713) 0.8%
ျကီး(626) 0.7%
ပ(591) 0.66%
ေရ(560) 0.63%
စ(545) 0.61%
ရာ(529) 0.59%
ရ(506) 0.57%
စာ(462) 0.52%
စား(403) 0.45%
သား(388) 0.43%
တစ္(386) 0.43%
သာ(366) 0.41%
.....

("အ" ဟာ ထိပ္ဆံုးမွာ အျမဲရွိေနနိုင္ေပမယ့္ "မ"ေတြ "က"ေတြကေတာ့ စာအေျကာင္းအရာေပါ္မူတည္ပါမယ္။)

ကိုညီလင္းဆက္ရဲ့ ဒီပို့စ္ (မိုးလိုက္လို့ရြာ) ဆိုရင္ "အ"ေနာက္မွာ "ေတြ"၊ ျပီးမွ "က" လိုက္တာကိုေတြ့ရပါတယ္။

အ(24) 4.44%
ေတြ(21) 3.89%
က(18) 3.33%
တာ(15) 2.78%
မ(15) 2.78%
ေန(10) 1.85%
သိ(9) 1.67%

- ကိုညီလင္းဆက္ရဲ့ အျကံဉာဏ္ကို အထူးေက်းဇူးတင္ပါတယ္။

- Ko Wunna Ko Ko and Keith Stribley တို့ရဲ့ OpenOffice က Spell Dictionary မွ ျမန္မာ Word သံုးေသာင္းနွစ္ေထာင္ခန့္ (Syllables - ၈ေသာင္းကိုးေထာင္ခန့္)ကို analyze လုပ္ထားျခင္းျဖစ္ပါတယ္။

Cheers,
Soe Min

Quote

成功の鍵は誰にも見つかっていないものを探すことだ。「アリストテレスオナシス」
အာေင်မြင်မုရဲ့ အဓိကသာ့ေချက်ဟာ ဘယ်သူမမတွ့ေရိဘူးတဲ့အရာကို ရာဖွေခြင်းပင်ဖြဈသည်။
သူျမားမလုပ်တာကို လုပ်ခြင်းသည် အာေင်မြင်မု အတွက် အခွင့်အလမ်းရိသည်။

Quote

幸運の鍵は自分の手にしか握られない。「ことわざより」

ကံကာေင်းမုဆိုတာ မိမိကိုယ်ကိုယ်တိုင် ရယူမ ရမယ့်အရာဖြဈတယ်။

The Need for Speed with Compiler Tweaks (Under 500 ms now for 31MB ) :-)

In my Previous post

Font converting 29MB - 450.0 ms
Syllable breaking for 29MB - 691.0 ms
Character Reordering for 29MB - 251.0 ms
Normalizing Zawgyi-One for 29MB - 652.0 ms

I am finding way to improve my codes, but there is some limitations in
C++/Python Bridge.
wchar_t - python Unicode string conversion bottleneck.
malloc function taking some milliseconds

so I about to use Compiler Tweaks

Filesize is 31 MB now

Font converting 31MB - 401.0 ms
Syllable breaking for 31MB - 471.0 ms
Character Reordering for 31MB - 170.0 ms
Normalizing Zawgyi-One for 31MB - 330.0 ms

everything is under 500 ms. Cheers,

and also normal strings copy with C/C++ Python extensions became 161 ms,
(Python string copy 151 ms), not so different now.

Cheers,
Soe Min

Benchmarking My Own Codes

I have tested Font Converting from Unicode 5.1 to Zawgyi, Syllable Breaking, Reordering, Normalizing for Zawgyi-One.

Finally, I ve got great improvements on my Program.

Filesize = 29MB (UTF8) Encoded Big Text File

Computer Specs = Mobile Celeron 1.6 GHz, RAM 512MB, Windows 2000

Font converting 29MB - 450.0 ms
Syllable breaking for 29MB - 691.0 ms
Character Reordering for 29MB - 251.0 ms
Normalizing Zawgyi-One for 29MB - 652.0 ms

Can compare with
Python string copy for 29MB - 160.0 ms (for eg, A="TEXT STRING")

Normal string copy with C/C++ wcscpy, while(*d++=*s++); Ported as Python Extension for 29MB - 280.0 ms

Speed is quite good even for me. :-) everything is under 1 second.

Character Reordering (251 ms) is even faster than C/C++ strcpy Python Extension (280 ms),
Its not strange because its directly modifying source string :-) What the heck :P

Great C/C++ and Python!

Cheers,
Soe Min

Untitled!

Yay! Almost success Zawgyi to Unicode 5.1 and Unicode 5.1 to Zawgyi Converter in Pure C with 60MB+/s

Writing another Zawgyi to Unicode 5.1 Converter with 60MB+/s

Filesize : 29 MB

2009/04/06  00:48           29,134,048 test1.txt
1 個のファイル 29,134,048 バイト

>zawgyi2unicode.py test1.txt 6
converted in 470.0 ms and total time including file read/write 4817.0 ms

Actual Font Conversion time 470 ms, its around 60MB+/s

current computer is RAM 512MB, Mobile Celeron 1.6GHz, Windows 2000

Cheers,
Soe Min

North Korea

North Korea Launched Satellite (so-called)

I thought North Korea is just like Myanmar, But its not. Level is different.

Writing 25MB/s Font Converter from Zawgyi to Unicode 5.1 in C/C++

Writing 25MB/s Font Converter from Zawgyi to Unicode 5.1 in C/C++

Font map are abit different like this.



2009/04/05  22:41        27,453,936 test.txt
1 個のファイル 27,453,936 バイト

> zawgyi2unicode.exe test.txt
converted in 1157.0 ms and total time including file writing 3016.0 ms

its take 1.15 seconds for 27 MB file, only for font converting process.

Still having some errors and testing to get good accurency

Cheers,
Soe Min

Zawgyi Normalization Program

normalize.7z

- extract and run normalize.exe test.txt 6 in command line (Command Prompt).
(6 is zawgyi for this exe file)
- Input file must be UTF8 encoded text file
- outfile will be test.out

Able to fix the following things

ေမာင္ ္ ္ ္ ္ က ု       ိ  က ိ      ု ၏၏၏၏၏၏၏။။။။။။။။။။။။။။။။။။။
ျမျကျခ ျကျကိ ျကြ ျကြိ ျခ ျခြ ျခိ ျခြိ ျခ ျခြ ျခိ ျခြီ

and result will be like this.

ေမာင္္ ကို ကို၏။
ျမျကျချကျကိျကြျကြိျချခြျခိျခြိျချခြျခိျခြီ

Here is my license

- Cannot be used in Commercial related programs, applications, anything , related with commercial things
- Must be credit to me, if you use and put your data or program online.

Cheers,
Soe Min

Burglish Update v1.9.2

updates for unicode 5.1 direct input layout (typewriter input)

In Unicode 5.1, သေဝထိုး and ရရစ္ need to store after consonent(က-အ), like this က, ေက

But from user side, most people want to type ဩေဝထိုး first.

so, i reorder the input sequence after you type in burglish test area.

http://burglish.googlepages.com/testarea.htm
or
http://burglish.my-mm.org/latest/trunk/web/testarea.htm

when you type ေက, it will automatically fix က, and ေျက to က , if you have proper unicode 5.1 font(Myanmar3,Padauk,Parabaik) and render engine (eg. latest uniscribe), you will not see like this ျက , you will instead see, ျက

for ေျမာင္, you need to type ေမ ာ ျင ္. it will properly convert to unicode 5.1 compatible one မ ာ ေျင ္.

and few others update.

Zawgyi's some useful shortcuts like,

Shift Q -်ွ
Shift W -်ြွ
Shift E - ်ြ
Shift K -ွု

can also type in Unicode 5.1 (Myanmar3) through Burglish Test Engine

Cheers,
Soe Min

-ize, -ise

acclimatize -ise
authorize ,-ise
amortization , -ise
agonizing,-ise
aggrandizement -ise

>>> r="(\w+iz\w*)\s*,?\s*\-(is\w*)"
>>> [re.sub(r,"\\1",INPUT),re.sub(r,lambda x:x.group(1).replace("iz","is"),INPUT]

[acclimatize,acclimatise]
[authorize,authorise]
[amortization,amortisation]
[agonizing,agonising]
[aggrandizement,aggrandisement]

I am writing dictionary parser from HTML files lately, for few weeks.

Cheers,
Soe Min

Waitzar Input System အသံုးျပုနည္း

http://myanmaritpros.com/forum/topic/show?id=1445004%3ATopic%3A128025

Download waitzar here. http://code.google.com/p/waitzar/ Its a Windows Client by Seth Hetu.



Thats Fantastic work! Thanks Seth, Cheers.

Rgds,
Soe Min

Serial0/0/0.1/1/1/1:0.1

sh int Serial0/0/0.1/1/1/1:0.1
Oops!, its just too long

က်ေနာ္ဖတ္ေသာ အျခား ဘေလာ့ / ဆိုဒ္မ်ား