Module: ZhongwenTools::Romanization::ZhuyinFuhao

Defined in:
lib/zhongwen_tools/romanization/zhuyin_fuhao.rb

Class Method Summary collapse

Class Method Details

.bpmf?(str) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/zhongwen_tools/romanization/zhuyin_fuhao.rb', line 11

def self.bpmf?(str)
  regex = ZhongwenTools::Regex.bopomofo

  ZhongwenTools::Romanization.detect_romanization(str, regex)
end

.split(str) ⇒ Object



17
18
19
20
21
# File 'lib/zhongwen_tools/romanization/zhuyin_fuhao.rb', line 17

def self.split(str)
  regex = /([#{ZhongwenTools::Regex.bopomofo}]*)/

  ZhongwenTools::Romanization.split_romanization(str, regex)
end

.to_bpmf(*args) ⇒ Object



4
5
6
7
8
9
# File 'lib/zhongwen_tools/romanization/zhuyin_fuhao.rb', line 4

def self.to_bpmf(*args)
  str, from = args
  from ||= ZhongwenTools::Romanization.romanization?(str)

  ZhongwenTools::Romanization.convert str, :bpmf, from.to_sym
end