Exemplo n.º 1
0
 public static void UntrainWithUnit(RestaurantTrainPattern untrainUnit, string classifierName)
 {
     try
     {
         if (untrainUnit.Cuisines != null)
         {
             log.WarnFormat("[UntrainWithUnit] untrainUnit.Name={0}, untrainUnit.Description={1}, untrainUnit.Cuisines={2}, classifierName={3}.", untrainUnit.Name, untrainUnit.Description, String.Join(", ", untrainUnit.Cuisines.ToArray()), classifierName);
             foreach (var cuisine in untrainUnit.Cuisines)
             {
                 if (untrainUnit.Name != null && untrainUnit.Name != "")
                 {
                     Untrain(untrainUnit.Name, cuisine, classifierName);
                 }
                 if (untrainUnit.Description != null && untrainUnit.Description != "")
                 {
                     Untrain(untrainUnit.Description, cuisine, classifierName);
                 }
             }
         }
         else
         {
             log.WarnFormat("[UntrainWithUnit] untrainUnit.Cuisines = null");
         }
     }
     catch (Exception e)
     {
         log.ErrorFormat("[TrainWithUnit] Exception={0}.", e.Message);
     }
 }
Exemplo n.º 2
0
 public List<RestaurantTrainPattern> GetTrainSetCuisineTypeBackOfficeSource()
 {
     List<RestaurantBasicData> restsWithCuisine = restaurantsSearchUtilty.GetAllRestaurantsWithBackOfficeSource();
     if (restsWithCuisine != null)
     {
         List<RestaurantTrainPattern> trainSet = new List<RestaurantTrainPattern>();
         List<RestaurantTrainPattern> notIncludedInSet = new List<RestaurantTrainPattern>();
         foreach (var rest in restsWithCuisine)
         {
             RestaurantTrainPattern tempPattern = new RestaurantTrainPattern(rest);
             if ((tempPattern.Name != null || tempPattern.Description != null) && tempPattern.Cuisines != null && tempPattern.Cuisines.Count > 0)
             {
                 trainSet.Add(tempPattern);
             }
             else notIncludedInSet.Add(tempPattern);
         }
         if (trainSet.Count > 0)
         {
             log.InfoFormat("[GetTrainSetCuisineTypeBackOfficeSource] trainSet.Count={0}.", trainSet.Count);
             return trainSet;
         }
         else log.WarnFormat("[GetTrainSetCuisineTypeBackOfficeSource] trainSet is empty.");
     }
     else
     {
         log.WarnFormat("[GetTrainSetCuisineTypeBackOfficeSource] Can't get restaurants with cuisines.");
     }
     return null;
 }