WNHOME
Base directory for WordNet. Unix default is /usr/local/wordnet1.7, PC default is C:\wn17.
Introduction to wordnet library functions
This section of the WordNet Reference Manual contains manual pages that describe the WordNet library functions and API.
Functions are organized into the following categories:
| Category | Manual Page | Object File |
| Database Search | wnsearch(3WN) | search.o |
| Morphology | morph(3WN) | morph.o |
| Misc. Utility | wnutil(3WN) | wnutil.o |
| Binary Search | binsrch(3WN) | binsrch.o |
The WordNet library is used by all of the searching interfaces provided with the various WordNet packages. Additional programs in the system, such as escort(1WN) and 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. gcc(1), version 2.95.2 was used to compile all of the Unix libraries. The same code was compiled on all platforms, using cpp(1) #ifdef statements to conditionally compile platform specific code. The platform specific definitions are:
| UNIX | Defined for all Unix operating systems |
| PC | Defined for all PC operating systems |
| WINDOWS | Defined for Windows platforms |
Note that when WINDOWS is defined, PC is also defined.
Not 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 wntypes.h.
findtheinfoPrimary search function for WordNet database. Returns formatted search results in text buffer. Used by WordNet interfaces to perform requested search.
findtheinfo_dsPrimary search function for WordNet database. Returns search results in linked list data structure.
is_definedSet bit for each search type that is valid for the search word passed and return bit mask.
in_wnSet bit for each syntactic category that search word is in.
index_lookupFind word in index file and return parsed entry in data structure. Input word must be exact match of string in database. Called by getindex().
getindexFind word in index file, trying different techniques - replace hyphens with underscores, replace underscores with hyphens, strip hyphens and underscores, strip periods.
read_synsetRead synset from data file at byte offset passed and return parsed entry in data structure. Calls parse_synset().
parse_synsetRead synset at current byte offset in file and return parsed entry in data structure.
free_synsFree a synset linked list allocated by findtheinfo_ds().
free_synsetFree a synset structure.
free_indexFree an index structure.
traceptrs_dsRecursive search algorithm to trace a pointer tree and return results in linked list.
do_traceDo requested search on synset passed returning formatted output in buffer.
morphinitOpen exception list files.
re_morphinitClose exception list files and reopen.
morphstrTry to find base form (lemma) of word or collocation in syntactic category passed. Calls morphword() for each word in string passed.
morphwordTry to find base form (lemma) of individual word in syntactic category passed.
wninitTop level function to open database files and morphology exception lists.
re_wninitTop level function to close and reopen database files and morphology exception lists.
cntwordsCount the number of underscore or space separated words in a string.
strtolowerConvert string to lower case and remove trailing adjective marker if found.
ToLowerCaseConvert string passed to lower case.
strsubstReplace all occurrences of from with to in str.
getptrtypeReturn code for pointer type character passed.
getposReturn syntactic category code for string passed.
getsstypeReturn synset type code for string passed.
FmtSynsetReconstruct synset string from synset pointer.
StrToPosPassed string for syntactic category, returns corresponding integer value.
GetSynsetForSenseReturn synset for sense key passed.
GetDataOffsetFind synset offset for sense.
GetPolyCountFind polysemy count for sense passed.
GetWORDReturn word part of sense key.
GetPOSReturn syntactic category code for sense key passed.
WNSnsToStrGenerate sense key for index entry passed.
GetValidIndexPointerSearch for string and/or base form of word in database and return index structure for word if found.
GetWNSenseReturn sense number in database for sense key.
GetSenseIndexReturn parsed sense index entry for sense key passed.
default_display_messageDefault function to use as value of display_message. Simply returns -1.
bin_searchGeneral purpose binary search function to search for key as first item on line in sorted file.
copyfileCopy contents from one file to another.
replace_lineReplace a line in a sorted file.
insert_lineInsert a line into a sorted file.
license.hText of WordNet license in various C data structure formats
setutil.hFunctions for creating and working with sets. Used to perform RELATIVES search.
wn.hTop level WordNet include file that includes most others. This should be sufficient for most applications. Also lists function prototypes for library API.
wnconsts.hConstants used by library functions and applications. Conditionally compiled code determines default pathnames and buffer sizes for different platforms,.
wnglobal.hExternal declarations for global variables initialized in wnglobal.c. These variables are static: they do not change while library code is run, and they do not influence how the library operates.
wnhelp.hExternal declaration for helptext initialized in wnhelp.c.
wnrtl.hExternal declarations for global variables and flags used and set by the WordNet library functions at run-time.
wntypes.hC typedefs for data structures used in library.
All 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 usually sufficient, as it includes several other WordNet header files.
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.
| Integer | Synset Type | Syntactic Category | Char | String |
| Constant | Constant | |||
| 1 | NOUN | NOUN | n | noun |
| 2 | VERB | VERB | v | verb |
| 3 | ADJ | ADJ | a | adj |
| 4 | ADV | ADV | r | adv |
| 5 | SATELLITE | ADJ | s | n/a |
WNHOME
Base directory for WordNet. Unix default is /usr/local/wordnet1.7, PC default is C:\wn17.
WNSEARCHDIR
Directory in which the WordNet database has been installed. Unix default is WNHOME/dict, PC default is WNHOME\dict.
WNHOME/lib/libwn.a
WordNet library (Unix)
WNHOME\lib\libwn.lib
WordNet library (Windows)
WNHOME\lib\libwndos.a
WordNet library (DOS)
WNHOME/include/*
header files for use with WordNet library (Unix)
WNHOME\include\*
header files for use with WordNet library (PC)
3 releases since Debian 2.1 (Slink); the text changed 1 time.