-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Memory allocation reduced to 118K from 747K + ZhongwenTools::Regex - fixed a regex. + ZhongwenTools::Regex - :punc includes zh punctuation. This is different from previous functionality where :punc returned a regex that only captured non-zh characters. + ZhongwenTools::Regex - use Character Properties instead of long regexes. + Ruby 1.9 fixed encoding error + ZhongwenTools::Romanization::Pinyin - added a special case for yìnián. + ZhongwenTools::Romanization::Pinyin - linting. + ZhongwenTools::Romanization - removed dynamic module/method creation + ZhongwenTools::Romanization::ZhuyinFuhao - added module. + ZhongwenTools::Romanization::WadeGiles - added module. + ZhongwenTools::Romanization::Yale - added module. + ZhongwenTools::Romanization::MPS2 - added module. + ZhongwenTools::Romanization::TongyongPinyin - added module.
- Loading branch information
1 parent
4fafea5
commit 3e64a2e
Showing
13 changed files
with
194 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module ZhongwenTools | ||
module Romanization | ||
module MPS2 | ||
def self.to_mps2(*args) | ||
str, from = args | ||
from ||= ZhongwenTools::Romanization.romanization?(str) | ||
|
||
ZhongwenTools::Romanization.convert str, :mps2, from.to_sym | ||
end | ||
|
||
def self.mps2?(str) | ||
regex = ZhongwenTools::Romanization.detect_regex(:mps2) | ||
ZhongwenTools::Romanization.detect_romanization(str, regex) | ||
end | ||
|
||
def self.split(str) | ||
regex = /(#{ ZhongwenTools::Romanization.detect_regex(:mps2) }*)/ | ||
ZhongwenTools::Romanization.split_romanization(str, regex) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module ZhongwenTools | ||
module Romanization | ||
module TongyongPinyin | ||
def self.to_typy(*args) | ||
str, from = args | ||
from ||= ZhongwenTools::Romanization.romanization?(str) | ||
|
||
ZhongwenTools::Romanization.convert str, :typy, from.to_sym | ||
end | ||
|
||
def self.typy?(str) | ||
regex = ZhongwenTools::Romanization.detect_regex(:typy) | ||
ZhongwenTools::Romanization.detect_romanization(str, regex) | ||
end | ||
|
||
def self.split(str) | ||
regex = /(#{ ZhongwenTools::Romanization.detect_regex(:typy) }*)/ | ||
ZhongwenTools::Romanization.split_romanization(str, regex) | ||
end | ||
|
||
class << self | ||
[:tongyong, :tongyong_pinyin].each do |m| | ||
alias_method "to_#{ m }".to_sym, :to_typy | ||
alias_method "#{ m }?", :typy? | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module ZhongwenTools | ||
module Romanization | ||
module WadeGiles | ||
def self.to_wg(*args) | ||
str, from = args | ||
from ||= ZhongwenTools::Romanization.romanization?(str) | ||
|
||
ZhongwenTools::Romanization.convert str, :wg, from.to_sym | ||
end | ||
|
||
def self.wg?(str) | ||
regex = ZhongwenTools::Romanization.detect_regex(:wg) | ||
ZhongwenTools::Romanization.detect_romanization(str, regex) | ||
end | ||
|
||
def self.split(str) | ||
regex = /(#{ ZhongwenTools::Romanization.detect_regex(:wg) }*)/ | ||
ZhongwenTools::Romanization.split_romanization(str, regex) | ||
end | ||
|
||
class << self | ||
[:wade_giles, :wadegiles].each do |m| | ||
alias_method "to_#{ m }".to_sym, :to_wg | ||
alias_method "#{ m }?", :wg? | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.