FreeLing  3.0
Public Member Functions | Private Member Functions | Private Attributes
phonetics Class Reference

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

#include <phonetics.h>

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

List of all members.

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< sentenceanalyze (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_setRuleSets
 rulesets
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

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.


Member Function Documentation

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]

analyze given sentence

Add phonetic encoding to words in given sentence.

Implements processor.

void phonetics::analyze ( std::list< sentence > &  )

analyze given sentences

Reimplemented from processor.

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.


Member Data Documentation

std::map<std::wstring, std::wstring> phonetics::Exceptions [private]

exceptions. Words with direct sound encoding

std::vector<rule_set> phonetics::RuleSets [private]

rulesets


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