Text Analytics Library
a collection of routines for simple textual analysis
|
data structure and associated functions to work with lists of words More...
Go to the source code of this file.
Typedefs | |
typedef struct word_list * | word_list_t |
Functions | |
word_list_t | word_list_create (size_t n) |
create a new word list More... | |
void | word_list_free (word_list_t words) |
free the memory associated with a word list More... | |
int | word_list_insert (word_list_t wl, const char *word) |
insert a word into a word list More... | |
void | word_list_foreach (const word_list_t wl, void(*fp)(char *)) |
void | word_list_sort (word_list_t wl, int(*compar)(const void *, const void *)) |
sort a list of words using comparison function | |
unsigned long | word_list_count (const word_list_t wl) |
count the number of items in a word list More... | |
void | word_list_inject (const word_list_t wl, void *data, int(*fnptr)(void *, const char *)) |
data structure and associated functions to work with lists of words
typedef struct word_list* word_list_t |
object encapsulating a list of words
unsigned long word_list_count | ( | const word_list_t | wl | ) |
count the number of items in a word list
wl | the word list |
word_list_t word_list_create | ( | size_t | n | ) |
create a new word list
n | initial size of word list |
initialization performs dynamic memory allocation. It is the caller's responsibility to call word_list_free on the returned word_list_t object when it is no longer needed.
void word_list_foreach | ( | const word_list_t | wl, |
void(*)(char *) | fp | ||
) |
apply a function for each item in word list
void word_list_free | ( | word_list_t | words | ) |
free the memory associated with a word list
words | NULL terminated array of char* |
void word_list_inject | ( | const word_list_t | wl, |
void * | data, | ||
int(*)(void *, const char *) | fnptr | ||
) |
accumulate all values in wl to data
accumulate each item with data by passing each to fnptr
data | inital value |
fnptr | a pointer to the function defining the operation to perform |
int word_list_insert | ( | word_list_t | wl, |
const char * | word | ||
) |
insert a word into a word list