예제 #1
0
파일: Detector.cs 프로젝트: M-doubleC/ZyLAB
    public void DoClassification(Prepare Pdata, List <string> emos)
    {
        // Use the function FilterEmotionWords() instead of CorpusTokenize() to try the filtered emotion words version of the project

        //training phase
        List <string[]> TrainingSet = CorpusTokenize(Pdata.GetTraining().Keys.ToList());

        foreach (string v in emos)
        {
            MLkernel.TrainSession(TrainingSet, Pdata.GetExpected(v, Pdata.GetTraining()).ToArray(), v);
        }
        // classification phase
        List <string[]> TestSet = CorpusTokenize(Pdata.GetTesting().Keys.ToList());

        foreach (string v in emos)
        {
            List <int> ex   = Pdata.GetExpected(v, Pdata.GetTesting());
            int[]      pred = MLkernel.TestSession(TestSet, v);
            ComputePR(ex, pred);
        }
        System.IO.File.WriteAllLines("C:/Users/FthiA/Desktop/Emotion extraction/Phase12/Dataset/Missed_words.txt", MLkernel.Getmissed());
    }