src/Arabic/parse/ar_WordSegment.cpp
/*Look for a clitic suffix, return the number of characters in the 
* suffix.  Return 5 for suffix ny, which must be treated as both
* XXXXn+y and XXXX+ny 
* Return 6 for hmA, which must be treated as both
* XXXXh+mA and XXXX+hmA
*/
Look for a clitic suffix, return the number of characters in the
suffix.  Return 5 for suffix ny, which must be treated as both
XXXXn+y and XXXX+ny
Return 6 for hmA, which must be treated as both
XXXXh+mA and XXXX+hmA
Look for a clitic suffix return the number of characters in the suffix . Return 5 for suffix ny which must be treated as both XXXXn + y and XXXX + ny Return 6 for hmA which must be treated as both XXXXh + mA and XXXX + hmA
int WordSegment::_suffix(const wchar_t* word){
	size_t wordLength = wcslen(word);
	wchar_t lc = word[wordLength-1];
	wchar_t lc2 = 0;
	wchar_t lc3 = 0;
	if(wordLength > 2) lc2 =word[wordLength -2];
	if(wordLength > 3) lc3 = word[wordLength -3];
	if(lc == ArabicSymbol::ArabicChar('k')||
		lc==ArabicSymbol::ArabicChar('h'))
		return 1;
	if(lc== ArabicSymbol::ArabicChar('y')){
		if(lc2 ==ArabicSymbol::ArabicChar('n'))
			return 5;
		return 1;
	}
	if((lc ==ArabicSymbol::ArabicChar('A'))&&
		(lc2==ArabicSymbol::ArabicChar('m'))&&
		(lc3 == ArabicSymbol::ArabicChar('h'))) return 6;
	if((lc ==ArabicSymbol::ArabicChar('A'))&&
		(lc2==ArabicSymbol::ArabicChar('m'))&&
		(lc3 == ArabicSymbol::ArabicChar('k'))) return 6;
	if((lc == ArabicSymbol::ArabicChar('A'))&&
		((lc2 ==ArabicSymbol::ArabicChar('n'))||
			(lc2==ArabicSymbol::ArabicChar('h'))||
			(lc2==ArabicSymbol::ArabicChar('m')))) return 2;
	if((lc == ArabicSymbol::ArabicChar('m'))&& 
		((lc2 ==ArabicSymbol::ArabicChar('h'))||
		(lc2 == ArabicSymbol::ArabicChar('k')))) return 2;
	if((lc == ArabicSymbol::ArabicChar('n')) && 
		((lc2 ==ArabicSymbol::ArabicChar('h')) ||
		(lc2 ==ArabicSymbol::ArabicChar('k')))) return 2;
	if((lc ==ArabicSymbol::ArabicChar('n'))&&
		(lc2==ArabicSymbol::ArabicChar('h'))&&
		(lc3 == ArabicSymbol::ArabicChar('n'))) return 3;
	return 0;
}
int WordSegment :: _suffix ( const wchar_t * word ) { size_t wordLength = wcslen ( word ) ; wchar_t lc = word [ wordLength - 1 ] ; wchar_t lc2 = 0 ; wchar_t lc3 = 0 ; if ( wordLength > 2 ) lc2 = word [ wordLength - 2 ] ; if ( wordLength > 3 ) lc3 = word [ wordLength - 3 ] ; if ( lc == ArabicSymbol :: ArabicChar ( ' ' ) || lc == ArabicSymbol :: ArabicChar ( ' ' ) ) return 1 ; if ( lc == ArabicSymbol :: ArabicChar ( ' ' ) ) { if ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) return 5 ; return 1 ; } if ( ( lc == ArabicSymbol :: ArabicChar ( ' ' ) ) && ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) && ( lc3 == ArabicSymbol :: ArabicChar ( ' ' ) ) ) return 6 ; if ( ( lc == ArabicSymbol :: ArabicChar ( ' ' ) ) && ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) && ( lc3 == ArabicSymbol :: ArabicChar ( ' ' ) ) ) return 6 ; if ( ( lc == ArabicSymbol :: ArabicChar ( ' ' ) ) && ( ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) || ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) || ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) ) ) return 2 ; if ( ( lc == ArabicSymbol :: ArabicChar ( ' ' ) ) && ( ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) || ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) ) ) return 2 ; if ( ( lc == ArabicSymbol :: ArabicChar ( ' ' ) ) && ( ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) || ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) ) ) return 2 ; if ( ( lc == ArabicSymbol :: ArabicChar ( ' ' ) ) && ( lc2 == ArabicSymbol :: ArabicChar ( ' ' ) ) && ( lc3 == ArabicSymbol :: ArabicChar ( ' ' ) ) ) return 3 ; return 0 ; }
Look for a clitic suffix, return the number of characters in the
suffix.
Look for a clitic suffix return the number of characters in the suffix .
//hmA	
 //kmA added for BW
 //nA, hA,mA 
 //km, hm
 //hn, //kn added for BW
 //nhn
