|
FreeLing
3.0
|
This class is a will calculate the phonetic translation of a word. More...
#include <phonetics.h>


Public Member Functions | |
| phonetics (const std::wstring &) | |
| Constructor, given config file. | |
| std::wstring | get_sound (const std::wstring &) |
| Returns the phonetic sound of the word. | |
| void | analyze (sentence &) |
| analyze given sentence | |
| void | analyze (std::list< sentence > &) |
| analyze given sentences | |
| sentence | analyze (const sentence &) |
| analyze sentence, return analyzed copy | |
| std::list< sentence > | analyze (const std::list< sentence > &) |
| analyze sentences, return analyzed copy | |
Private Member Functions | |
| void | add_rule (const std::wstring &, const std::wstring &, const std::wstring &) |
| insert a new rule in rules list | |
| void | apply_rule (const ph_rule &, std::wstring &) const |
| Apply given rule to given string, performing required changes. | |
| bool | check_cond (const std::wstring &, const std::wstring &, int, const std::wstring &) const |
| check that the conditions for the sound change are true | |
Private Attributes | |
| std::vector< rule_set > | RuleSets |
| rulesets | |
| std::map< std::wstring, std::wstring > | Exceptions |
| exceptions. Words with direct sound encoding | |
This class is a will calculate the phonetic translation of a word.
| phonetics::phonetics | ( | const std::wstring & | ) |
Constructor, given config file.
Create the phonetic translator.
regexps to parse rules
References ERROR_CRASH, util::open_utf8_file(), TRACE, and WARNING.
| void phonetics::add_rule | ( | const std::wstring & | , |
| const std::wstring & | , | ||
| const std::wstring & | |||
| ) | [private] |
insert a new rule in rules list
Insert a new rule in rules list.
References ph_rule::env, ph_rule::from, ph_rule::to, TRACE, and WARNING.
| void phonetics::analyze | ( | sentence & | s | ) | [virtual] |
| void phonetics::analyze | ( | std::list< sentence > & | ) |
analyze given sentences
Reimplemented from processor.
| sentence phonetics::analyze | ( | const sentence & | s | ) |
analyze sentence, return analyzed copy
Add phonetic encoding to words in given sentence.
Return copy
Reimplemented from processor.
References processor::analyze().
| std::list<sentence> phonetics::analyze | ( | const std::list< sentence > & | ) |
analyze sentences, return analyzed copy
Reimplemented from processor.
| void phonetics::apply_rule | ( | const ph_rule & | , |
| std::wstring & | |||
| ) | const [private] |
Apply given rule to given string, performing required changes.
Replace all ocurrences in text of "findStr" with replaceStr, if "[findStr]" then replaces every char(i) of findStr for replaceStr(i)
References ph_rule::env, ph_rule::from, ph_rule::to, and TRACE.
| bool phonetics::check_cond | ( | const std::wstring & | , |
| const std::wstring & | , | ||
| int | , | ||
| const std::wstring & | |||
| ) | const [private] |
check that the conditions for the sound change are true
check that the enviorment is true
References util::find_and_replace(), util::int2wstring(), and TRACE.
| wstring phonetics::get_sound | ( | const std::wstring & | ) |
Returns the phonetic sound of the word.
getSound return the phonetic translation of a word encoded in SAMPA
References TRACE.
std::map<std::wstring, std::wstring> phonetics::Exceptions [private] |
exceptions. Words with direct sound encoding
std::vector<rule_set> phonetics::RuleSets [private] |
rulesets
1.7.6.1