DESCRIPTIONThis section of the WordNet Reference Manual contains manual pages that describe the WordNet library functions and API.
Functions are organized into the following categories:
The WordNet library is used by all of the searching interfaces provided with the various WordNet packages. Additional programs in the system, such as grind(1WN), also use functions in this library.
The WordNet library is provided in both source and binary forms (on some platforms) to allow users to build applications and tools to their own specifications that utilize the WordNet database. We do not provide programming support or assistance.
The code conforms to ANSI C standards. Functions are defined with function prototypes. If you do not have a compiler that accepts prototypes, you must edit the source code and remove the prototypes before compiling.
LIST OF WORDNET LIBRARY FUNCTIONSNot all library functions are listed below. Missing are mainly functions that are called by documented ones, or ones that were written for specific applications or tools used during WordNet development. Data structures are defined in wn.h.
Database Searching Functions (search.o)
- Primary search function for WordNet database. Returns formatted search results in text buffer. Used by WordNet interfaces to perform requested search.
- Primary search function for WordNet database. Returns search results in linked list data structure.
- Set bit for each search type that is valid for the search word passed and return bit mask.
- Set bit for each syntactic category that search word is in.
- Find word in index file and return parsed entry in data structure. Input word must be exact match of string in database. Called by getindex().
- Find word in index file, trying different techniques - replace hyphens with underscores, replace underscores with hyphens, strip hyphens and underscores, strip periods.
- Read synset from data file at byte offset passed and return parsed entry in data structure. Calls parse_synset().
- Read synset at current byte offset in file and return parsed entry in data structure.
- Free a synset linked list allocated by findtheinfo_ds().
- Free a synset structure.
- Free an index structure.
- Recursive search algorithm to trace a pointer tree and return results in linked list.
Do requested search on synset passed returning formatted output in
Morphology Functions (morph.o)
- Open exception list files.
- Close exception list files and reopen.
- Try to find base form (lemma) of word or collocation in syntactic category passed. Calls morphword() for each word in string passed.
Try to find base form (lemma) of individual word in syntactic category
Utility Functions (wnutil.o)
- Top level function to open database files and morphology exception lists.
- Top level function to close and reopen database files and morphology exception lists.
- Count the number of underscore or space separated words in a string.
- Convert string to lower case and remove trailing adjective marker if found.
- Convert string passed to lower case.
- Replace all occurrences of from with to in str.
- Return code for pointer type character passed.
- Return syntactic category code for string passed.
- Return synset type code for string passed.
- Reconstruct synset string from synset pointer.
- Passed string for syntactic category, returns corresponding integer value.
- Return synset for sense key passed.
- Find synset offset for sense.
- Find polysemy count for sense passed.
- Return word part of sense key.
- Return syntactic category code for sense key passed.
- Generate sense key for index entry passed.
- Search for string and/or base form of word in database and return index structure for word if found.
- Return sense number in database for sense key.
- Return parsed sense index entry for sense key passed.
Default function to use as value of display_message. Simply
Binary Search Functions (binsrch.o)
- General purpose binary search function to search for key as first item on line in sorted file.
- Copy contents from one file to another.
- Replace a line in a sorted file.
- Insert a line into a sorted file.
- WordNet include file of constants, data structures, external declarations for global variables initialized in wnglobal.c. Also lists function prototypes for library API. It must be included to use any WordNet library functions.
NOTESAll library functions that access the database files expect the files to be open. The function wninit(3WN) must be called before other database access functions such as findtheinfo(3WN) or read_synset(3WN).
Inclusion of the header file wn.h is necessary.
The command line interface is a good example of a simple application that uses several WordNet library functions.
Many of the library functions are passed or return syntactic category or synset type information. The following table lists the possible categories as integer codes, synset type constant names, syntactic category constant names, single characters and character strings.
ENVIRONMENT VARIABLES (UNIX)
- Base directory for WordNet. Default is /usr/local/WordNet-3.0.
- Directory in which the WordNet database has been installed. Default is WNHOME/dict.
- Base directory for WordNet. Default is C:\Program~Files\WordNet\3.0.
- WordNet library (Unix)
- WordNet library (Windows)
- header files for use with WordNet library
BUGSPlease report bugs to [email protected].