WNINTRO(3)
π wnintro β bestie's guide to the WordNetβ’ library functions π
okay so. welcome to WNINTRO(3), the little intro page that holds the whole WordNet Reference Manual section together. if you're here it's because you wanna use the WordNet library functions and API, and honestly? valid. let's get into it. π¦
β¨ DESCRIPTION β¨
this whole section of the WordNet Reference Manual is where the manual pages live that describe the WordNet library functions and the API. like, the whole squad.
the functions are organized into these categories, and yes i'm giving you the whole rundown because every single one matters:
- Database Search β manual page
wnsearch (3)β object filesearch.o - Morphology β manual page
morph (3)β object filemorph.o - Misc. Utility β manual page
wnutil (3)β object filewnutil.o - Binary Search β manual page
binsrch (3)β object filebinsrch.o
the WordNet library is what all the searching interfaces in the various WordNet packages use. and it's not just them β other programs in the system, like grind(1), also use functions from this library. they're all in the group chat. π«Ά
the library ships in both source and binary forms (binary only on some platforms, no cap) so you can build your own applications and tools to your own specs using the WordNet database. that said β and i need you to hear this β we do not provide programming support or assistance. you're the main character of your own build, bestie. π
the code conforms to ANSI C standards. functions are defined with function prototypes. if your compiler does not accept prototypes, you must edit the source code and remove the prototypes before compiling. annoying? yes. do it anyway.
π LIST OF WORDNET LIBRARY FUNCTIONS π
heads up: not all library functions are listed below. the ones missing are mainly functions that get called by the documented ones, or ones that were written for specific applications or tools used during WordNet development. data structures are defined in wn.h. iykyk. π
π Database Searching Functions (search.o)
findtheinfoβ the primary search function for the WordNet database. returns formatted search results in a text buffer. this is what the WordNet interfaces use to perform a requested search.findtheinfo_dsβ also a primary search function for the WordNet database, but this one returns search results in a linked list data structure.is_definedβ sets a bit for each search type that is valid for the search word you passed in, and returns the bit mask.in_wnβ sets a bit for each syntactic category that the search word is in.index_lookupβ finds a word in the index file and returns the parsed entry in a data structure. the input word must be an exact match of a string in the database. called bygetindex().getindexβ finds a word in the index file, trying different techniques: replace hyphens with underscores, replace underscores with hyphens, strip hyphens and underscores, strip periods. she's resourceful. πread_synsetβ reads a synset from the data file at the byte offset you passed and returns the parsed entry in a data structure. callsparse_synset().parse_synsetβ reads the synset at the current byte offset in the file and returns the parsed entry in a data structure.free_synsβ frees a synset linked list allocated byfindtheinfo_ds().free_synsetβ frees a synset structure.free_indexβ frees an index structure.traceptrs_dsβ recursive search algorithm that traces a pointer tree and returns results in a linked list.do_traceβ does the requested search on the synset you passed, returning formatted output in a buffer.
πΈ Morphology Functions (morph.o)
morphinitβ opens the exception list files.re_morphinitβ closes the exception list files and reopens them.morphstrβ tries to find the base form (lemma) of a word or collocation in the syntactic category you passed. callsmorphword()for each word in the string you passed.morphwordβ tries to find the base form (lemma) of an individual word in the syntactic category you passed.
π§° Utility Functions (wnutil.o)
wninitβ top level function to open the database files and the morphology exception lists.re_wninitβ top level function to close and reopen the database files and the morphology exception lists.cntwordsβ counts the number of underscore- or space-separated words in a string.strtolowerβ converts a string to lower case and removes the trailing adjective marker if one is found.ToLowerCaseβ converts the string you passed to lower case.strsubstβ replaces all occurrences of from with to in str.getptrtypeβ returns the code for the pointer type character you passed.getposβ returns the syntactic category code for the string you passed.getsstypeβ returns the synset type code for the string you passed.FmtSynsetβ reconstructs a synset string from a synset pointer.StrToPosβ pass in a string for a syntactic category, get back the corresponding integer value.GetSynsetForSenseβ returns the synset for the sense key you passed.GetDataOffsetβ finds the synset offset for a sense.GetPolyCountβ finds the polysemy count for the sense you passed.GetWORDβ returns the word part of a sense key.GetPOSβ returns the syntactic category code for the sense key you passed.WNSnsToStrβ generates a sense key for the index entry you passed.GetValidIndexPointerβ searches for the string and/or base form of a word in the database and returns the index structure for that word if it's found.GetWNSenseβ returns the sense number in the database for a sense key.GetSenseIndexβ returns the parsed sense index entry for the sense key you passed.default_display_messageβ the default function to use as the value ofdisplay_message. simply returns-1. she's low maintenance, iconic.
β Binary Search Functions (binsrch.o)
bin_searchβ general purpose binary search function, searching for a key as the first item on a line in a sorted file.copyfileβ copies contents from one file to another.replace_lineβ replaces a line in a sorted file.insert_lineβ inserts a line into a sorted file.
π HEADER FILE π
wn.hβ the WordNet include file of constants, data structures, and external declarations for global variables initialized inwnglobal.c. it also lists the function prototypes for the library API. it must be included to use any WordNet library functions. non-negotiable, bestie.
π¨ NOTES π¨
all library functions that access the database files expect the files to be open. the function wninit(3) must be called before other database access functions such as findtheinfo(3) or read_synset(3). no skipping steps. π
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. study her, she ate. π
a lot of the library functions are passed or return syntactic category or synset type information, so here's the full chart of possible categories β as integer codes, synset type constant names, syntactic category constant names, single characters, and character strings:
- Integer
1, Synset TypeNOUN, Syntactic CategoryNOUN, Charn, Stringnoun - Integer
2, Synset TypeVERB, Syntactic CategoryVERB, Charv, Stringverb - Integer
3, Synset TypeADJ, Syntactic CategoryADJ, Chara, Stringadj - Integer
4, Synset TypeADV, Syntactic CategoryADV, Charr, Stringadv - Integer
5, Synset TypeSATELLITE, Syntactic CategoryADJ, Chars, Stringn/a
π ENVIRONMENT VARIABLES (UNIX) π
WNHOMEβ base directory for WordNet. default is/usr/local/WordNet-3.0.WNSEARCHDIRβ the directory in which the WordNet database has been installed. default isWNHOME/dict.
πͺ REGISTRY (WINDOWS) πͺ
HKEY_LOCAL_MACHINE\SOFTWARE\WordNet\3.0\WNHomeβ base directory for WordNet. default isC:\Program Files\WordNet\3.0.
ποΈ FILES ποΈ
lib/libwn.aβ WordNet library (Unix)lib\wn.libβ WordNet library (Windows)includeβ header files for use with the WordNet library
π SEE ALSO π
wnintro(1), binsrch(3), morph(3), wnsearch(3), wnutil(3), wnintro(5), wnintro(7).
also, the academic icon herself: Fellbaum, C. (1998), ed. "WordNet: An Electronic Lexical Database". MIT Press, Cambridge, MA. πβ¨
π BUGS π
please report bugs to wordnet@princeton.edu. they wanna hear from you, fr fr.
and that's the whole page, bestie π this was WordNet 3.0, dated Dec 2006 β written back when your parents were still figuring out MySpace, and still absolutely serving. slay, stay curious, and don't forget to call wninit(3) before you touch anything. periodt. π
π
π¦ where this page comes from
- fedora 43: wordnet-devel 3.0-48.fc42 Β· MIT and GPL-2.0-or-later
- fedora 43: wordnet-devel 3.0-48.fc42 Β· MIT and GPL-2.0-or-later
- fedora 44: wordnet-devel 3.0-48.fc42 Β· MIT and GPL-2.0-or-later
- fedora 44: wordnet-devel 3.0-48.fc42 Β· MIT and GPL-2.0-or-later
- opensuse-leap 16.0: wordnet-devel 3.0-bp160.1.11 Β· MIT
- opensuse-leap 16.0: wordnet-devel 3.0-bp160.1.11 Β· MIT
- opensuse-leap 16.0: wordnet-devel 3.0-bp160.1.11 Β· MIT
- opensuse-leap 16.0: wordnet-devel 3.0-bp160.1.11 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms