Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

binsrch(3wn) [debian man page]

BINSRCH(3WN)						    WordNettm Library Functions 					      BINSRCH(3WN)

NAME
bin_search, copyfile, replace_line, insert_line - general purpose functions for performing a binary search SYNOPSIS
char *bin_search(char *key, FILE *fp); void copyfile(FILE *fromfp, FILE *tofp); char *replace_line(char *new_line, char *key, FILE *fp); char *insert_line(char *new_line, char *key, FILE *fp); DESCRIPTION
The WordNet library contains several general purpose functions for performing a binary search and modifying sorted files. bin_search() is the primary binary search algorithm to search for key as the first item on a line in the file pointed to by fp. The delim- iter between the key and the rest of the fields on the line, if any, must be a space. A pointer to a static variable containing the entire line is returned. NULL is returned if a match is not found. The remaining functions are not used by WordNet, and are only briefly described. copyfile() copies the contents of one file to another. replace_line() replaces a line in a file having searchkey key with the contents of new_line. It returns the original line or NULL in case of error. insert_line() finds the proper place to insert the contents of new_line, having searchkey key in the sorted file pointed to by fp. It returns NULL if a line with this searchkey is already in the file. NOTES
The maximum length of key is 1024. The maximum line length in a file is 25K. If there are no additional fields after the search key, the key must be followed by at least one space before the newline character. SEE ALSO
wnintro(3WN), morph(3WN), wnsearch(3WN), wnutil(3WN), wnintro(5WN). WARNINGS
binsearch() returns a pointer to a static character buffer. The returned string should be copied by the caller if the results need to be saved, as a subsequent call will replace the contents of the static buffer. WordNet 3.0 Dec 2006 BINSRCH(3WN)

Check Out this Related Man Page

MORPH(3WN)						    WordNettm Library Functions 						MORPH(3WN)

NAME
morphinit, re_morphinit, morphstr, morphword - WordNet morphological processor functions SYNOPSIS
#include "wn.h" int morphinit(void); int re_morphinit(void); char *morphstr(char *origstr, int pos); char *morphword(char *word, int pos); DESCRIPTION
The WordNet morphological processor, Morphy, is accessed through these functions: morphinit() is used to open the exception list files. It returns 0 if successful, -1 otherwise. The exception list files must be opened before morphstr() or morphword( are called. re_morphinit() is used to close the exception list files and reopen them, and is used exclusively for WordNet development. Return codes are as described above. morphstr() is the basic user interface to Morphy. It tries to find the base form (lemma) of the word or collocation origstr in the speci- fied pos. The first call (with origstr specified) returns a pointer to the first base form found. Subsequent calls requesting base forms of the same string must be made with the first argument of NULL. When no more base forms for origstr can be found, NULL is returned. Note that morphstr() returns a pointer to a static character buffer. A subsequent call to morphstr() with a new string (instead of NULL) will overwrite the string pointed to by a previous call. Users should copy the returned string into a local buffer, or use the C library func- tion strdup to duplicate the returned string into a malloc'd buffer. morphword() tries to find the base form of word in the specified pos. This function is called by morphstr() for each individual word in a collocation. Note that morphword() returns a pointer to a static character buffer. A subsequent call to morphword() will overwrite the string pointed to by a previous call. Users should copy the returned string into a local buffer, or use the C library function strdup to duplicate the returned string into a malloc'd buffer. NOTES
morphinit() is called by wninit() and is not intended to be called directly by an application. Applications wishing to use WordNet and/or the morphological functions must call wninit() at the start of the program. See wnutil(3WN) for more information. origstr may be either a word or a collocation formed by joining individual words with underscore characters (_). Usually only morphstr() is called from applications, as it works on both words and collocations. pos must be one of the following: 1 NOUN 2 VERB 3 ADJECTIVE 4 ADVERB 5 ADJECTIVE_SATELLITE If ADJECTIVE_SATELLITE is passed, it is treated by morphstr() as ADJECTIVE. SEE ALSO
wnintro(3WN), wnsearch(3WN), wndb(5WN), morphy(7WN). WARNINGS
Passing an invalid part of speech will result in a core dump. The WordNet database files must be open to use morphstr() or morphword(). BUGS
Morphy will allow non-words to be converted to words, if they follow one of the rules described above. For example, it will happily con- vert plantes to plants. WordNet 3.0 Dec 2006 MORPH(3WN)
Man Page