Giter Site home page Giter Site logo

swanhtet1992 / resegment Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 8.0 9 KB

Burmese (Myanmar) syllable level segmentation with regex.

Python 16.57% Java 22.41% HTML 19.72% JavaScript 2.58% Swift 20.48% Ruby 18.24%
myanmar-nlp myanmar-text burmese-nlp nlp segmentation

resegment's Introduction

ReSegment

This is Burmese syllable level segmentation by using the power of regex. The original regex is based on sylbreak by Ko Ye Kyaw Thu.

After testing with various news articles, these are the additional improvements:

  • Added support for numbers. (၁၀၀ကျပ် will be segmented into ['၁၀၀', 'ကျပ်'])
  • Added support for words with special killers. This scenario can be see mostly in English names like ဘတ်ဇ်ခရောရှ့်ဂတ် -> ['ဘတ်ဇ်', 'ခ', 'ရောရှ့်', 'ဂတ်'] and ဂျော့ချ်ဘုရှ် -> ['ဂျော့ချ်', 'ဘုရှ်'].
  • Added support for updated tone mark and killer rule. (သ + င + ့ + ် or သ + င + ် + ့ will be able to segment correctly into ['သင့်'])

TEST

Text: ဝန်ကြီးချုပ်ဦးဖြိုးမင်းသိန်း ခွင့်ထပ်တိုင် ရန်ကုန်တိုင်းလွှတ်တော်မှာ YBS စနစ်ပြုပြင်ပြောင်းလဲဖို့ တင်သွင်းတဲ့အဆိုအတည်ပြုဖို့၊ မပြုဖို့ ဆုံးဖြတ်မယ့်မနက်ဖြန်လွှတ်တော်အစည်းအဝေးကိုလည်း ဝန်ကြီးချုပ်ဦးဖြိုးမင်းသိန်းက ခွင့်ထပ်တိုင်ခဲ့ကြောင်းသိရပါတယ်

Result: ['ဝန်', 'ကြီး', 'ချုပ်', 'ဦး', 'ဖြိုး', 'မင်း', 'သိန်း', ' ', 'ခွင့်', 'ထပ်', 'တိုင်', ' ', 'ရန်', 'ကုန်', 'တိုင်း', 'လွှတ်', 'တော်', 'မှာ', ' YBS ', 'စ', 'နစ်', 'ပြု', 'ပြင်', 'ပြောင်း', 'လဲ', 'ဖို့', ' ', 'တင်', 'သွင်း', 'တဲ့', 'အ', 'ဆို', 'အ', 'တည်', 'ပြု', 'ဖို့', '၊', ' ', 'မ', 'ပြု', 'ဖို့', ' ', 'ဆုံး', 'ဖြတ်', 'မယ့်', 'မ', 'နက်', 'ဖြန်', 'လွှတ်', 'တော်', 'အ', 'စည်း', 'အ', 'ဝေး', 'ကို', 'လည်း', ' ', 'ဝန်', 'ကြီး', 'ချုပ်', 'ဦး', 'ဖြိုး', 'မင်း', 'သိန်း', 'က', ' ', 'ခွင့်', 'ထပ်', 'တိုင်', 'ခဲ့', 'ကြောင်း', 'သိ', 'ရ', 'ပါ', 'တယ်']


Text: စီအိုင်အေက နှိပ်စက်စစ်ဆေးမှု တွေလုပ်ခဲ့ အမေရိကန်-ဗဟိုထောက်လှမ်းရေး ဌာန CIA ဟာ သမ္မတဟောင်း ဂျော့ချ်ဘုရှ် လက်ထက် စက်တင်ဘာ ၁၁ ရက် တိုက်ခိုက်ခံရမှု နောက်ပိုင်း စစ်ဆေးမှုတွေလုပ်ရာမှာ နှိပ်စက်ညှင်းပန်းမှုတွေ ကျူးလွန်ခဲ့ဖူးတယ်လို့ စီအိုင်အေရဲ့ အကြီးအကဲဟောင်း ဘတ်ဇ်ခရောရှ့်ဂတ်က ဘီဘီစီကို ပြောခဲ့ပါတယ်။

