Example #1
0
        private static DictionaryManager GetDictionaryManager(this XElement node, LanguageType languageType)
        {
            var dictionariesNode = node.GetSingleNode("Dictionaries");

            var basePathNode = dictionariesNode.Attribute("BasePath");
            var basePath     = (basePathNode != null) ? basePathNode.Value : null;

            var nounsNode        = dictionariesNode.GetSingleNode("Nouns");
            var verbsNode        = dictionariesNode.GetSingleNode("Verbs");
            var adjectivesNode   = dictionariesNode.GetSingleNode("Adjectives");
            var adverbsNode      = dictionariesNode.GetSingleNode("Adverbs");
            var collocationsNode = dictionariesNode.GetSingleNode("Collocations");
            var nerNode          = dictionariesNode.GetSingleNode("NER");

            var nouns        = nounsNode.GetNouns(basePath);
            var verbs        = verbsNode.GetVerbs(basePath);
            var adjectives   = adjectivesNode.GetAdjectives(basePath);
            var adverbs      = adverbsNode.GetAdverbs(basePath);
            var collocations = collocationsNode.GetCollocations(basePath);
            var ners         = nerNode.GetNERs(basePath);

            var dm = new DictionaryManager
                     (
                languageType,
                nouns,
                verbs,
                adjectives,
                adverbs,
                collocations,
                ners
                     );

            return(dm);
        }
        public Language(LanguageType languageType, DictionaryManager dictionaryManager, Rules rules)
        {
            dictionaryManager.ThrowIfNull("dictionaryManager");
            rules.ThrowIfNull("rules");

            this.LanguageType      = languageType;
            this.DictionaryManager = dictionaryManager;
            this.Rules             = rules;
        }