예제 #1
0
파일: Detector.cs 프로젝트: M-doubleC/ZyLAB
    public Detector(string DictionaryLocation, string lann, string w2v, Prepare DataSrc)
    {
        // download the OpenNLp dotNet implementation from Github https://github.com/AlexPoint/OpenNlp
        var modelPath = ".../OpenNlp-master/OpenNlp-master/Resources/Models/EnglishSD.nbin";

        sentenceDetector = new EnglishMaximumEntropySentenceDetector(modelPath);
        tokenizer        = new EnglishRuleBasedTokenizer(false); //the false is for the split on hyphen
        string[] Stopwords = File.ReadAllLines(@".../Dataset/stopwords.txt");
        var      hash      = new HashSet <string>(Stopwords);

        Stopdict = hash.ToArray().ToDictionary(key => key, value => value);
        StemDown = new EnglishStemmer();
        //StemDown = new DutchStemmer();
        ReadEmotionDictionary(DictionaryLocation, lann);
        MLkernel = new MachineL(w2v, lann, CorpusTokenize(DataSrc.TFCorpus()));
    }