Text Analytics Library
a collection of routines for simple textual analysis
 All Files Functions Typedefs
word_map.h
Go to the documentation of this file.
1 
5 #ifndef _WORD_MAP_H_
6 #define _WORD_MAP_H_
7 
8 typedef struct word_map* word_map_t;
9 typedef struct word_map_node* word_node_t;
10 
11 enum { AMAP_SORT_DESCENDING=0x00,
12  AMAP_SORT_ASCENDING=0x01 };
13 
17 word_map_t word_map_create(size_t n);
18 
22 void word_map_free(word_map_t words);
23 
29 word_node_t
30 word_map_find(const word_map_t wm, const char* word);
31 
32 int
33 word_map_insert(word_map_t wm, const char* key, int val);
34 
35 void
36 word_map_sort(word_map_t wm, int(*compar)(const void*, const void*));
37 
38 unsigned long
39 word_map_count(const word_map_t wm);
40 
41 void
42 word_count_inc(word_node_t node, int value);
43 
44 int
45 word_node_compare(const word_node_t n1, const word_node_t n2, int opt);
46 
58 void
59 word_map_foreach(const word_map_t wm, void(*fnct)(const char*, int));
60 
70 void
71 word_map_nforeach(const word_map_t wm, void(*fnct)(const char*, int), int n);
72 
73 #endif
word_map_t word_map_create(size_t n)
void word_map_foreach(const word_map_t wm, void(*fnct)(const char *, int))
apply a function to each item in word map
void word_map_nforeach(const word_map_t wm, void(*fnct)(const char *, int), int n)
apply a function to the first n word map items
void word_map_free(word_map_t words)
word_node_t word_map_find(const word_map_t wm, const char *word)