src/English/parse/en_LanguageSpecificFunctions.cpp
// assumes the array is in normal order: premods, head, postmods
// code stolen and adapted from EnglishHeadFinder.cpp. Determine the head
// of the new NP that will wrap these nodes
// code borrowed from EnglishHeadFinder.cpp

assumes the array is in normal order: premods, head, postmods
code stolen and adapted from EnglishHeadFinder.cpp. Determine the head
of the new NP that will wrap these nodes
code borrowed from EnglishHeadFinder.cpp
assumes the array is in normal order : premods head postmods code stolen and adapted from EnglishHeadFinder . cpp . Determine the head of the new NP that will wrap these nodes code borrowed from EnglishHeadFinder . cpp
int EnglishLanguageSpecificFunctions::findNPHead(ParseNode* arr[], int numNodes) {
	if (numNodes == 1)
		return 0;
	Symbol set1[8] = {EnglishSTags::NN,   EnglishSTags::NNP,  EnglishSTags::NPP,
		EnglishSTags::NNPS, EnglishSTags::DATE, EnglishSTags::NNS,
		EnglishSTags::NX,   EnglishSTags::JJR};
	int result = _scanBackward(arr, numNodes, set1, 8);
	if (result >= 0)
		return result;
	Symbol set2[3] = {EnglishSTags::NP, EnglishSTags::NPA, EnglishSTags::NPPOS};
	result = _scanForward(arr, numNodes, set2, 3);
	if (result >= 0)
		return result;
	Symbol set3[3] = {EnglishSTags::DOLLAR, EnglishSTags::ADJP, EnglishSTags::PRN};
	result = _scanBackward(arr, numNodes, set3, 3);
	if (result >= 0)
		return result;
	Symbol set4[1]= {EnglishSTags::CD};
	result = _scanBackward(arr, numNodes, set4, 1);
	if (result >= 0)
		return result;
	Symbol set5[4]= {EnglishSTags::JJ, EnglishSTags::JJS,
		EnglishSTags::RB, EnglishSTags::QP};
	result = _scanBackward(arr, numNodes, set5, 4);
	if (result >= 0)
		return result;
	return numNodes-1;
}
int EnglishLanguageSpecificFunctions :: findNPHead ( ParseNode * arr [ ] , int numNodes ) { if ( numNodes == 1 ) return 0 ; Symbol set1 [ 8 ] = { EnglishSTags :: NN , EnglishSTags :: NNP , EnglishSTags :: NPP , EnglishSTags :: NNPS , EnglishSTags :: DATE , EnglishSTags :: NNS , EnglishSTags :: NX , EnglishSTags :: JJR } ; int result = _scanBackward ( arr , numNodes , set1 , 8 ) ; if ( result >= 0 ) return result ; Symbol set2 [ 3 ] = { EnglishSTags :: NP , EnglishSTags :: NPA , EnglishSTags :: NPPOS } ; result = _scanForward ( arr , numNodes , set2 , 3 ) ; if ( result >= 0 ) return result ; Symbol set3 [ 3 ] = { EnglishSTags :: DOLLAR , EnglishSTags :: ADJP , EnglishSTags :: PRN } ; result = _scanBackward ( arr , numNodes , set3 , 3 ) ; if ( result >= 0 ) return result ; Symbol set4 [ 1 ] = { EnglishSTags :: CD } ; result = _scanBackward ( arr , numNodes , set4 , 1 ) ; if ( result >= 0 ) return result ; Symbol set5 [ 4 ] = { EnglishSTags :: JJ , EnglishSTags :: JJS , EnglishSTags :: RB , EnglishSTags :: QP } ; result = _scanBackward ( arr , numNodes , set5 , 4 ) ; if ( result >= 0 ) return result ; return numNodes - 1 ; }
assumes the array is in normal order: premods, head, postmods
code stolen and adapted from EnglishHeadFinder.cpp.
assumes the array is in normal order : premods head postmods code stolen and adapted from EnglishHeadFinder . cpp .