<!-- 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>MORPH(3WN) manual page</TITLE> </HEAD> <BODY> <A HREF="#toc">Table of Contents</A><P> <H2><A NAME="sect0" HREF="#toc0">NAME </A></H2> morphinit, re_morphinit, morphstr, morphword <H2><A NAME="sect1" HREF="#toc1">SYNOPSIS </A></H2> <P> <B>#include "wn.h" </B> <P> <B>int morphinit(void); </B> <P> <B>int re_morphinit(void); </B> <P> <B>char *morphstr(char *origstr, int pos); </B> <P> <B>char *morphword(char *word, int pos); </B> <H2><A NAME="sect2" HREF="#toc2">DESCRIPTION </A></H2> <P> The WordNet morphological processor, Morphy, is accessed through these functions: <P> <B>morphinit()</B> is used to open the exception list files. It returns <B>0 </B> if successful, <B>-1 </B> otherwise. The exception list files must be opened before <B>morphstr() </B> or <B>morphword()</B> are called. <P> <B>re_morphinit()</B> is used to close the exception list files and reopen them, and is used exclusively for WordNet development. Return codes are as described above. <P> <B>morphstr()</B> is the basic user interface to Morphy. It tries to find the base form (lemma) of the word or collocation <I>origstr </I> in the specified <I>pos </I>. The first call (with <I>origstr </I> specified) returns a pointer to the first base form found. Subsequent calls requesting base forms of the same string must be made with the first argument of <FONT SIZE=-1><B>NULL. </B></FONT> When no more base forms for <I>origstr </I> can be found, <FONT SIZE=-1><B>NULL </B></FONT> is returned. Note that <B>morphstr() </B> returns a pointer to a static character buffer. A subsequent call to <B>morphstr() </B> with a new string (instead of <B>NULL </B>) will overwrite the string pointed to by a previous call. Users should copy the returned string into a local buffer, or use the C library function <B>strdup </B> to duplicate the returned string into a <I>malloc'd </I> buffer. <P> <B>morphword()</B> tries to find the base form of <I>word </I> in the specified <I>pos </I>. This function is called by <B>morphstr()</B> for each individual word in a collocation. Note that <B>morphword() </B> returns a pointer to a static character buffer. A subsequent call to <B>morphword() </B> will overwrite the string pointed to by a previous call. Users should copy the returned string into a local buffer, or use the C library function <B>strdup </B> to duplicate the returned string into a <I>malloc'd </I> buffer. <H2><A NAME="sect3" HREF="#toc3">NOTES </A></H2> <B>morphinit()</B> is called by <B>wninit() </B> and is not intended to be called directly by an application. Applications wishing to use WordNet and/or the morphological functions must call <B>wninit() </B> at the start of the program. See <B><A HREF="wnutil.3WN.html">wnutil</B>(3WN)</A> for more information. <P> <I>origstr </I> may be either a word or a collocation formed by joining individual words with underscore characters (<B>_ </B>). <P> Usually only <B>morphstr() </B> is called from applications, as it works on both words and collocations. <P> <I>pos </I> must be one of the following: <P> <blockquote><B>1 </B><tt> </tt> <tt> </tt> NOUN <BR> <B>2 </B><tt> </tt> <tt> </tt> VERB <BR> <B>3 </B><tt> </tt> <tt> </tt> ADJECTIVE <BR> <B>4 </B><tt> </tt> <tt> </tt> ADVERB <BR> <B>5 </B><tt> </tt> <tt> </tt> ADJECTIVE_SATELLITE <BR> </blockquote> <P> If <FONT SIZE=-1><B>ADJECTIVE_SATELLITE </B></FONT> is passed, it is treated by <B>morphstr() </B> as <FONT SIZE=-1><B>ADJECTIVE. </B></FONT> <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="wndb.5WN.html">wndb</B>(5WN)</A> , <B><A HREF="morphy.7WN.html">morphy</B>(7WN)</A> . <P> <H2><A NAME="sect5" HREF="#toc5">WARNINGS </A></H2> Passing an invalid part of speech will result in a core dump. <P> The WordNet database files must be open to use <B>morphstr() </B> or <B>morphword(). <P> </B> <H2><A NAME="sect6" HREF="#toc6">BUGS </A></H2> Morphy will allow non-words to be converted to words, if they follow one of the rules described above. For example, it will happily convert <B>plantes </B> to <B>plants </B>. <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> <LI><A NAME="toc6" HREF="#sect6">BUGS</A></LI> </UL> </BODY></HTML>