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

The class dictionary implements dictionary search and suffix analysis for word forms. More...

#include <dictionary.h>

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

List of all members.

Public Member Functions

 dictionary (const std::wstring &, const std::wstring &, bool, const std::wstring &, bool invDic=false, bool retok=true)
 Constructor.
 ~dictionary ()
 Destructor.
void search_form (const std::wstring &, std::list< analysis > &)
 Get dictionary entry for a given form, add to given list.
bool annotate_word (word &, std::list< word > &)
 Fills the analysis list of a word, checking for suffixes and contractions.
std::list< std::wstring > get_forms (const std::wstring &, const std::wstring &) const
 Get possible forms for a lemma+pos.
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

bool check_contracted (const std::wstring &, std::wstring, std::wstring, std::list< word > &)
 check whether the word is a contraction, and if so, fill the list with the contracted words

Private Attributes

bool AffixAnalysis
 configuration options
bool InverseDict
bool RetokenizeContractions
affixessuf
 suffix analyzer
databasemorfodb
 key-value file or hash
databaseinverdb

Detailed Description

The class dictionary implements dictionary search and suffix analysis for word forms.


Constructor & Destructor Documentation

dictionary::dictionary ( const std::wstring &  Lang,
const std::wstring &  dicFile,
bool  activateAff,
const std::wstring &  sufFile,
bool  invDic = false,
bool  retok = true 
)

Constructor.

Create a dictionary module, open database.

References DB_MAP, DB_PREFTREE, ERROR_CRASH, util::open_utf8_file(), TRACE, and util::wstring2list().

Destructor.

Destroy dictionary module, close database.


Member Function Documentation

void dictionary::analyze ( sentence se) [virtual]

analyze given sentence

Dictionary search and affix analysis for all words in a sentence, using given options.

Implements processor.

References util::int2wstring(), sentence::rebuild_word_index(), TRACE, and TRACE_SENTENCE.

Referenced by maco::analyze().

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

analyze given sentences

Reimplemented from processor.

analyze sentence, return analyzed copy

Look up in given sentence for punctuation.

Return copy

Reimplemented from processor.

References processor::analyze().

std::list<sentence> dictionary::analyze ( const std::list< sentence > &  )

analyze sentences, return analyzed copy

Reimplemented from processor.

bool dictionary::annotate_word ( word ,
std::list< word > &   
)

Fills the analysis list of a word, checking for suffixes and contractions.

Search form in the dictionary, according to given options, Add* found analysis to the given word.

Returns true iff the form is a contraction.

Return true iff word is a contraction.

References word::add_analysis(), word::get_form(), word::get_n_analysis(), util::int2wstring(), word::set_found_in_dict(), TRACE, and WARNING.

bool dictionary::check_contracted ( const std::wstring &  ,
std::wstring  ,
std::wstring  ,
std::list< word > &   
) [private]

check whether the word is a contraction, and if so, fill the list with the contracted words

Check whether the given word is a contraction, if so, obtain composing words (and store them into lw).

References word::add_analysis(), util::capitalization(), util::capitalize(), ERROR_CRASH, word::get_n_analysis(), util::list2wstring(), TRACE, util::uppercase(), and util::wstring2list().

list< wstring > dictionary::get_forms ( const std::wstring &  ,
const std::wstring &   
) const

Get possible forms for a lemma+pos.

References WARNING, and util::wstring2list().

void dictionary::search_form ( const std::wstring &  s,
std::list< analysis > &  la 
)

Get dictionary entry for a given form, add to given list.

Search form in the dictionary, according to given options, Add* found analysis to the given list.

References util::int2wstring(), util::list2wstring(), util::lowercase(), TRACE, and util::wstring2list().

Referenced by affixes::CheckRetokenizable(), and affixes::SearchRootsList().


Member Data Documentation

configuration options

key-value file or hash

suffix analyzer


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