Module: Phonet
- Defined in:
- lib/phonet.rb
Constant Summary collapse
- PHONET_FIRST_RULES =
constants for function “phonet” (do not change)
0
- PHONET_SECOND_RULES =
1024
- PHONET_NO_LANGUAGE =
If you don’t want rules for one or more of the ****/ following languages, delete the corresponding macro ****/
1
- PHONET_GERMAN =
2
- PHONET_DEFAULT_LANGUAGE =
PHONET_GERMAN
Class Method Summary collapse
- .iso88591_to_utf8(string) ⇒ Object
- .phonet(string, rules) ⇒ Object
- .set_language(language) ⇒ Object
- .utf8_to_iso88591(string) ⇒ Object
Class Method Details
.iso88591_to_utf8(string) ⇒ Object
34 35 36 |
# File 'lib/phonet.rb', line 34 def Phonet.iso88591_to_utf8(string) return Iconv.conv("UTF-8", "ISO-8859-1", string) end |
.phonet(string, rules) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/phonet.rb', line 17 def Phonet.phonet(string, rules) input = Phonet.utf8_to_iso88591(string) buffer = "\000" * (input.length * 2) Phonet_api.phonet(input, buffer, buffer.length, rules) result = buffer.unpack("Z*").join result = Phonet.iso88591_to_utf8(result) return result end |
.set_language(language) ⇒ Object
26 27 28 |
# File 'lib/phonet.rb', line 26 def Phonet.set_language(language) Phonet_api.set_phonet_language(language) end |
.utf8_to_iso88591(string) ⇒ Object
30 31 32 |
# File 'lib/phonet.rb', line 30 def Phonet.utf8_to_iso88591(string) return Iconv.conv("ISO-8859-1", "UTF-8", string) end |