Skip to content

Commit

Permalink
add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
saturngod committed Oct 2, 2018
1 parent bbd8a08 commit b94ea33
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 105 deletions.
2 changes: 1 addition & 1 deletion Packages/Swift
Submodule Swift updated 1 files
+2 −2 Classes/Rabbit.swift
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,10 @@ node build.js
```

You can get build result under the `output` folder.

## Changelog

### 3/10/2018

- add kotlin and using hash map instead of json. Thanks @vincent-paing
- remove swift 1 and 2 in compile list. No more support.
1 change: 1 addition & 0 deletions other-lang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Todo
- [x] PHP
- [x] Ruby
- [x] C#
- [x] Kotlin

## For Java

Expand Down
222 changes: 222 additions & 0 deletions other-lang/kotlin/Rabbit.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
class Rabbit {
companion object {
fun uni2zg(input: String): String {
val rules = mapOf<String,String>(
"င်္" to "",
"္တွ" to "",
"ါ်" to "",
"ဋ္ဌ" to "",
"ိံ" to "",
"၎င်း" to "",
"[ဥဉ](?=[္ုူ])" to "",
"[ဥဉ](?=[့]?[်])" to "",
"ည(?=[္ွ])" to "",
"(္[က-အ])(ိ){0,1}ု" to "$1$2ဳ",
"(္[က-အ])ူ" to "$1ဴ",
"န(?=[ိီ]?[ူွှု္])" to "",
"နြ" to "ႏြ",
"္က" to "",
"္ခ" to "",
"္ဂ" to "",
"္ဃ" to "",
"္စ" to "",
"္ဆ" to "",
"္ဇ" to "",
"္ဈ" to "",
"္ဋ" to "",
"္ဌ" to "",
"ဍ္ဍ" to "",
"ဍ္ဎ" to "",
"္ဏ" to "",
"္တ" to "",
"္ထ" to "",
"္ဒ" to "",
"္ဓ" to "",
"္[နႏ]" to "",
"္ပ" to "",
"္ဖ" to "",
"္ဗ" to "",
"္ဘ" to "",
"္မ" to "",
"္လ" to "",
"" to "",
"ွှ" to "",
"(ၤ)([က-အ])([ျြ]?)ိ" to "$2$3ႋ",
"(ၤ)([က-အ])([ျြ]?)ီ" to "$2$3ႌ",
"(ၤ)([က-အ])([ျြ]?)ံ" to "$2$3ႍ",
"(ၤ)([က-အ])([ျြ]?)([ေ]?)" to "$2$3$4$1",
"ရ(?=([ိီ]?)[ုူွႊ])" to "",
"ဏ္ဍ" to "",
"ဋ္ဋ" to "",
"([က-အႏဩၮၯႆ႐႑႒႗])([ၠ-ၩၬၭၰ-ၼႅႊ])?([ျ-ှ]*)?ေ" to "ေ$1$2$3",
"ြှ" to "ြႇ",
"([က-အႏဩ])([ၠ-ၩၬၭၰ-ၼႅ])?(ြ)" to "$3$1$2",
"" to "",
"" to "",
"" to "",
"" to "",
"" to "",
"([^်ည])ွ([ိီ]?)ု" to "$1ႈ$2",
"([ရ်ြႊႈ႐])([ူွ])?([ဲံ္ိီႋႌႍႎ]?)(ု)?့" to "$1$2$3$4႕",
"([ုနူွ])([ဲံ္ိီႋႌႍႎ]?)့" to "$1$2႔",
"([ျ])([က-အ])([ႇ]?)([ံိီႋႌႍႎ]?)ု" to "$1$2$3$4ဳ",
"([ျ])([က-အ])([ႇ]?)([ံိီႋႌႍႎ]?)ူ" to "$1$2$3$4ဴ",
"([်ြညဠဥ])([ွ]?)([ံိီႋႌႍႎ]?)ု" to "$1$2$3ဳ",
"([်ြညရ])(ွ?)([ံိီႋႌႍႎ]?)ူ" to "$1$2$3ဴ",
"ညွ" to "ညႇ",
"ွူ" to "",
"ျ([ကဃဆဏတထဘယလယသဟ])" to "ၾ$1",
"ၾ([ကဃဆဏတထဘယလယသဟ])([ြႊ])([ဲံိီႋႌႍႎ])" to "ႄ$1$2$3",
"ၾ([ကဃဆဏတထဘယလယသဟ])([ြႊ])" to "ႂ$1$2",
"ၾ([ကဃဆဏတထဘယလယသဟ])([ဳဴ]?)([ဲံိီႋႌႍႎ])" to "ႀ$1$2$3",
"ျ([က-အ])([ြႊ])([ဲံိီႋႌႍႎ])" to "ႃ$1$2$3",
"ျ([က-အ])([ြႊ])" to "ႁ$1$2",
"ျ([က-အ])([ဳဴ]?)([ဲံိီႋႌႍႎ])" to "ၿ$1$2$3",
"်ွ" to "ွ်",
"်([ြႊ])" to "$1ၽ",
"([ဳဴ])႔" to "$1႕",
"ႏၱ" to "ႏၲ",
"([က-အ])([ၻၦ])ာ" to "$1ာ$2",
"ာ([ၻၦ])့" to "ာ$1႔"
)

return replaceWithRule(rules,input)
}

fun zg2uni(input: String): String {
val rules = mapOf<String,String>(
"([ိီွု့႕])\\1+" to "$1",
"" to "",
"ွြ" to "",
"(ွ|ႇ)" to "",
"" to "",
"(ျ|ၾ|ၿ|ႀ|ႁ|ႂ|ႃ|ႄ)" to "",
"(်|ၽ)" to "",
"" to "",
"(ၦ|ၧ)" to "္ဆ",
"" to "",
"" to "",
"" to "္ဋ",
"" to "္ဌ",
"" to "ဍ္ဍ",
"" to "ဍ္ဎ",
"" to "္ဏ",
"(ၱ|ၲ)" to "္တ",
"" to "္က",
"" to "္ခ",
"" to "္ဂ",
"" to "္ဃ",
"" to "္စ",
"" to "္ဇ",
"" to "္ဈ",
"(ၳ|ၴ)" to "္ထ",
"" to "္ဒ",
"" to "္ဓ",
"" to "္န",
"" to "္ပ",
"" to "္ဖ",
"" to "္ဗ",
"" to "္မ",
"" to "္လ",
"" to "",
"" to "",
"" to "",
"" to "",
"ံႈ" to "ႈံ",
"" to "ှု",
"" to "ှူ",
"" to "ွှ",
"ျၤ" to "ၤျ",
"(ေ)?([က-အ])ၤ" to "င်္$1$2",
"(ေ)?([က-အ])(ျ)?ႋ" to "င်္$1$2$3ိ",
"(ေ)?([က-အ])(ျ)?ႌ" to "င်္$1$2$3ီ",
"(ေ)?([က-အ])ႍ" to "င်္$1$2ံ",
"" to "ိံ",
"" to "",
"" to "",
"" to "ဏ္ဍ",
"" to "ဋ္ဌ",
"မာ(ၻ|႓)" to "မ္ဘာ",
"(ၻ|႓)" to "္ဘ",
"(႔|႕)" to "",
"([က-အ])့ဲ" to "$1ဲ့",
"" to "္တွ",
"" to "ဋ္ဋ",
"ြ([က-အ])([က-အ])?" to "$1ြ$2",
"([က-အ])ြ်" to "ြ$1်",
"၇(?=[ာ-ူဲံ-းွး])" to "",
"ေ၇" to "ေရ",
"၀(ီ|ု|ို|ူ|ံ|ွ|ှ)" to "ဝ$1",
"([^၀၁၂၃၄၅၆၇၈၉])၀ါ" to "$1ဝါ",
"([၀၁၂၃၄၅၆၇၈၉])၀ါ(?!း)" to "$1ဝါ",
"^၀(?=ါ)" to "",
"၀ိ(?! ?/)" to "ဝိ",
"([^၀-၉])၀([^၀-၉ ]|[၊။])" to "$1ဝ$2",
"([^၀-၉])၀(?=[\\f\n\r])" to "$1ဝ",
"([^၀-၉])၀$" to "$1ဝ",
"ေ([က-အဿ])(ှ)?(ျ)?" to "$1$2$3ေ",
"([က-အ])ေ([ျြွှ]+)" to "$1$2ေ",
"ဲွ" to "ွဲ",
"([ိီ])ျ" to "ျ$1",
"ွျ" to "ျွ",
"့်" to "့်",
"ု(ိ|ီ|ံ|့)ု" to "ု$1",
"(ု|ူ)(ိ|ီ)" to "$2$1",
"(ှ)(ျ|ြ)" to "$2$1",
"ဥ(?=[့]?[်ာ])" to "",
"ဦ" to "",
"စျ" to "",
"ံ(ု|ူ)" to "$1ံ",
"ေ့ှ" to "ှေ့",
"ေှာ" to "ှော",
"" to "ါ်",
"ေျှ" to "ျှေ",
"(ိ|ီ)(ွ|ှ)" to "$2$1",
"ာ္([က-အ])" to "္$1ာ",
"္ြ်္([က-အ])" to "်္$1ြ",
"ြ္([က-အ])" to "္$1ြ",
"ံ္([က-အ])" to "္$1ံ",
"" to "၎င်း",
"၀(ါ|ာ|ံ)" to "ဝ$1",
"ဥ္" to "ဉ္",
"([က-အ])ြေွ" to "$1ြွေ",
"([က-အ])ျေွ(ှ)?" to "$1ျွ$2ေ",
"([က-အ])ွေျ" to "$1ျွေ",
"([က-အ])ေ(္[က-အ])" to "$1$2ေ",
"း်" to "်း",
"ိ်|်ိ" to "",
"ို်" to "ို",
"" to "",
"့ံ" to "ံ့",
"" to "",
"[ိ]+" to "",
"[်]+" to "",
"[ွ]+" to "",
"[့]+" to "",
"[ီ]+" to "",
"ိီ|ီိ" to "",
"ုိ" to "ို",
"့့" to "",
"ဲဲ" to "",
"၄င်း" to "၎င်း",
"([ိီ])္([က-အ])" to "္$2$1",
"(ြေ)္([က-အ])" to "္$2$1",
"ံွ" to "ွံ"
)

return replaceWithRule(rules,input)
}

private fun replaceWithRule(rules: Map<String,String>, input: String): String {
var output = input

rules.forEach {(from,to) ->
val reg = Regex(from)
output = output.replace(reg,to)
}

return output
}

}
}
Loading

0 comments on commit b94ea33

Please sign in to comment.