Beispiel #1
0
        public Sentiment[] AllAssociatedSentiments(Sentiment[] allSentiments)
        {
            string           textOfPhrase         = Utilities.DeleteSpaces(TextPhrase.Trim().ToLower());
            List <Sentiment> associatedSentiments = new List <Sentiment>();

            foreach (Sentiment sentiment in allSentiments)
            {
                string sentimentOfList = Utilities.DeleteSpaces(sentiment.SentimientText.Trim().ToLower());
                if (textOfPhrase.Contains(sentimentOfList))
                {
                    sentiment.IsAssociatedToPhrase = true;
                    associatedSentiments.Add(sentiment);
                }
            }
            return(associatedSentiments.ToArray());
        }
Beispiel #2
0
        public void AssociateEntity(Entity[] entities)
        {
            string textOfPhrase = Utilities.DeleteSpaces(TextPhrase.Trim().ToLower());
            int    minUbication = 9999;
            Entity entityFound  = null;

            foreach (Entity entity in entities)
            {
                string entityOfList = Utilities.DeleteSpaces(entity.EntityName.ToLower());
                if (textOfPhrase.Contains(entityOfList))
                {
                    if (textOfPhrase.IndexOf(entityOfList) < minUbication)
                    {
                        minUbication = textOfPhrase.IndexOf(entityOfList);
                        entityFound  = entity;
                    }
                }
            }
            Entity = entityFound;
        }