FreeLing  4.0
Public Member Functions | Private Member Functions | Private Attributes
freeling::phonetics Class Reference

This class is a will calculate the phonetic translation of a word. More...

#include <phonetics.h>

Inheritance diagram for freeling::phonetics:
Inheritance graph
[legend]
Collaboration diagram for freeling::phonetics:
Collaboration graph
[legend]

List of all members.

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_setRuleSets
 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

Detailed Description

This class is a will calculate the phonetic translation of a word.


Constructor & Destructor Documentation

freeling::phonetics::phonetics ( const std::wstring &  )

Destructor.

References Cache.


Member Function Documentation

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().


Member Data Documentation

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().


The documentation for this class was generated from the following files: