src/Chinese/parse/ch_LanguageSpecificFunctions.cpp
// assumes the array is in normal order: premods, head, postmods
// code adapted (with lots of liberties) from ChineseHeadFinder.cpp. Determine the head
// of the new NP that will wrap these nodes

assumes the array is in normal order: premods, head, postmods
code adapted (with lots of liberties) from ChineseHeadFinder.cpp. Determine the head
of the new NP that will wrap these nodes
assumes the array is in normal order : premods head postmods code adapted ( with lots of liberties ) from ChineseHeadFinder . cpp . Determine the head of the new NP that will wrap these nodes
int ChineseLanguageSpecificFunctions::_findNPHead(ParseNode* arr[], int numNodes)  {
	if (numNodes == 1)
		return 0;
	Symbol set1[7] = {ChineseSTags::NP, ChineseSTags::NPA, ChineseSTags::NPP, ChineseSTags::NN, ChineseSTags::NR,  
						ChineseSTags::NT, ChineseSTags::DATE};
	int result = _scanBackward(arr, numNodes, set1, 7);
	if (result >= 0)
		return result;
	Symbol set2[12] = {ChineseSTags::CP, ChineseSTags::QP, ChineseSTags::DP, ChineseSTags::DNP, 
						ChineseSTags::CLP, ChineseSTags::PRN, ChineseSTags::LCP, ChineseSTags::IP, 
						ChineseSTags::PP, ChineseSTags::ADJP, ChineseSTags::ADVP, ChineseSTags::UCP};
	result = _scanBackward(arr, numNodes, set2, 12);
	if (result >= 0)
		return result;
	return numNodes-1;
}
int ChineseLanguageSpecificFunctions :: _findNPHead ( ParseNode * arr [ ] , int numNodes ) { if ( numNodes == 1 ) return 0 ; Symbol set1 [ 7 ] = { ChineseSTags :: NP , ChineseSTags :: NPA , ChineseSTags :: NPP , ChineseSTags :: NN , ChineseSTags :: NR , ChineseSTags :: NT , ChineseSTags :: DATE } ; int result = _scanBackward ( arr , numNodes , set1 , 7 ) ; if ( result >= 0 ) return result ; Symbol set2 [ 12 ] = { ChineseSTags :: CP , ChineseSTags :: QP , ChineseSTags :: DP , ChineseSTags :: DNP , ChineseSTags :: CLP , ChineseSTags :: PRN , ChineseSTags :: LCP , ChineseSTags :: IP , ChineseSTags :: PP , ChineseSTags :: ADJP , ChineseSTags :: ADVP , ChineseSTags :: UCP } ; result = _scanBackward ( arr , numNodes , set2 , 12 ) ; if ( result >= 0 ) return result ; return numNodes - 1 ; }
assumes the array is in normal order: premods, head, postmods
code adapted (with lots of liberties) from ChineseHeadFinder.cpp.
assumes the array is in normal order : premods head postmods code adapted ( with lots of liberties ) from ChineseHeadFinder . cpp .