|
FreeLing
4.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. | |
| ~phonetics () | |
| Destructor. | |
| std::wstring | get_sound (const std::wstring &) const |
| Returns the phonetic sound of the word. | |
| void | analyze (sentence &) const |
| analyze given sentence | |
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. | |
Private Attributes | |
| std::vector< rule_set > | RuleSets |
| rulesets | |
| std::vector< safe_map < std::wstring, std::wstring > * > | Cache |
| internal caches with phonetic translation of already seen words. | |
| 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.
| freeling::phonetics::phonetics | ( | const std::wstring & | ) |
Constructor, given config file.
Create the phonetic translator.
regexps to parse rules
References add_rule(), freeling::config_file::add_section(), freeling::config_file::at_section_start(), Cache, freeling::config_file::close(), ERROR_CRASH, Exceptions, freeling::config_file::get_content_line(), freeling::config_file::get_section(), freeling::config_file::open(), RuleSets, freeling::regexp::search(), TRACE, and WARNING.
Destructor.
References Cache.
| void freeling::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 freeling::ph_rule::env, freeling::ph_rule::from, freeling::ph_rule::re_env, RuleSets, freeling::ph_rule::to, TRACE, and WARNING.
Referenced by phonetics().
| void freeling::phonetics::analyze | ( | sentence & | s | ) | const [virtual] |
analyze given sentence
Add phonetic encoding to words in given sentence.
Implements freeling::processor.
References get_sound().
| void freeling::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 freeling::ph_rule::from, freeling::ph_rule::re_env, freeling::regexp::search(), and freeling::ph_rule::to.
Referenced by get_sound().
| wstring freeling::phonetics::get_sound | ( | const std::wstring & | ) | const |
Returns the phonetic sound of the word.
getSound return the phonetic translation of a word encoded in SAMPA
References apply_rule(), Cache, Exceptions, int2wstring, RuleSets, and TRACE.
Referenced by freeling::alternatives::alternatives(), analyze(), and freeling::alternatives::get_similar_words().
std::vector<safe_map<std::wstring, std::wstring> *> freeling::phonetics::Cache [private] |
internal caches with phonetic translation of already seen words.
One cache for each ruleset
Referenced by get_sound(), phonetics(), and ~phonetics().
std::map<std::wstring, std::wstring> freeling::phonetics::Exceptions [private] |
exceptions. Words with direct sound encoding
Referenced by get_sound(), and phonetics().
std::vector<rule_set> freeling::phonetics::RuleSets [private] |
rulesets
Referenced by add_rule(), get_sound(), and phonetics().
1.7.6.1