public VocabularyObscurity(TextBlock text, IFrequencyListManager manager) { Internet = new SpecificObscurity(text, manager.Internet); BNC = new SpecificObscurity(text, manager.BNC); Reuters = new SpecificObscurity(text, manager.Reuters); Subtitles = new SpecificObscurity(text, manager.Subtitles); }
public StyleFactory(IPOSTagger tagger, INRCDictionary nrcDictionary, IFrequencyListManager frequency, IInquirerManager inquirer) { this.nrcDictionary = nrcDictionary ?? throw new ArgumentNullException(nameof(nrcDictionary)); this.frequency = frequency ?? throw new ArgumentNullException(nameof(frequency)); this.inquirer = inquirer ?? throw new ArgumentNullException(nameof(inquirer)); this.tagger = tagger ?? throw new ArgumentNullException(nameof(tagger)); }
public TextBlock(IPOSTagger tagger, IInquirerManager inquirer, IFrequencyListManager frequency, SentenceItem[] sentences) { if (tagger is null) { throw new ArgumentNullException(nameof(tagger)); } if (inquirer is null) { throw new ArgumentNullException(nameof(inquirer)); } if (frequency is null) { throw new ArgumentNullException(nameof(frequency)); } if (sentences is null) { throw new ArgumentNullException(nameof(sentences)); } if (sentences is null) { throw new ArgumentNullException(nameof(sentences)); } if (sentences.Length == 0) { throw new ArgumentException("Value cannot be an empty collection.", nameof(sentences)); } Sentences = sentences; Surface = new SurfaceData(this); Readability = new ReadabilityDataSource(this); Words = (from sentence in Sentences from word in sentence.Words select word).ToArray(); if (Words.Length == 0) { throw new ArgumentException("Value cannot be an empty collection.", nameof(Words)); } var pure = new List <WordEx>(); foreach (var word in Words) { if (word.Text.HasLetters() || word.Text.Length > 0 && char.IsDigit(word.Text[0])) { pure.Add(word); } if (!string.IsNullOrEmpty(word.Raw)) { lemmaDictionary.GetSafeCreate(word.Raw).Add(word); } wordDictionary.GetSafeCreate(word.Text).Add(word); } PureWords = pure.ToArray(); VocabularyObscurity = new VocabularyObscurity(this, frequency); SyntaxFeatures = new SyntaxFeatures(this, tagger); InquirerFinger = new InquirerFingerPrint(this, inquirer); Sentiment = new SentimentFeatures(this); }