using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MarketData.MarketDataModel
{
  public class LexicalDictionary : Dictionary<String,LexicalElement>
  {
    public LexicalDictionary()
    {
    }
    public LexicalCollection ToList()
    {
      List<LexicalElement> lexicalElements=new List<LexicalElement>(this.Values);
      return new LexicalCollection(lexicalElements);
    }
  }
  public class LexicalElement
  {
    public const String POSITIVE_SENTIMENT="Positive";
    public const String NEGATIVE_SENTIMENT="Negative";
    public const String NEUTRAL_SENTIMENT="Neutral";
    public const String VERB="verb";
    public const String ADJECTIVE="adjective";
    public const String ADVERB="adverb";
    public const String NOUN="noun";
    public const String CONJUNCTION="conjunction";

    public LexicalElement()
    {
    }
    public LexicalElement(String word,String sentiment)
    {
      Word=word;
      Sentiment=sentiment;
    }
    public String Word{get;set;}
    public String PartOfSpeech{get;set;}
    public String Sentiment{get;set;}
  }
  public class LexicalCollection : List<LexicalElement>
  {
    public LexicalCollection()
    {
    }
    public LexicalCollection(List<LexicalElement> lexicalCollection)
    {
      foreach(LexicalElement lexicalElement in lexicalCollection)Add(lexicalElement);
    }
    public LexicalDictionary ToDictionary(String sentiment)
    {
      LexicalDictionary lexicalCollectionDictionary=new LexicalDictionary();
      List<LexicalElement> lexicalCollection=(from LexicalElement lexicalElement in this where lexicalElement.Sentiment.Equals(sentiment) select lexicalElement).ToList();
      foreach(LexicalElement lexicalElement in lexicalCollection)lexicalCollectionDictionary.Add(lexicalElement.Word,lexicalElement);
      return lexicalCollectionDictionary;
    }
  }
}
