src/Arabic/edt/ar_PronounLinker.cpp
/* candidates are all nodes with mentions
assume np chunk parses-
*/
candidates are all nodes with mentions
assume np chunk parses
candidates are all nodes with mentions assume np chunk parses
int ArabicPronounLinker::_getCandidates(const SynNode* pronNode,  GrowableArray <const Parse *> &prevSentences, 
								  HobbsDistance::SearchResult results[], int max_results){
	const SynNode* temp[500];
	int ncan = 0;
	const SynNode* root = pronNode;
	const SynNode* topChildOfPron = pronNode;
	while(root->getParent() !=0){
		topChildOfPron = root;
		root = root->getParent();
	}
	for(int i=0; i< root->getNChildren(); i++){
		if(root->getChild(i) == topChildOfPron){
			break;
		}
		if(root->getChild(i)->getTag() == ArabicSTags::NP){
			const SynNode* np = root->getChild(i);
			for(int j=1; j < np->getNChildren(); j++){
				if(np->getChild(j)->getTag() == ArabicSTags::NPP){
					temp[ncan++] = np->getChild(j);
				}
				if(ncan >=500){
					break;
				}
			}
			temp[ncan++] = root->getChild(i);
		}
		if(ncan >=100){
			break;
		}
	}
	if(_isPossesivePronoun(pronNode)){
		if(ncan>0 && temp[ncan-1]->getEndToken() == pronNode->getStartToken()-1){
			ncan--;
		}
	}
	int j =0;
	for(int k=ncan-1; k>= 0; k--){
		results[j].node = temp[k];
		results[j].sentence_number = prevSentences.length();
		j++;
		if(j >= max_results){
			break;
		}
	}
	return j;
 }
int ArabicPronounLinker :: _getCandidates ( const SynNode * pronNode , GrowableArray < const Parse * > & prevSentences , HobbsDistance :: SearchResult results [ ] , int max_results ) { const SynNode * temp [ 500 ] ; int ncan = 0 ; const SynNode * root = pronNode ; const SynNode * topChildOfPron = pronNode ; while ( root -> getParent ( ) != 0 ) { topChildOfPron = root ; root = root -> getParent ( ) ; } for ( int i = 0 ; i < root -> getNChildren ( ) ; i ++ ) { if ( root -> getChild ( i ) == topChildOfPron ) { break ; } if ( root -> getChild ( i ) -> getTag ( ) == ArabicSTags :: NP ) { const SynNode * np = root -> getChild ( i ) ; for ( int j = 1 ; j < np -> getNChildren ( ) ; j ++ ) { if ( np -> getChild ( j ) -> getTag ( ) == ArabicSTags :: NPP ) { temp [ ncan ++ ] = np -> getChild ( j ) ; } if ( ncan >= 500 ) { break ; } } temp [ ncan ++ ] = root -> getChild ( i ) ; } if ( ncan >= 100 ) { break ; } } if ( _isPossesivePronoun ( pronNode ) ) { if ( ncan > 0 && temp [ ncan - 1 ] -> getEndToken ( ) == pronNode -> getStartToken ( ) - 1 ) { ncan -- ; } } int j = 0 ; for ( int k = ncan - 1 ; k >= 0 ; k -- ) { results [ j ] . node = temp [ k ] ; results [ j ] . sentence_number = prevSentences . length ( ) ; j ++ ; if ( j >= max_results ) { break ; } } return j ; }
candidates are all nodes with mentions
assume np chunk parses
candidates are all nodes with mentions assume np chunk parses
//if its a possesive pronoun, eliminate the node next to it
