<!-- manual page source format generated by PolyglotMan v3.0.3a12, --> <!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z --> <HTML> <HEAD> <TITLE>WNUTIL(3WN) manual page</TITLE> </HEAD> <BODY> <A HREF="#toc">Table of Contents</A><P> <H2><A NAME="sect0" HREF="#toc0">NAME </A></H2> wninit, re_wninit, cntwords, strtolower, ToLowerCase, strsubst, getptrtype, getpos, getsstype, StrToPos, GetSynsetForSense, GetDataOffset, GetPolyCount, WNSnsToStr, GetValidIndexPointer, GetWNSense, GetSenseIndex, default_display_message <H2><A NAME="sect1" HREF="#toc1">SYNOPSIS </A></H2> <P> <B>#include "wn.h" </B> <P> <B>int wninit(void); </B> <P> <B>int re_wninit(void); </B> <P> <B>int cntwords(char *str, char separator); </B> <P> <B>char *strtolower(char *str); </B> <P> <B>char *ToLowerCase(char *str); </B> <P> <B>char *strsubst(char *str, char from, char to); </B> <P> <B>int getptrtype(char *ptr_symbol); </B> <P> <B>int getpos(char *ss_type); </B> <P> <B>int getsstype(char *ss_type); </B> <P> <B>int StrToPos(char pos); </B> <P> <B>SynsetPtr GetSynsetForSense(char *sense_key); </B> <P> <B>long GetDataOffset(char *sense_key); </B> <P> <B>int GetPolyCount(char *sense_key); </B> <P> <B>char *WNSnsToStr(IndexPtr idx, int sense_num); </B> <P> <B>IndexPtr GetValidIndexPointer(char *str, int pos); </B> <P> <B>int GetWNSense(char *lemma, *lex_sense); </B> <P> <B>SnsIndexPtr GetSenseIndex(char *sense_key); </B> <P> <B>int GetTagcnt(IndexPtr idx, int sense); </B> <P> <B>int default_display_message(char *msg); </B> <H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2> <P> The WordNet library contains many utility functions used by the interface code, other library functions, and various applications and tools. Only those of importance to the WordNet search code, or which are generally useful are described here. <P> <B>wninit()</B> opens the files necessary for using WordNet with the WordNet library functions. The database files are opened, and <B>morphinit()</B> is called to open the exception list files. Returns <B>0 </B> if successful, <B>-1 </B> otherwise. The database and exception list files must be open before the WordNet search and morphology functions are used. If the database is successfully opened, the global variable <B>OpenDB </B> is set to <B>1 </B>. Note that it is possible for the database files to be opened (<B>OpenDB == 1 </B>), but not the exception list files. <P> <B>re_wninit()</B> is used to close the database files and reopen them, and is used exclusively for WordNet development. <B>re_morphinit() </B> is called to close and reopen the exception list files. Return codes are as described above. <P> <B>cntwords()</B> counts the number of underscore or space separated words in <I>str </I>. A hyphen is passed in <I>separator </I> if is is to be considered a word delimiter. Otherwise <I>separator </I> can be any other character, or an underscore if another character is not desired. <P> <B>strtolower()</B> converts <I>str </I> to lower case and removes a trailing adjective marker, if present. <I>str </I> is actually modified by this function, and a pointer to the modified string is returned. <P> <B>ToLowerCase()</B> converts <I>str </I> to lower case as above, without removing an adjective marker. <P> <B>strsubst()</B> replaces all occurrences of <I>from </I> with <I>to </I> in <I>str </I> and returns resulting string. <P> <B>getptrtype()</B> returns the integer <I>ptr_type </I> corresponding to the pointer character passed in <I>ptr_symbol </I>. See <B><A HREF="wnsearch.3WN.html">wnsearch</B>(3WN)</A> for a table of pointer symbols and types. <P> <B>getpos()</B> returns the integer constant corresponding to the synset type passed. <I>ss_type </I> may be one of the following: <B>n, v, a, r, s </B>. If <B>s </B> is passed, <FONT SIZE=-1><B>ADJ </B></FONT> is returned. Exits with <B>-1 </B> if <I>ss_type </I> is invalid. <P> <B>getsstype()</B> works like <B>getpos() </B>, but returns <FONT SIZE=-1><B>SATELLITE </B></FONT> if <I>ss_type </I> is <B>s </B>. <P> <B>StrToPos()</B> returns the integer constant corresponding to the syntactic category passed in <I>pos </I>. <I>string </I> must be one of the following: <B>noun, verb, adj, adv </B>. <B>-1 </B> is returned if <I>pos </I> is invalid. <P> <B>GetSynsetForSense()</B> returns the synset that contains the word sense <I>sense_key </I> and <FONT SIZE=-1><B>NULL </B></FONT> in case of error. <P> <B>GetDataOffset()</B> returns the synset offset for synset that contains the word sense <I>sense_key </I>, and <B>0 </B> if <I>sense_key </I> is not in sense index file. <P> <B>GetPolyCount()</B> returns the polysemy count (number of senses in WordNet) for <I>lemma </I> encoded in <I>sense_key </I> and <B>0 </B> if word is not found. <P> <B>WNSnsToStr()</B> returns sense key encoding for <I>sense_num </I> entry in <I>idx </I>. <P> <B>GetValidIndexPointer()</B> returns the Index structure for <I>word </I> in <I>pos </I>. Calls <B><A HREF="morphstr.3WN.html">morphstr</B>(3WN)</A> to find a valid base form if <I>word </I> is inflected. <P> <B>GetWNSense()</B> returns the WordNet sense number for the sense key encoding represented by <I>lemma </I> and <I>lex_sense </I>. <P> <B>GetSenseIndex()</B> returns parsed sense index entry for <I>sense_key </I> and <FONT SIZE=-1><B>NULL </B></FONT> if <I>sense_key </I> is not in sense index. <P> <B>GetTagcnt()</B> returns the number of times the sense passed has been tagged according to the <I>cntlist </I> file. <P> <B>default_display_message()</B> simply returns <B>-1 </B>. This is the default value for the global variable <B>display_message </B>, that points to a function to call to display an error message. In general, applications (including the WordNet interfaces) define an application specific function and set <B>display_message </B> to point to it. <H2><A NAME="sect3" HREF="#toc3">NOTES </A></H2> <B>include/wn.h </B> lists all the pointer and search types and their corresponding constant values. There is no description of what each search type is or the results returned. Using the WordNet interface is the best way to see what types of searches are available, and the data returned for each. <H2><A NAME="sect4" HREF="#toc4">SEE ALSO </A></H2> <B><A HREF="wnintro.3WN.html">wnintro</B>(3WN)</A> , <B><A HREF="wnsearch.3WN.html">wnsearch</B>(3WN)</A> , <B><A HREF="morph.3WN.html">morph</B>(3WN)</A> , <B><A HREF="wnintro.5WN.html">wnintro</B>(5WN)</A> , <B><A HREF="wnintro.7WN.html">wnintro</B>(7WN)</A> . <P> <H2><A NAME="sect5" HREF="#toc5">WARNINGS </A></H2> Error checking on passed arguments is not rigorous. Passing <FONT SIZE=-1><B>NULL </B></FONT> pointers or invalid values will often cause an application to die. <P> <HR><P> <A NAME="toc"><B>Table of Contents</B></A><P> <UL> <LI><A NAME="toc0" HREF="#sect0">NAME</A></LI> <LI><A NAME="toc1" HREF="#sect1">SYNOPSIS</A></LI> <LI><A NAME="toc2" HREF="#sect2">DESCRIPTION</A></LI> <LI><A NAME="toc3" HREF="#sect3">NOTES</A></LI> <LI><A NAME="toc4" HREF="#sect4">SEE ALSO</A></LI> <LI><A NAME="toc5" HREF="#sect5">WARNINGS</A></LI> </UL> </BODY></HTML>