1MORPH(3) WordNet™ Library Functions MORPH(3)
2
3
4
6 morphinit, re_morphinit, morphstr, morphword - WordNet morphological
7 processor functions
8
10 #include "wn.h"
11
12 int morphinit(void);
13
14 int re_morphinit(void);
15
16 char *morphstr(char *origstr, int pos);
17
18 char *morphword(char *word, int pos);
19
21 The WordNet morphological processor, Morphy, is accessed through these
22 functions:
23
24 morphinit() is used to open the exception list files. It returns 0 if
25 successful, -1 otherwise. The exception list files must be opened
26 before morphstr() or morphword( are called.
27
28 re_morphinit() is used to close the exception list files and reopen
29 them, and is used exclusively for WordNet development. Return codes
30 are as described above.
31
32 morphstr() is the basic user interface to Morphy. It tries to find the
33 base form (lemma) of the word or collocation origstr in the specified
34 pos. The first call (with origstr specified) returns a pointer to the
35 first base form found. Subsequent calls requesting base forms of the
36 same string must be made with the first argument of NULL. When no more
37 base forms for origstr can be found, NULL is returned. Note that
38 morphstr() returns a pointer to a static character buffer. A subse‐
39 quent call to morphstr() with a new string (instead of NULL) will over‐
40 write the string pointed to by a previous call. Users should copy the
41 returned string into a local buffer, or use the C library function
42 strdup to duplicate the returned string into a malloc'd buffer.
43
44 morphword() tries to find the base form of word in the specified pos.
45 This function is called by morphstr() for each individual word in a
46 collocation. Note that morphword() returns a pointer to a static char‐
47 acter buffer. A subsequent call to morphword() will overwrite the
48 string pointed to by a previous call. Users should copy the returned
49 string into a local buffer, or use the C library function strdup to
50 duplicate the returned string into a malloc'd buffer.
51
53 morphinit() is called by wninit() and is not intended to be called
54 directly by an application. Applications wishing to use WordNet and/or
55 the morphological functions must call wninit() at the start of the pro‐
56 gram. See wnutil(3) for more information.
57
58 origstr may be either a word or a collocation formed by joining indi‐
59 vidual words with underscore characters (_).
60
61 Usually only morphstr() is called from applications, as it works on
62 both words and collocations.
63
64 pos must be one of the following:
65
66 1 NOUN
67 2 VERB
68 3 ADJECTIVE
69 4 ADVERB
70 5 ADJECTIVE_SATELLITE
71
72 If ADJECTIVE_SATELLITE is passed, it is treated by morphstr() as ADJEC‐
73 TIVE.
74
76 wnintro(3), wnsearch(3), wndb(5), morphy(7).
77
78
80 Passing an invalid part of speech will result in a core dump.
81
82 The WordNet database files must be open to use morphstr() or mor‐
83 phword().
84
85
87 Morphy will allow non-words to be converted to words, if they follow
88 one of the rules described above. For example, it will happily convert
89 plantes to plants.
90
91
92
93WordNet 3.0 Dec 2006 MORPH(3)