1WNINTRO(3)                WordNet™ Library Functions                WNINTRO(3)
2
3
4

NAME

6       wnintro - introduction to WordNet library functions
7

DESCRIPTION

9       This section of the WordNet Reference Manual contains manual pages that
10       describe the WordNet library functions and API.
11
12       Functions are organized into the following categories:
13
14
15                   ┌────────────────┬──────────────┬─────────────┐
16Category        Manual Page  Object File 
17                   ├────────────────┼──────────────┼─────────────┤
18                   │Database Search │ wnsearch (3) │ search.o    │
19                   │Morphology      │ morph (3)    │ morph.o     │
20                   │Misc. Utility   │ wnutil (3)   │ wnutil.o    │
21                   │Binary Search   │ binsrch (3)  │ binsrch.o   │
22                   └────────────────┴──────────────┴─────────────┘
23       The WordNet library is used by all of the searching interfaces provided
24       with  the various WordNet packages.  Additional programs in the system,
25       such as grind(1), also use functions in this library.
26
27       The WordNet library is provided in both source  and  binary  forms  (on
28       some platforms) to allow users to build applications and tools to their
29       own specifications that utilize the WordNet database.  We do  not  pro‐
30       vide programming support or assistance.
31
32       The  code  conforms  to  ANSI  C standards.  Functions are defined with
33       function prototypes.  If you do not have a compiler that accepts proto‐
34       types,  you  must edit the source code and remove the prototypes before
35       compiling.
36

LIST OF WORDNET LIBRARY FUNCTIONS

38       Not all library functions are listed below. Missing  are  mainly  func‐
39       tions that are called by documented ones, or ones that were written for
40       specific applications or tools used during WordNet  development.   Data
41       structures are defined in wn.h.
42
43
44   Database Searching Functions (search.o)
45       findtheinfo              Primary  search function for WordNet database.
46                                Returns formatted search results in text  buf‐
47                                fer.   Used  by  WordNet interfaces to perform
48                                requested search.
49
50       findtheinfo_ds           Primary search function for WordNet  database.
51                                Returns  search  results  in  linked list data
52                                structure.
53
54       is_defined               Set bit for each search type that is valid for
55                                the search word passed and return bit mask.
56
57       in_wn                    Set  bit  for  each  syntactic  category  that
58                                search word is in.
59
60       index_lookup             Find word in  index  file  and  return  parsed
61                                entry  in  data structure.  Input word must be
62                                exact match of string in database.  Called  by
63                                getindex().
64
65       getindex                 Find  word  in  index  file,  trying different
66                                techniques - replace hyphens with underscores,
67                                replace   underscores   with   hyphens,  strip
68                                hyphens and underscores, strip periods.
69
70       read_synset              Read synset from  data  file  at  byte  offset
71                                passed  and return parsed entry in data struc‐
72                                ture.  Calls parse_synset().
73
74       parse_synset             Read synset at current byte offset in file and
75                                return parsed entry in data structure.
76
77       free_syns                Free  a  synset linked list allocated by find‐
78                                theinfo_ds().
79
80       free_synset              Free a synset structure.
81
82       free_index               Free an index structure.
83
84       traceptrs_ds             Recursive search algorithm to trace a  pointer
85                                tree and return results in linked list.
86
87       do_trace                 Do requested search on synset passed returning
88                                formatted output in buffer.
89
90
91   Morphology Functions (morph.o)
92       morphinit                Open exception list files.
93
94       re_morphinit             Close exception list files and reopen.
95
96       morphstr                 Try to find base form (lemma) of word or  col‐
97                                location  in syntactic category passed.  Calls
98                                morphword() for each word in string passed.
99
100       morphword                Try to find base form  (lemma)  of  individual
101                                word in syntactic category passed.
102
103
104   Utility Functions (wnutil.o)
105       wninit                   Top  level function to open database files and
106                                morphology exception lists.
107
108       re_wninit                Top level function to close and  reopen  data‐
109                                base files and morphology exception lists.
110
111       cntwords                 Count  the number of underscore or space sepa‐
112                                rated words in a string.
113
114       strtolower               Convert string to lower case and remove trail‐
115                                ing adjective marker if found.
116
117       ToLowerCase              Convert string passed to lower case.
118
119       strsubst                 Replace  all  occurrences  of  from with to in
120                                str.
121
122       getptrtype               Return code for pointer type character passed.
123
124       getpos                   Return  syntactic  category  code  for  string
125                                passed.
126
127       getsstype                Return synset type code for string passed.
128
129       FmtSynset                Reconstruct synset string from synset pointer.
130
131       StrToPos                 Passed  string for syntactic category, returns
132                                corresponding integer value.
133
134       GetSynsetForSense        Return synset for sense key passed.
135
136       GetDataOffset            Find synset offset for sense.
137
138       GetPolyCount             Find polysemy count for sense passed.
139
140       GetWORD                  Return word part of sense key.
141
142       GetPOS                   Return syntactic category code for  sense  key
143                                passed.
144
145       WNSnsToStr               Generate sense key for index entry passed.
146
147       GetValidIndexPointer     Search  for string and/or base form of word in
148                                database and return index structure  for  word
149                                if found.
150
151       GetWNSense               Return sense number in database for sense key.
152
153       GetSenseIndex            Return  parsed sense index entry for sense key
154                                passed.
155
156       default_display_message  Default function  to  use  as  value  of  dis‐
157                                play_message.  Simply returns -1.
158
159
160   Binary Search Functions (binsrch.o)
161       bin_search               General  purpose  binary  search  function  to
162                                search for key as first item on line in sorted
163                                file.
164
165       copyfile                 Copy contents from one file to another.
166
167       replace_line             Replace a line in a sorted file.
168
169       insert_line              Insert a line into a sorted file.
170

