Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

morph(3wn) [debian man page]

MORPH(3WN)						    WordNettm Library Functions 						MORPH(3WN)

NAME
morphinit, re_morphinit, morphstr, morphword - WordNet morphological processor functions SYNOPSIS
#include "wn.h" int morphinit(void); int re_morphinit(void); char *morphstr(char *origstr, int pos); char *morphword(char *word, int pos); DESCRIPTION
The WordNet morphological processor, Morphy, is accessed through these functions: morphinit() is used to open the exception list files. It returns 0 if successful, -1 otherwise. The exception list files must be opened before morphstr() or morphword( are called. re_morphinit() is used to close the exception list files and reopen them, and is used exclusively for WordNet development. Return codes are as described above. morphstr() is the basic user interface to Morphy. It tries to find the base form (lemma) of the word or collocation origstr in the speci- fied pos. The first call (with origstr 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 NULL. When no more base forms for origstr can be found, NULL is returned. Note that morphstr() returns a pointer to a static character buffer. A subsequent call to morphstr() with a new string (instead of NULL) 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 func- tion strdup to duplicate the returned string into a malloc'd buffer. morphword() tries to find the base form of word in the specified pos. This function is called by morphstr() for each individual word in a collocation. Note that morphword() returns a pointer to a static character buffer. A subsequent call to morphword() 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 strdup to duplicate the returned string into a malloc'd buffer. NOTES
morphinit() is called by wninit() and is not intended to be called directly by an application. Applications wishing to use WordNet and/or the morphological functions must call wninit() at the start of the program. See wnutil(3WN) for more information. origstr may be either a word or a collocation formed by joining individual words with underscore characters (_). Usually only morphstr() is called from applications, as it works on both words and collocations. pos must be one of the following: 1 NOUN 2 VERB 3 ADJECTIVE 4 ADVERB 5 ADJECTIVE_SATELLITE If ADJECTIVE_SATELLITE is passed, it is treated by morphstr() as ADJECTIVE. SEE ALSO
wnintro(3WN), wnsearch(3WN), wndb(5WN), morphy(7WN). WARNINGS
Passing an invalid part of speech will result in a core dump. The WordNet database files must be open to use morphstr() or morphword(). BUGS
Morphy will allow non-words to be converted to words, if they follow one of the rules described above. For example, it will happily con- vert plantes to plants. WordNet 3.0 Dec 2006 MORPH(3WN)

Check Out this Related Man Page

WNINTRO(3WN)						    WordNettm Library Functions 					      WNINTRO(3WN)

NAME
wnintro - introduction to WordNet library functions DESCRIPTION
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 sys- tem, such as 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 proto- types, you must edit the source code and remove the prototypes before compiling. LIST OF WORDNET LIBRARY FUNCTIONS
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 wn.h. Database Searching Functions (search.o) findtheinfo Primary search function for WordNet database. Returns formatted search results in text buffer. Used by WordNet interfaces to perform requested search. findtheinfo_ds Primary search function for WordNet database. Returns search results in linked list data structure. is_defined Set bit for each search type that is valid for the search word passed and return bit mask. in_wn Set bit for each syntactic category that search word is in. index_lookup Find word in index file and return parsed entry in data structure. Input word must be exact match of string in database. Called by getindex(). getindex Find word in index file, trying different techniques - replace hyphens with underscores, replace underscores with hyphens, strip hyphens and underscores, strip periods. read_synset Read synset from data file at byte offset passed and return parsed entry in data structure. Calls parse_synset(). parse_synset Read synset at current byte offset in file and return parsed entry in data structure. free_syns Free a synset linked list allocated by findtheinfo_ds(). free_synset Free a synset structure. free_index Free an index structure. traceptrs_ds Recursive search algorithm to trace a pointer tree and return results in linked list. do_trace Do requested search on synset passed returning formatted output in buffer. Morphology Functions (morph.o) morphinit Open exception list files. re_morphinit Close exception list files and reopen. morphstr Try to find base form (lemma) of word or collocation in syntactic category passed. Calls morphword() for each word in string passed. morphword Try to find base form (lemma) of individual word in syntactic category passed. Utility Functions (wnutil.o) wninit Top level function to open database files and morphology exception lists. re_wninit Top level function to close and reopen database files and morphology exception lists. cntwords Count the number of underscore or space separated words in a string. strtolower Convert string to lower case and remove trailing adjective marker if found. ToLowerCase Convert string passed to lower case. strsubst Replace all occurrences of from with to in str. getptrtype Return code for pointer type character passed. getpos Return syntactic category code for string passed. getsstype Return synset type code for string passed. FmtSynset Reconstruct synset string from synset pointer. StrToPos Passed string for syntactic category, returns corresponding integer value. GetSynsetForSense Return synset for sense key passed. GetDataOffset Find synset offset for sense. GetPolyCount Find polysemy count for sense passed. GetWORD Return word part of sense key. GetPOS Return syntactic category code for sense key passed. WNSnsToStr Generate sense key for index entry passed. GetValidIndexPointer Search for string and/or base form of word in database and return index structure for word if found. GetWNSense Return sense number in database for sense key. GetSenseIndex Return parsed sense index entry for sense key passed. default_display_message Default function to use as value of display_message. Simply returns -1. Binary Search Functions (binsrch.o) bin_search General purpose binary search function to search for key as first item on line in sorted file. copyfile Copy contents from one file to another. replace_line Replace a line in a sorted file. insert_line Insert a line into a sorted file. HEADER FILE
wn.h WordNet include file of constants, data structures, external declarations for global variables initialized in wnglobal.c. Also lists function prototypes for library API. It must be included to use any WordNet library functions. NOTES
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 necessary. 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 | +--------+-------------+--------------------+------+---------+ | 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 | +--------+-------------+--------------------+------+---------+ ENVIRONMENT VARIABLES (UNIX) WNHOME Base directory for WordNet. Default is /usr/local/WordNet-3.0. WNSEARCHDIR Directory in which the WordNet database has been installed. Default is WNHOME/dict. REGISTRY (WINDOWS) HKEY_LOCAL_MACHINESOFTWAREWordNet3.0WNHome Base directory for WordNet. Default is C:Program FilesWordNet3.0. FILES
lib/libwn.a WordNet library (Unix) libwn.lib WordNet library (Windows) include header files for use with WordNet library SEE ALSO
wnintro(1WN), binsrch(3WN), morph(3WN), wnsearch(3WN), wnutil(3WN), wnintro(5WN), wnintro(7WN). Fellbaum, C.(1998), ed. "WordNet: An Electronic Lexical Database". MIT Press, Cambridge, MA. BUGS
Please report bugs to wordnet@princeton.edu. WordNet 3.0 Dec 2006 WNINTRO(3WN)
Man Page