public CloudProcessor(Options options, IWordSource wordSource, IGrammarInfoParser grammarInfoParser, GrammarFormJoiner grammarFormJoiner, IWordFilter[] wordFilters, IFontManager fontManager, ICloudGenerator cloudGenerator, IColorManager colorManager, ICloudRenderer cloudRenderer) { this.wordSource = wordSource; this.grammarInfoParser = grammarInfoParser; this.grammarFormJoiner = grammarFormJoiner; this.wordFilters = wordFilters; wordCount = options.Count; this.fontManager = fontManager; this.cloudGenerator = cloudGenerator; this.colorManager = colorManager; this.cloudRenderer = cloudRenderer; }
public void Join_selectsMostCommonForm() { var filter = new GrammarFormJoiner(); var statistics = new OccurrenceStatistics(new Dictionary<string, int> { {"активный", 10}, {"активное", 20}, {"команд", 40}, }); var grammarInfo = new Dictionary<string, WordGrammarInfo> { {"активный", new WordGrammarInfo("активный", PartOfSpeech.Adjective)}, {"активное", new WordGrammarInfo("активный", PartOfSpeech.Adjective)}, {"команд", new WordGrammarInfo("команда", PartOfSpeech.Noun)}, }; statistics = filter.Join(statistics, grammarInfo); statistics.OccurrenceCount.Keys.Should().BeEquivalentTo("активное", "команд"); }
public void Join_mergesGrammarForms() { var filter = new GrammarFormJoiner(); var statistics = new OccurrenceStatistics(new Dictionary<string, int> { {"активный", 10}, {"активное", 20}, {"команд", 40}, }); var grammarInfo = new Dictionary<string, WordGrammarInfo> { {"активный", new WordGrammarInfo("активный", PartOfSpeech.Adjective)}, {"активное", new WordGrammarInfo("активный", PartOfSpeech.Adjective)}, {"команд", new WordGrammarInfo("команда", PartOfSpeech.Noun)}, }; statistics = filter.Join(statistics, grammarInfo); statistics.OccurrenceCount.Keys.Should().HaveCount(2) .And.Contain(key => grammarInfo[key].InitialForm == "активный" && statistics.OccurrenceCount[key] == 30) .And.Contain(key => grammarInfo[key].InitialForm == "команда" && statistics.OccurrenceCount[key] == 40); }