コード例 #1
0
 public List<UntrainPattern> GetUntrainSet(List<string> wordsList)
 {
     if ( wordsList != null && wordsList.Count > 0 )
     {
         List<UntrainPattern> returnList = new List<UntrainPattern>();
         List<string> classNames = new List<string>
         {
             "arabic",
             "asian",
             "burger",
             "cafe",
             "chinese",
             "falafel",
             "fish",
             "hummus",
             "ice cream",
             "indian",
             "italian",
             "kebab",
             "meat",
             "moroccan",
             "noodles",
             "pasta",
             "pizza",
             "salat",
             "sandwich",
             "schnitzel",
             "shawarma",
             "sushi",
             "vegan",
             "vegetarian"
         };
         foreach (string word in wordsList)
         {
             UntrainPattern tempPattern = new UntrainPattern()
             {
                 Text = word,
                 ClassNames = classNames
             };
             returnList.Add(tempPattern);
         }
         return returnList;
     }
     return null;
 }
コード例 #2
0
ファイル: UntrainUtility.cs プロジェクト: pashkov/Spontaneous
 public static void UntrainWithUnit(UntrainPattern untrainUnit, string classifierName)
 {
     try
     {
         if (untrainUnit.ClassNames != null)
         {
             log.WarnFormat("[UntrainWithUnit] untrainUnit.Name={0}, untrainUnit.ClassNames={2}, classifierName={3}.", untrainUnit.Text, String.Join(", ", untrainUnit.ClassNames.ToArray()), classifierName);
             foreach (var className in untrainUnit.ClassNames)
             {
                 if (untrainUnit.Text != null && untrainUnit.Text != "")
                 {
                     Untrain(untrainUnit.Text, className, classifierName);
                 }
             }
         }
         else
         {
             log.WarnFormat("[UntrainWithUnit] untrainUnit.Cuisines = null");
         }
     }
     catch (Exception e)
     {
         log.ErrorFormat("[TrainWithUnit] Exception={0}.", e.Message);
     }
 }