|
FreeLing
4.0
|
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>


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_pos > | order_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_pos & | count_relations (int n, const std::list< related_words > &relations) const |
| Gets the word which appears in most relations. | |
Static Private Attributes | |
| static freeling::semanticDB * | semdb |
| Semantic DB to check the hypernymy. | |
| static int | depth |
| Maximum depth. | |
| static double | alpha |
| Used to compute the homogeinity index. | |
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.
| freeling::hypernymy::hypernymy | ( | int | k, |
| double | alpha, | ||
| const std::wstring & | semfile, | ||
| std::wstring | expr | ||
| ) |
Constructor.
| 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.
double freeling::hypernymy::alpha [static, private] |
Used to compute the homogeinity index.
int freeling::hypernymy::depth [static, private] |
Maximum depth.
freeling::semanticDB* freeling::hypernymy::semdb [static, private] |
Semantic DB to check the hypernymy.
1.7.6.1