Przeglądaj źródła

consider the group id when do the particle classification( the smaller groupid has the higher preference)

GSP 3 tygodni temu
rodzic
commit
fcbce12bd0

+ 29 - 3
OTSCPP/OTSClassifyEngine/ExpressionClassifyEngine.cpp

@@ -121,11 +121,37 @@ bool ExpressionClassifyEngine::ClassifyExpression(COTSParticlePtr particle, CPos
 			auto matchedItem = matchedItems[0];
 			for (auto itm : matchedItems)
 			{
-
-				if (itm->GetExpressionStr().size() > matchedItem->GetExpressionStr().size())
+				 if(itm->GetGrpID() ==0 && matchedItem->GetGrpID()==0)
 				{
-					matchedItem = itm;
+					//choose the most detailed one.
+					 if (itm->GetExpressionStr().size() > matchedItem->GetExpressionStr().size())
+					 {
+						 matchedItem = itm;
+					 }
+					 continue;
 				}
+				if(itm->GetGrpID()>0 )
+				{
+					if(itm->GetGrpID()<matchedItem->GetGrpID())
+					{
+						//choose the item with the smallest group id first.
+						matchedItem = itm;
+						continue;
+					}
+					else if(itm->GetGrpID() == matchedItem->GetGrpID())	
+					{
+						//choose the most detailed one.
+						if (itm->GetExpressionStr().size() > matchedItem->GetExpressionStr().size())
+						{
+							matchedItem = itm;
+						}
+						continue;	
+					}
+					
+					
+				}
+				
+				
 				
 			}
 			particle->SetBasicClassifyId(OTS_PARTICLE_BASIC_CLASSIFY::IDENTIFIED);