⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wn.h

📁 一个与传统电子字典不同的字典
💻 H
📖 第 1 页 / 共 2 页
字号:
/*      wn.h - header file needed to use WordNet Run Time Library   $Id: wn.h,v 1.60 2005/03/02 16:36:39 wn Exp $*/#ifdef HAVE_CONFIG_H#include "config.h"#endif#ifndef _WN_#define _WN_#include <stdio.h>/* Platform specific path and filename specifications */#ifdef _WINDOWS#define DICTDIR         "\\dict"#define DEFAULTPATH	"C:\\Program Files\\WordNet\\2.1\\dict"#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"#define DEFAULTPATH	"/usr/local/WordNet-2.1/dict"#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/* Various buffer sizes */#define SEARCHBUF	((long)(200*(long)1024))#define LINEBUF		(15*1024) /* 15K buffer to read index & data files */#define SMLINEBUF	(3*1024) /* small buffer for output lines */#define WORDBUF		(256)	/* buffer for one word or collocation */#define ALLSENSES	0	/* pass to findtheinfo() if want all senses */#define MAXID		15	/* maximum id number in lexicographer file */#define MAXDEPTH	20	/* maximum tree depth - used to find cycles */#define MAXSENSE	75	/* maximum number of senses in database */#define MAX_FORMS	5	/* max # of different 'forms' word can have */#define MAXFNUM		44	/* maximum number of lexicographer files *//* Pointer type and search type counts *//* Pointers */#define ANTPTR           1	/* ! */#define HYPERPTR         2	/* @ */#define HYPOPTR          3	/* ~ */#define ENTAILPTR        4	/* * */#define SIMPTR           5	/* & */#define ISMEMBERPTR      6	/* #m */#define ISSTUFFPTR       7	/* #s */#define ISPARTPTR        8	/* #p */#define HASMEMBERPTR     9	/* %m */#define HASSTUFFPTR     10	/* %s */#define HASPARTPTR      11	/* %p */#define MERONYM         12	/* % (not valid in lexicographer file) */#define HOLONYM         13	/* # (not valid in lexicographer file) */#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/* Misc searches */#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)        /* ;c */#define CLASSIF_USAGE    (CLASSIF_START + 1)    /* ;u */#define CLASSIF_REGIONAL (CLASSIF_START + 2)    /* ;r */#define CLASSIF_END      CLASSIF_REGIONAL#define CLASS_START      (CLASSIF_END + 1)#define CLASS_CATEGORY   (CLASS_START)          /* -c */#define CLASS_USAGE      (CLASS_START + 1)      /* -u */#define CLASS_REGIONAL   (CLASS_START + 2)      /* -r */#define CLASS_END        CLASS_REGIONAL#define INSTANCE         (CLASS_END + 1)        /* @i */#define INSTANCES        (CLASS_END + 2)        /* ~i */#define MAXPTR          INSTANCES/* WordNet part of speech stuff */#define NUMPARTS	4	/* number of parts of speech */#define NUMFRAMES	35	/* number of verb frames *//* Generic names for part of speech */#define NOUN		1#define VERB		2#define ADJ		3#define ADV		4#define SATELLITE	5	/* not really a part of speech */#define ADJSAT		SATELLITE#define ALL_POS		0	/* passed to in_wn() to check all POS */#define bit(n) ((unsigned int)((unsigned int)1<<((unsigned int)n)))/* Adjective markers */#define PADJ		1	/* (p) */#define NPADJ		2	/* (a) */#define IPADJ		3	/* (ip) */#define UNKNOWN_MARKER		0#define ATTRIBUTIVE		NPADJ#define PREDICATIVE		PADJ#define IMMED_POSTNOMINAL	IPADJextern char *wnrelease;		/* WordNet release/version number */extern char *lexfiles[];	/* names of lexicographer files */extern char *ptrtyp[];		/* pointer characters */extern char *partnames[];	/* POS strings */extern char partchars[];	/* single chars for each POS */extern char *adjclass[];	/* adjective class strings */extern char *frametext[];	/* text of verb frames *//* Data structures used by search code functions. *//* Structure for index file entry */typedef struct {    long idxoffset;		/* byte offset of entry in index file */    char *wd;			/* word string */    char *pos;			/* part of speech */    int sense_cnt;		/* sense (collins) count */    int off_cnt;		/* number of offsets */    int tagged_cnt;		/* number senses that are tagged */    unsigned long *offset;	/* offsets of synsets containing word */    int ptruse_cnt;		/* number of pointers used */    int *ptruse;		/* pointers used */} Index;typedef Index *IndexPtr;/* Structure for data file synset */typedef struct ss {    long hereiam;		/* current file position */    int sstype;			/* type of ADJ synset */    int fnum;			/* file number that synset comes from */    char *pos;			/* part of speech */    int wcount;			/* number of words in synset */    char **words;		/* words in synset */    int *lexid;			/* unique id in lexicographer file */    int *wnsns;			/* sense number in wordnet */    int whichword;		/* which word in synset we're looking for */    int ptrcount;		/* number of pointers */    int *ptrtyp;		/* pointer types */    long *ptroff;		/* pointer offsets */    int *ppos;			/* pointer part of speech */    int *pto;			/* pointer 'to' fields */    int *pfrm;			/* pointer 'from' fields */    int fcount;			/* number of verb frames */    int *frmid;			/* frame numbers */    int *frmto;			/* frame 'to' fields */    char *defn;			/* synset gloss (definition) */    unsigned int key;		/* unique synset key */    /* these fields are used if a data structure is returned       instead of a text buffer */    struct ss *nextss;		/* ptr to next synset containing searchword */    struct ss *nextform;	/* ptr to list of synsets for alternate				   spelling of wordform */    int searchtype;		/* type of search performed */    struct ss *ptrlist;		/* ptr to synset list result of search */    char *headword;		/* if pos is "s", this is cluster head word */    short headsense;		/* sense number of headword */} Synset;typedef Synset *SynsetPtr;typedef struct si {    char *sensekey;		/* sense key */    char *word;			/* word string */    long loc;			/* synset offset */    int wnsense;		/* WordNet sense number */    int tag_cnt;		/* number of semantic tags to sense */    struct si *nextsi;		/* ptr to next sense index entry */} SnsIndex;typedef SnsIndex *SnsIndexPtr;    typedef struct {    int SenseCount[MAX_FORMS];	/* number of senses word form has */    int OutSenseCount[MAX_FORMS]; /* number of senses printed for word form */    int numforms;		/* number of word forms searchword has */    int printcnt;		/* number of senses printed by search */    char *searchbuf;		/* buffer containing formatted results */    SynsetPtr searchds;		/* data structure containing search results */} SearchResults;typedef SearchResults *SearchResultsPtr;/* Global variables and flags */extern SearchResults wnresults;	/* structure containing results of search */extern int fnflag;		/* if set, print lex filename after sense */extern int dflag;		/* if set, print definitional glosses */extern int saflag;		/* if set, print SEE ALSO pointers */extern int fileinfoflag;	/* if set, print lex file info on synsets */extern int frflag;		/* if set, print verb frames after synset */extern int abortsearch;		/* if set, stop search algorithm */extern int offsetflag;		/* if set, print byte offset of each synset */extern int wnsnsflag;		/* if set, print WN sense # for each word *//* File pointers for database files */extern int OpenDB;		/* if non-zero, database file are open */extern FILE *datafps[NUMPARTS + 1],             *indexfps[NUMPARTS + 1],            *sensefp,            *cntlistfp,            *keyindexfp, *revkeyindexfp,            *vidxfilefp, *vsentfilefp;/* Method for interface to check for events while search is running */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -