Exemplo n.º 1
0
            public string JSONSerialize()
            {
                Dictionary <string, TokenSeializable> sTokens = new Dictionary <string, TokenSeializable>();
                VocabularySerializable sVocabulary            = new VocabularySerializable();

                foreach (TokenModel t in _tokens.Values)
                {
                    sTokens.Add(t.token, new TokenSeializable(t.token, t.NofXNEG, t.NofXPOS, t.probabilityNEG(negWords, _tokens.Count), t.probabilityPOS(posWords, _tokens.Count)));
                }

                sVocabulary.amountNEGReviews = amountNEGReviews;
                sVocabulary.amountPOSReviews = amountPOSReviews;
                sVocabulary.SOfEmptyNEG      = SOfEmptyNEG;
                sVocabulary.SOfEmptyPOS      = SOfEmptyPOS;
                sVocabulary.tokens           = sTokens;
                sVocabulary.negWords         = negWords;
                sVocabulary.posWords         = posWords;

                return(JsonConvert.SerializeObject(sVocabulary));
            }
Exemplo n.º 2
0
 public SentimentModel(string JSON)
 {
     sVocabulary = Dezerialize(JSON);
 }