HEADER FILE

172       wn.h                WordNet include file of constants, data structures,
173                           external declarations for global variables initial‐
174                           ized in wnglobal.c.  Also lists function prototypes
175                           for library API. It must be  included  to  use  any
176                           WordNet library functions.
177

NOTES

179       All  library  functions that access the database files expect the files
180       to be open.  The function wninit(3) must be called before  other  data‐
181       base access functions such as findtheinfo(3) or read_synset(3).
182
183       Inclusion of the header file wn.h is necessary.
184
185       The  command  line  interface is a good example of a simple application
186       that uses several WordNet library functions.
187
188       Many of the library functions are passed or return  syntactic  category
189       or  synset  type  information.   The following table lists the possible
190       categories as integer codes, synset type constant names, syntactic cat‐
191       egory constant names, single characters and character strings.
192
193
194            ┌────────┬─────────────┬────────────────────┬──────┬─────────┐
195Integer Synset Type Syntactic Category Char String  
196            ├────────┼─────────────┼────────────────────┼──────┼─────────┤
197            │   1    │ NOUN        │ NOUN               │  n   │ noun    │
198            │   2    │ VERB        │ VERB               │  v   │ verb    │
199            │   3    │ ADJ         │ ADJ                │  a   │ adj     │
200            │   4    │ ADV         │ ADV                │  r   │ adv     │
201            │   5    │ SATELLITE   │ ADJ                │  s   │ n/a
202            └────────┴─────────────┴────────────────────┴──────┴─────────┘

ENVIRONMENT VARIABLES (UNIX)

204       WNHOME              Base    directory    for   WordNet.    Default   is
205                           /usr/local/WordNet-3.0.
206
207       WNSEARCHDIR         Directory in which the WordNet  database  has  been
208                           installed.  Default is WNHOME/dict.
209

REGISTRY (WINDOWS)

211       HKEY_LOCAL_MACHINE\SOFTWARE\WordNet\3.0\WNHome
212                           Base  directory  for  WordNet.   Default is C:\Pro‐
213                           gram Files\WordNet\3.0.
214

FILES

216       lib/libwn.a                   WordNet library (Unix)
217
218       lib\wn.lib                    WordNet library (Windows)
219
220       include                       header files for use with WordNet library
221

SEE ALSO

223       wnintro(1), binsrch(3), morph(3), wnsearch(3),  wnutil(3),  wnintro(5),
224       wnintro(7).
225
226       Fellbaum,  C.  (1998),  ed.  "WordNet: An Electronic Lexical Database".
227       MIT Press, Cambridge, MA.
228

BUGS

230       Please report bugs to wordnet@princeton.edu.
231
232
233
234WordNet 3.0                        Dec 2006                         WNINTRO(3)
Impressum