WNINTRO(3)

πŸ“¦
version 3.0 Β· 2 versions
, in fedora 43, fedora 44, opensuse-leap 16.0

πŸ’– 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 file search.o
  • Morphology β€” manual page morph (3) β€” object file morph.o
  • Misc. Utility β€” manual page wnutil (3) β€” object file wnutil.o
  • Binary Search β€” manual page binsrch (3) β€” object file binsrch.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 by getindex().
  • 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. calls parse_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 by findtheinfo_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. calls morphword() 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 of display_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 in wnglobal.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 Type NOUN, Syntactic Category NOUN, Char n, String noun
  • Integer 2, Synset Type VERB, Syntactic Category VERB, Char v, String verb
  • Integer 3, Synset Type ADJ, Syntactic Category ADJ, Char a, String adj
  • Integer 4, Synset Type ADV, Syntactic Category ADV, Char r, String adv
  • Integer 5, Synset Type SATELLITE, Syntactic Category ADJ, Char s, String n/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 is WNHOME/dict.

πŸͺŸ REGISTRY (WINDOWS) πŸͺŸ

  • HKEY_LOCAL_MACHINE\SOFTWARE\WordNet\3.0\WNHome β€” base directory for WordNet. default is C:\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