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

Class hypernymy represents the hypernymy relation: two words are related if one is an hypernymy of the other and the hypernymy depth is smaller or equal than a given maximum. More...

#include <relation.h>

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

List of all members.

Public Member Functions

 hypernymy (int k, double alpha, const std::wstring &semfile, std::wstring expr)
 Constructor.
double get_homogeneity_index (const std::list< word_pos > &words, const std::list< related_words > &relations, const std::unordered_map< std::wstring, std::pair< int, word_pos * > > &unique_words) const
 Computes the homogeinity index of the given structures using the specific formula of this relation.
bool compute_word (const freeling::word &w, const freeling::sentence &s, const freeling::document &doc, int n_paragraph, int n_sentence, int position, std::list< word_pos > &words, std::list< related_words > &relations, std::unordered_map< std::wstring, std::pair< int, word_pos * > > &unique_words) const
 Returns true and stores the word w in the list words, list relations and unordered_map unique_words if w is compatible with the words in these structures using this relation.
std::list< word_posorder_words_by_weight (const std::unordered_map< std::wstring, std::pair< int, word_pos * > > &unique_words) const
 Sorts the words in unique_words by word frequency and returns a list with them.

Private Member Functions

int hypernymyAux (std::wstring s1, std::wstring s2, int k) const
 Recursive auxiliar function to check if two words are related.
const word_poscount_relations (int n, const std::list< related_words > &relations) const
 Gets the word which appears in most relations.

Static Private Attributes

static freeling::semanticDBsemdb
 Semantic DB to check the hypernymy.
static int depth
 Maximum depth.
static double alpha
 Used to compute the homogeinity index.

Detailed Description

Class hypernymy represents the hypernymy relation: two words are related if one is an hypernymy of the other and the hypernymy depth is smaller or equal than a given maximum.


Constructor & Destructor Documentation

freeling::hypernymy::hypernymy ( int  k,
double  alpha,
const std::wstring &  semfile,
std::wstring  expr 
)

Constructor.


Member Function Documentation

bool freeling::hypernymy::compute_word ( const freeling::word w,
const freeling::sentence s,
const freeling::document doc,
int  n_paragraph,
int  n_sentence,
int  position,
std::list< word_pos > &  words,
std::list< related_words > &  relations,
std::unordered_map< std::wstring, std::pair< int, word_pos * > > &  unique_words 
) const [virtual]

Returns true and stores the word w in the list words, list relations and unordered_map unique_words if w is compatible with the words in these structures using this relation.

Implements freeling::relation.

const word_pos& freeling::hypernymy::count_relations ( int  n,
const std::list< related_words > &  relations 
) const [private]

Gets the word which appears in most relations.

double freeling::hypernymy::get_homogeneity_index ( const std::list< word_pos > &  words,
const std::list< related_words > &  relations,
const std::unordered_map< std::wstring, std::pair< int, word_pos * > > &  unique_words 
) const [virtual]

Computes the homogeinity index of the given structures using the specific formula of this relation.

Implements freeling::relation.

int freeling::hypernymy::hypernymyAux ( std::wstring  s1,
std::wstring  s2,
int  k 
) const [private]

Recursive auxiliar function to check if two words are related.

std::list<word_pos> freeling::hypernymy::order_words_by_weight ( const std::unordered_map< std::wstring, std::pair< int, word_pos * > > &  unique_words) const [virtual]

Sorts the words in unique_words by word frequency and returns a list with them.

Implements freeling::relation.


Member Data Documentation

double freeling::hypernymy::alpha [static, private]

Used to compute the homogeinity index.

int freeling::hypernymy::depth [static, private]

Maximum depth.

Semantic DB to check the hypernymy.


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