Result: ['စီ', 'အိုင်', 'အေ', 'က', ' ', 'နှိပ်', 'စက်', 'စစ်', 'ဆေး', 'မှု', ' ', 'တွေ', 'လုပ်', 'ခဲ့', ' ', 'အ', 'မေ', 'ရိ', 'ကန်', '-', 'ဗ', 'ဟို', 'ထောက်', 'လှမ်း', 'ရေး', ' ', 'ဌာ', 'န', ' CIA ', 'ဟာ', ' ', 'သမ္မ', 'တ', 'ဟောင်း', ' ', 'ဂျော့ချ်', 'ဘုရှ်', ' ', 'လက်', 'ထက်', ' ', 'စက်', 'တင်', 'ဘာ', ' ', '၁၁', ' ', 'ရက်', ' ', 'တိုက်', 'ခိုက်', 'ခံ', 'ရ', 'မှု', ' ', 'နောက်', 'ပိုင်း', ' ', 'စစ်', 'ဆေး', 'မှု', 'တွေ', 'လုပ်', 'ရာ', 'မှာ', ' ', 'နှိပ်', 'စက်', 'ညှင်း', 'ပန်း', 'မှု', 'တွေ', ' ', 'ကျူး', 'လွန်', 'ခဲ့', 'ဖူး', 'တယ်', 'လို့', ' ', 'စီ', 'အိုင်', 'အေ', 'ရဲ့', ' ', 'အ', 'ကြီး', 'အ', 'ကဲ', 'ဟောင်း', ' ', 'ဘတ်ဇ်', 'ခ', 'ရောရှ့်', 'ဂတ်', 'က', ' ', 'ဘီ', 'ဘီ', 'စီ', 'ကို', ' ', 'ပြော', 'ခဲ့', 'ပါ', 'တယ်', '။']


Text: တောင်ကိုရီးယား အခြေစိုက် Posco Daewoo နှင့် သြစတြေးလျအခြေစိုက် Woodside တို့ အကျိုးတူ ပူးပေါင်းဆောင်ရွက်နေသည့် ရခိုင်ကမ်းလွန်ရှိ AD-7

Result: ['တောင်', 'ကို', 'ရီး', 'ယား', ' ', 'အ', 'ခြေ', 'စိုက်', ' Posco Daewoo ', 'နှင့်', ' ', 'သြ', 'စ', 'တြေး', 'လျ', 'အ', 'ခြေ', 'စိုက်', ' Woodside ', 'တို့', ' ', 'အ', 'ကျိုး', 'တူ', ' ', 'ပူး', 'ပေါင်း', 'ဆောင်', 'ရွက်', 'နေ', 'သည့်', ' ', 'ရ', 'ခိုင်', 'ကမ်း', 'လွန်', 'ရှိ', 'AD-7']


Text: ၂၀၁၈ခုနှစ်အာရှအားကစားပြိုင်ပွဲတွင် အားကစားနည်းအရေအတွက် တိုးမြင့်လာခဲ့

Result: ['၂၀၁၈', 'ခု', 'နှစ်', 'အာ', 'ရှ', 'အား', 'က', 'စား', 'ပြိုင်', 'ပွဲ', 'တွင်', ' ', 'အား', 'က', 'စား', 'နည်း', 'အ', 'ရေ', 'အ', 'တွက်', ' ', 'တိုး', 'မြင့်', 'လာ', 'ခဲ့']


Text: ပိဿာချိန်၁၀သားရှိသောကြက်သားများချက်ပြုတ်ကျွေးမွေးလှူဒါန်းသွားသည့်အတွက်ကျေးဇူးတင်ပါသည်။

Result: ['ပိ', 'ဿာ', 'ချိန်', '၁၀', 'သား', 'ရှိ', 'သော', 'ကြက်', 'သား', 'များ', 'ချက်', 'ပြုတ်', 'ကျွေး', 'မွေး', 'လှူ', 'ဒါန်း', 'သွား', 'သည့်', 'အ', 'တွက်', 'ကျေး', 'ဇူး', 'တင်', 'ပါ', 'သည်', '။']

NOTE

This is just a simple proof of concept repo. Although I have tested the regex with various news articles, errors may still exist. Therefore, the code is provided “AS IS” without any warranty of any kind.

Contributors

Java and Javascript versions are contributed by chanmratekoko so that you don't have to convert the regex on your own. 🤠

resegment's People

Contributors

chanmratekoko avatar swanhtet1992 avatar vincent-paing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.