src/Generic/wordnet/xx_WordNet.cpp
// the implementation of this function is for simulating the original function
// static int fillWordNetOffsets(Symbol word, Symbol pos, int *offsets, int MAX_OFFSETS)

the implementation of this function is for simulating the original function
static int fillWordNetOffsets(Symbol word, Symbol pos, int *offsets, int MAX_OFFSETS)
the implementation of this function is for simulating the original function static int fillWordNetOffsets ( Symbol word Symbol pos int * offsets int MAX_OFFSETS )
int WordNet::getHypernymOffsets(Symbol word, Symbol POS, int *results, int MAX_RESULTS){
	if (MAX_RESULTS > Max_Hypernym_perPOS_Cached) MAX_RESULTS = Max_Hypernym_perPOS_Cached;
	int pos_int;
	SymbolToIntArrayIntHash* hashedHyps = 0;
	Symbol stem = word;
	if (POS.is_null()) {
		pos_int = getpos("n");
		hashedHyps = nounHypernymOffsetHash;
		stem = stem_noun(word);
	}
	else if (POS == enAsGen::EnglishSTagsForWordnet::NN || POS == enAsGen::EnglishSTagsForWordnet::NNS ||
			 POS == enAsGen::EnglishSTagsForWordnet::NNP || POS == enAsGen::EnglishSTagsForWordnet::NNPS) {
		pos_int = getpos("n");
		hashedHyps = nounHypernymOffsetHash;
		stem = stem_noun(word);
	}
	else if (POS == enAsGen::EnglishSTagsForWordnet::VB || POS == enAsGen::EnglishSTagsForWordnet::VBD ||
			 POS == enAsGen::EnglishSTagsForWordnet::VBG || POS == enAsGen::EnglishSTagsForWordnet::VBN ||
			 POS == enAsGen::EnglishSTagsForWordnet::VBP || POS == enAsGen::EnglishSTagsForWordnet::VBZ)
	{
		pos_int = getpos("v");
		stem = stem_verb(word);
		hashedHyps = verbHypernymOffsetHash;
	} else {
		return 0;
	}
	int n = 0;
	SymbolToIntArrayIntHash::iterator iter;
	iter = hashedHyps->find(stem);
	if (iter != hashedHyps->end()) {
		IntArrayInt entry = IntArrayInt((*iter).second);
		for (int i = 0; i < entry.num; i++) {
			if (n < MAX_RESULTS) {
				results[n++]=entry.offsets[i];
			}
		}
		return n;
	} else {
		SynsetPtr syn = getFirstSynSet(word, pos_int);
		if (syn == 0){
			(* hashedHyps)[stem].num=0;
			return 0;
		}
		int numOfCached = 0;
		SynsetPtr hyper = syn;
		while (numOfCached < Max_Hypernym_perPOS_Cached && hyper != 0) {
			if (hyper->ptroff != 0) {
				int offset = hyper->ptroff[0];
				(*hashedHyps)[stem].offsets[numOfCached]=offset; 
				if (n < MAX_RESULTS){
					results[n++]=offset;
				}
			} else {
				(* hashedHyps)[stem].num=numOfCached; 
				free_syns(syn);
				return n;
			}
			hyper = hyper->ptrlist;
			numOfCached++;
		}
		(* hashedHyps)[stem].num=numOfCached; 
		free_syns(syn);
		return n;
	}
}
int WordNet :: getHypernymOffsets ( Symbol word , Symbol POS , int * results , int MAX_RESULTS ) { if ( MAX_RESULTS > Max_Hypernym_perPOS_Cached ) MAX_RESULTS = Max_Hypernym_perPOS_Cached ; int pos_int ; SymbolToIntArrayIntHash * hashedHyps = 0 ; Symbol stem = word ; if ( POS . is_null ( ) ) { pos_int = getpos ( " " ) ; hashedHyps = nounHypernymOffsetHash ; stem = stem_noun ( word ) ; } else if ( POS == enAsGen :: EnglishSTagsForWordnet :: NN || POS == enAsGen :: EnglishSTagsForWordnet :: NNS || POS == enAsGen :: EnglishSTagsForWordnet :: NNP || POS == enAsGen :: EnglishSTagsForWordnet :: NNPS ) { pos_int = getpos ( " " ) ; hashedHyps = nounHypernymOffsetHash ; stem = stem_noun ( word ) ; } else if ( POS == enAsGen :: EnglishSTagsForWordnet :: VB || POS == enAsGen :: EnglishSTagsForWordnet :: VBD || POS == enAsGen :: EnglishSTagsForWordnet :: VBG || POS == enAsGen :: EnglishSTagsForWordnet :: VBN || POS == enAsGen :: EnglishSTagsForWordnet :: VBP || POS == enAsGen :: EnglishSTagsForWordnet :: VBZ ) { pos_int = getpos ( " " ) ; stem = stem_verb ( word ) ; hashedHyps = verbHypernymOffsetHash ; } else { return 0 ; } int n = 0 ; SymbolToIntArrayIntHash :: iterator iter ; iter = hashedHyps -> find ( stem ) ; if ( iter != hashedHyps -> end ( ) ) { IntArrayInt entry = IntArrayInt ( ( * iter ) . second ) ; for ( int i = 0 ; i < entry . num ; i ++ ) { if ( n < MAX_RESULTS ) { results [ n ++ ] = entry . offsets [ i ] ; } } return n ; } else { SynsetPtr syn = getFirstSynSet ( word , pos_int ) ; if ( syn == 0 ) { ( * hashedHyps ) [ stem ] . num = 0 ; return 0 ; } int numOfCached = 0 ; SynsetPtr hyper = syn ; while ( numOfCached < Max_Hypernym_perPOS_Cached && hyper != 0 ) { if ( hyper -> ptroff != 0 ) { int offset = hyper -> ptroff [ 0 ] ; ( * hashedHyps ) [ stem ] . offsets [ numOfCached ] = offset ; if ( n < MAX_RESULTS ) { results [ n ++ ] = offset ; } } else { ( * hashedHyps ) [ stem ] . num = numOfCached ; free_syns ( syn ) ; return n ; } hyper = hyper -> ptrlist ; numOfCached ++ ; } ( * hashedHyps ) [ stem ] . num = numOfCached ; free_syns ( syn ) ; return n ; } }
the implementation of this function is for simulating the original function
static int fillWordNetOffsets(Symbol word, Symbol pos, int *offsets, int MAX_OFFSETS)
the implementation of this function is for simulating the original function static int fillWordNetOffsets ( Symbol word Symbol pos int * offsets int MAX_OFFSETS )
//word=Symbol(L"founding");
 //POS=enAsGen::EnglishSTagsForWordnet::VBG;
 //This case was taken from en_LanguageSpecificFunctions::isNPtypePOStag()
 //This case was taken from en_WordNet.cpp
