Ejemplo n.º 1
0
        private Polarity.Common.Polarity AnalyseMessage(IShortMessage message)
        {
            double simPos = Similarity(message, positive);

            if (simPos > 3.1)
            {
                return Polarity.Common.Polarity.POSITIVE;
            }

            double simNeg = Similarity(message, negative);

            if (simNeg > 3.1)
            {
                return Polarity.Common.Polarity.NEGATIVE;
            }

            Polarity.Common.Polarity polarity = Polarity.Common.Polarity.NEUTRAL;

            if (Math.Abs(simPos - simNeg) < 0.4)
            {
                return polarity;
            }

            else if (simPos > simNeg)
            {
                polarity = Polarity.Common.Polarity.POSITIVE;
            }

            else
            {
                polarity = Polarity.Common.Polarity.NEGATIVE;
            }

            return polarity;
        }
Ejemplo n.º 2
0
 public ShortMessage()
 {
     dataShortMessage = Factory.GetShortMessage();
 }
Ejemplo n.º 3
0
        private double Weight(string word, IShortMessage message)
        {
            string[] sep = new string[1];
            sep[0] = word;

            int tf = message.RawContent.Split(sep, StringSplitOptions.RemoveEmptyEntries).Length - 1;

            double df = 0;

            foreach(IShortMessage m in corpus)
            {
                if(m.RawContent.IndexOf(word) >= 0)
                {
                    ++df;
                }
            }

            double idf = Math.Log(((double)corpus.Count) / df);

            double gini = Gini(word);

            return tf * idf * gini;
        }
Ejemplo n.º 4
0
 private double Similarity(IShortMessage message, IDictionary<string, uint> category)
 {
     return 0.0;
 }
Ejemplo n.º 5
0
 public ShortMessage()
 {
     this.dataShortMessage = RoadFlow.Data.Factory.Factory.GetShortMessage();
 }