| |
| |
| |
| |
| |
| |
| |
|
|
| #ifndef _WN_ |
| #define _WN_ |
|
|
| #include <stdio.h> |
|
|
| |
|
|
| #ifdef _WINDOWS |
| #define DICTDIR "\\dict" |
| #ifndef DEFAULTPATH |
| #define DEFAULTPATH "C:\\Program Files\\WordNet\\3.0\\dict" |
| #endif |
| #define DATAFILE "%s\\data.%s" |
| #define INDEXFILE "%s\\index.%s" |
| #define SENSEIDXFILE "%s\\index.sense" |
| #define KEYIDXFILE "%s\\index.key" |
| #define REVKEYIDXFILE "%s\\index.key.rev" |
| #define VRBSENTFILE "%s\\sents.vrb" |
| #define VRBIDXFILE "%s\\sentidx.vrb" |
| #define CNTLISTFILE "%s\\cntlist.rev" |
| #else |
| #define DICTDIR "/dict" |
| #ifndef DEFAULTPATH |
| #define DEFAULTPATH "/usr/local/WordNet-3.0/dict" |
| #endif |
| #define DATAFILE "%s/data.%s" |
| #define INDEXFILE "%s/index.%s" |
| #define SENSEIDXFILE "%s/index.sense" |
| #define KEYIDXFILE "%s/index.key" |
| #define REVKEYIDXFILE "%s/index.key.rev" |
| #define VRBSENTFILE "%s/sents.vrb" |
| #define VRBIDXFILE "%s/sentidx.vrb" |
| #define CNTLISTFILE "%s/cntlist.rev" |
| #endif |
|
|
| |
|
|
| #define SEARCHBUF ((long)(200*(long)1024)) |
| #define LINEBUF (15*1024) |
| #define SMLINEBUF (3*1024) |
| #define WORDBUF (256) |
|
|
| #define ALLSENSES 0 |
| #define MAXID 15 |
| #define MAXDEPTH 20 |
| #define MAXSENSE 75 |
| #define MAX_FORMS 5 |
| #define MAXFNUM 44 |
|
|
| |
|
|
| |
|
|
| #define ANTPTR 1 |
| #define HYPERPTR 2 |
| #define HYPOPTR 3 |
| #define ENTAILPTR 4 |
| #define SIMPTR 5 |
|
|
| #define ISMEMBERPTR 6 |
| #define ISSTUFFPTR 7 |
| #define ISPARTPTR 8 |
|
|
| #define HASMEMBERPTR 9 |
| #define HASSTUFFPTR 10 |
| #define HASPARTPTR 11 |
|
|
| #define MERONYM 12 |
| #define HOLONYM 13 |
| #define CAUSETO 14 |
| #define PPLPTR 15 |
| #define SEEALSOPTR 16 |
| #define PERTPTR 17 |
| #define ATTRIBUTE 18 |
| #define VERBGROUP 19 |
| #define DERIVATION 20 |
| #define CLASSIFICATION 21 |
| #define CLASS 22 |
|
|
| #define LASTTYPE CLASS |
|
|
| |
|
|
| #define SYNS (LASTTYPE + 1) |
| #define FREQ (LASTTYPE + 2) |
| #define FRAMES (LASTTYPE + 3) |
| #define COORDS (LASTTYPE + 4) |
| #define RELATIVES (LASTTYPE + 5) |
| #define HMERONYM (LASTTYPE + 6) |
| #define HHOLONYM (LASTTYPE + 7) |
| #define WNGREP (LASTTYPE + 8) |
| #define OVERVIEW (LASTTYPE + 9) |
|
|
| #define MAXSEARCH OVERVIEW |
|
|
| #define CLASSIF_START (MAXSEARCH + 1) |
|
|
| #define CLASSIF_CATEGORY (CLASSIF_START) |
| #define CLASSIF_USAGE (CLASSIF_START + 1) |
| #define CLASSIF_REGIONAL (CLASSIF_START + 2) |
|
|
| #define CLASSIF_END CLASSIF_REGIONAL |
|
|
| #define CLASS_START (CLASSIF_END + 1) |
|
|
| #define CLASS_CATEGORY (CLASS_START) |
| #define CLASS_USAGE (CLASS_START + 1) |
| #define CLASS_REGIONAL (CLASS_START + 2) |
|
|
| #define CLASS_END CLASS_REGIONAL |
|
|
| #define INSTANCE (CLASS_END + 1) |
| #define INSTANCES (CLASS_END + 2) |
|
|
| #define MAXPTR INSTANCES |
|
|
| |
|
|
| #define NUMPARTS 4 |
| #define NUMFRAMES 35 |
|
|
| |
|
|
| #define NOUN 1 |
| #define VERB 2 |
| #define ADJ 3 |
| #define ADV 4 |
| #define SATELLITE 5 |
| #define ADJSAT SATELLITE |
|
|
| #define ALL_POS 0 |
|
|
| #define bit(n) ((unsigned int)((unsigned int)1<<((unsigned int)n))) |
|
|
| |
|
|
| #define PADJ 1 |
| #define NPADJ 2 |
| #define IPADJ 3 |
|
|
| #define UNKNOWN_MARKER 0 |
| #define ATTRIBUTIVE NPADJ |
| #define PREDICATIVE PADJ |
| #define IMMED_POSTNOMINAL IPADJ |
|
|
| extern char *wnrelease; |
|
|
| extern char *lexfiles[]; |
| extern char *ptrtyp[]; |
| extern char *partnames[]; |
| extern char partchars[]; |
| extern char *adjclass[]; |
| extern char *frametext[]; |
|
|
| |
|
|
| |
| typedef struct { |
| long idxoffset; |
| char *wd; |
| char *pos; |
| int sense_cnt; |
| int off_cnt; |
| int tagged_cnt; |
| unsigned long *offset; |
| int ptruse_cnt; |
| int *ptruse; |
| } Index; |
|
|
| typedef Index *IndexPtr; |
|
|
| |
| typedef struct ss { |
| long hereiam; |
| int sstype; |
| int fnum; |
| char *pos; |
| int wcount; |
| char **words; |
| int *lexid; |
| int *wnsns; |
| int whichword; |
| int ptrcount; |
| int *ptrtyp; |
| long *ptroff; |
| int *ppos; |
| int *pto; |
| int *pfrm; |
| int fcount; |
| int *frmid; |
| int *frmto; |
| char *defn; |
| unsigned int key; |
|
|
| |
| |
|
|
| struct ss *nextss; |
| struct ss *nextform; |
| |
| int searchtype; |
| struct ss *ptrlist; |
| char *headword; |
| short headsense; |
| } Synset; |
|
|
| typedef Synset *SynsetPtr; |
|
|
| typedef struct si { |
| char *sensekey; |
| char *word; |
| long loc; |
| int wnsense; |
| int tag_cnt; |
| struct si *nextsi; |
| } SnsIndex; |
|
|
| typedef SnsIndex *SnsIndexPtr; |
| |
| typedef struct { |
| int SenseCount[MAX_FORMS]; |
| int OutSenseCount[MAX_FORMS]; |
| int numforms; |
| int printcnt; |
| char *searchbuf; |
| SynsetPtr searchds; |
| } SearchResults; |
|
|
| typedef SearchResults *SearchResultsPtr; |
|
|
| |
|
|
| extern SearchResults wnresults; |
| extern int fnflag; |
| extern int dflag; |
| extern int saflag; |
| extern int fileinfoflag; |
| extern int frflag; |
| extern int abortsearch; |
| extern int offsetflag; |
| extern int wnsnsflag; |
|
|
| |
|
|
| extern int OpenDB; |
| extern FILE *datafps[NUMPARTS + 1], |
| *indexfps[NUMPARTS + 1], |
| *sensefp, |
| *cntlistfp, |
| *keyindexfp, *revkeyindexfp, |
| *vidxfilefp, *vsentfilefp; |
|
|
| |
|
|
| extern void (*interface_doevents_func)(void); |
| |
| |
|
|
| |
| |
|
|
| extern int default_display_message(char *); |
| extern int (*display_message)(char *); |
|
|
|
|
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
|
|
| |
|
|
| |
|
|
| |
| extern char *findtheinfo(char *, int, int, int); |
|
|
| |
| extern SynsetPtr findtheinfo_ds(char *, int, int, int); |
|
|
| |
| |
| extern unsigned int is_defined(char *, int); |
|
|
| |
| |
| extern unsigned int in_wn(char *, int); |
|
|
| |
| |
| extern IndexPtr index_lookup(char *, int); |
|
|
| |
| |
| |
| extern IndexPtr getindex(char *, int); |
| extern IndexPtr parse_index(long, int, char *); |
|
|
| |
| |
| extern SynsetPtr read_synset(int, long, char *); |
|
|
| |
| |
| extern SynsetPtr parse_synset(FILE *, int, char *); |
|
|
| |
| extern void free_syns(SynsetPtr); |
|
|
| |
| extern void free_synset(SynsetPtr); |
|
|
| |
| extern void free_index(IndexPtr); |
|
|
| |
| |
| SynsetPtr traceptrs_ds(SynsetPtr, int, int, int); |
|
|
| |
| extern char *do_trace(SynsetPtr, int, int, int); |
|
|
| |
|
|
| |
| extern int morphinit(); |
|
|
| |
| extern int re_morphinit(); |
|
|
| |
| extern char *morphstr(char *, int); |
|
|
| |
| extern char *morphword(char *, int); |
|
|
| |
|
|
| |
| |
| extern int wninit(); |
|
|
| |
| |
| extern int re_wninit(); |
|
|
| |
| extern int cntwords(char *, char); |
|
|
| |
| extern char *strtolower(char *); |
|
|
| |
| extern char *ToLowerCase(char *); |
|
|
| |
| extern char *strsubst(char *, char, char); |
|
|
| |
| extern int getptrtype(char *); |
|
|
| |
| extern int getpos(char *); |
|
|
| |
| extern int getsstype(char *); |
|
|
| |
| extern char *FmtSynset(SynsetPtr, int); |
|
|
| |
| extern char *GetWNStr(char *, int); |
|
|
| |
| extern int StrToPos(char *); |
|
|
| |
| extern SynsetPtr GetSynsetForSense(char *); |
|
|
| |
| extern long GetDataOffset(char *); |
|
|
| |
| extern int GetPolyCount(char *); |
|
|
| |
| extern char *GetWORD(char *); |
|
|
| |
| extern int GetPOS(char *); |
|
|
| |
| extern char *WNSnsToStr(IndexPtr, int); |
|
|
| |
| |
| extern IndexPtr GetValidIndexPointer(char *, int); |
|
|
| |
| int GetWNSense(char *, char *); |
|
|
| SnsIndexPtr GetSenseIndex(char *); |
|
|
| char *GetOffsetForKey(unsigned int); |
| unsigned int GetKeyForOffset(char *); |
|
|
| char *SetSearchdir(); |
|
|
| |
| int GetTagcnt(IndexPtr, int); |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| extern void strstr_init (char *, char *); |
| extern int strstr_getnext (void); |
|
|
| |
|
|
| |
| |
| extern char *bin_search(char *, FILE *); |
| extern char *read_index(long, FILE *); |
|
|
| |
| extern void copyfile(FILE *, FILE *); |
|
|
| |
| |
| extern char *replace_line(char *, char *, FILE *); |
|
|
| |
| |
| extern char *insert_line(char *, char *, FILE *); |
|
|
| #ifdef __cplusplus |
| } |
| #endif |
|
|
| extern char **helptext[NUMPARTS + 1]; |
|
|
| static char *license = "\ |
| This software and database is being provided to you, the LICENSEE, by \n\ |
| Princeton University under the following license. By obtaining, using \n\ |
| and/or copying this software and database, you agree that you have \n\ |
| read, understood, and will comply with these terms and conditions.: \n\ |
| \n\ |
| Permission to use, copy, modify and distribute this software and \n\ |
| database and its documentation for any purpose and without fee or \n\ |
| royalty is hereby granted, provided that you agree to comply with \n\ |
| the following copyright notice and statements, including the disclaimer, \n\ |
| and that the same appear on ALL copies of the software, database and \n\ |
| documentation, including modifications that you make for internal \n\ |
| use or for distribution. \n\ |
| \n\ |
| WordNet 3.0 Copyright 2006 by Princeton University. All rights reserved. \n\ |
| \n\ |
| THIS SOFTWARE AND DATABASE IS PROVIDED \"AS IS\" AND PRINCETON \n\ |
| UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR \n\ |
| IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON \n\ |
| UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT- \n\ |
| ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE \n\ |
| OF THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT \n\ |
| INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR \n\ |
| OTHER RIGHTS. \n\ |
| \n\ |
| The name of Princeton University or Princeton may not be used in \n\ |
| advertising or publicity pertaining to distribution of the software \n\ |
| and/or database. Title to copyright in this software, database and \n\ |
| any associated documentation shall at all times remain with \n\ |
| Princeton University and LICENSEE agrees to preserve same. \n" |
| ; |
|
|
| static char dblicense[] = "\ |
| 1 This software and database is being provided to you, the LICENSEE, by \n\ |
| 2 Princeton University under the following license. By obtaining, using \n\ |
| 3 and/or copying this software and database, you agree that you have \n\ |
| 4 read, understood, and will comply with these terms and conditions.: \n\ |
| 5 \n\ |
| 6 Permission to use, copy, modify and distribute this software and \n\ |
| 7 database and its documentation for any purpose and without fee or \n\ |
| 8 royalty is hereby granted, provided that you agree to comply with \n\ |
| 9 the following copyright notice and statements, including the disclaimer, \n\ |
| 10 and that the same appear on ALL copies of the software, database and \n\ |
| 11 documentation, including modifications that you make for internal \n\ |
| 12 use or for distribution. \n\ |
| 13 \n\ |
| 14 WordNet 3.0 Copyright 2006 by Princeton University. All rights reserved. \n\ |
| 15 \n\ |
| 16 THIS SOFTWARE AND DATABASE IS PROVIDED \"AS IS\" AND PRINCETON \n\ |
| 17 UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR \n\ |
| 18 IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON \n\ |
| 19 UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT- \n\ |
| 20 ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE \n\ |
| 21 OF THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT \n\ |
| 22 INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR \n\ |
| 23 OTHER RIGHTS. \n\ |
| 24 \n\ |
| 25 The name of Princeton University or Princeton may not be used in \n\ |
| 26 advertising or publicity pertaining to distribution of the software \n\ |
| 27 and/or database. Title to copyright in this software, database and \n\ |
| 28 any associated documentation shall at all times remain with \n\ |
| 29 Princeton University and LICENSEE agrees to preserve same. \n" |
| ; |
|
|
| #define DBLICENSE_SIZE (sizeof(dblicense)) |
|
|
| #endif |
|
|