Example #1
0
 protected override PolarityType GetPolarity(PolarityType polarityType, AnnotatedSentence.AnnotatedSentence sentence, int index)
 {
     if (((AnnotatedWord)sentence.GetWord(index)).GetParse().ContainsTag(MorphologicalTag.NEGATIVE))
     {
         if (polarityType.Equals(PolarityType.POSITIVE))
         {
             polarityType = PolarityType.NEGATIVE;
         }
         else if (polarityType.Equals(PolarityType.NEGATIVE))
         {
             polarityType = PolarityType.POSITIVE;
         }
     }
     if (index + 1 < sentence.WordCount())
     {
         var nextWord = (AnnotatedWord)sentence.GetWord(index + 1);
         if (nextWord.GetParse().GetWord().GetName().ToLower().Equals("değil"))
         {
             if (polarityType.Equals(PolarityType.POSITIVE))
             {
                 return(PolarityType.NEGATIVE);
             }
             else if (polarityType.Equals(PolarityType.NEGATIVE))
             {
                 return(PolarityType.POSITIVE);
             }
         }
     }
     return(polarityType);
 }
Example #2
0
        private static MassSpectrometry.Polarity GetPolarity(PolarityType polarity)
        {
            switch (polarity)
            {
            case PolarityType.Positive: return(MassSpectrometry.Polarity.Positive);

            case PolarityType.Negative: return(MassSpectrometry.Polarity.Negative);

            default: throw new MzLibException("Cannot interpret polarity type: " + polarity);
            }
        }
Example #3
0
        /**
         * <summary>Constructs and returns an {@link ArrayList} of ids, which are the ids of the {@link SentiLiteral}s having polarity
         * polarityType.</summary>
         * <param name="polarityType">PolarityTypes of the searched {@link SentiLiteral}s</param>
         * <returns>An {@link ArrayList} of id having polarityType polarityType.</returns>
         */
        private List <string> GetPolarity(PolarityType polarityType)
        {
            var result = new List <string>();

            foreach (var sentiLiteral in _sentiLiteralList.Values)
            {
                if (sentiLiteral.GetPolarity() == polarityType)
                {
                    result.Add(sentiLiteral.GetName());
                }
            }

            return(result);
        }
        /**
         * <summary>Constructs and returns an {@link ArrayList} of ids, which are the ids of the {@link SentiSynSet}s having polarity
         * polarityType.</summary>
         * <param name="polarityType">PolarityTypes of the searched {@link SentiSynSet}s</param>
         * <returns>An {@link ArrayList} of id having polarityType polarityType.</returns>
         */
        private List <string> GetPolarity(PolarityType polarityType)
        {
            var result = new List <string>();

            foreach (var sentiSynSet in _sentiSynSetList.Values)
            {
                if (sentiSynSet.GetPolarity() == polarityType)
                {
                    result.Add(sentiSynSet.GetId());
                }
            }

            return(result);
        }
 protected abstract PolarityType GetPolarity(PolarityType polarityType, AnnotatedSentence.AnnotatedSentence sentence, int index);