private static IEnumerable <Word> Parse(HtmlDocument html, string wordName) { var centerDiv = html.GetElementbyId("center"); var nodes = centerDiv.ChildNodes .Where(x => x.Name == "span") .Where(x => x.Attributes.Any(a => a.Name == "style" && a.Value == "color:black;background-color:#FFCCCC")) .ToList(); var words = new List <Word>(); foreach (var item in nodes) { var type = item.InnerText; Word word; string[] forms; #region switch switch (type) { case "(Article)": forms = ParseSimple(item, html); word = new Article(forms[0]); word.AddForms(forms); break; case "(Verb)": case "(Defective verb)": string[] v1, v2, v3, v4; var name = ParseVerb(item, html, out v1, out v2, out v3, out v4); var verb = new Verb(name); verb.AddForms(v1, VerbType.Infinitive); verb.AddForms(v2, VerbType.Past); verb.AddForms(v3, VerbType.PastParticiple); verb.AddForms(v4, VerbType.PresentParticiple); word = verb; break; case "(Modal verb)": forms = ParseSimple(item, html); word = new ModalVerb(forms[0]); word.AddForms(forms); break; case "(Noun)": case "(Feminine noun)": case "(Masculine noun)": forms = ParseNoun(item, html); word = new Noun(forms[0]); word.AddForms(forms); break; case "(Plural noun)": forms = ParseSimple(item, html); word = new Noun(forms[0]); word.AddForms(forms); break; case "(Adjective)": case "(Uninflected adjective)": forms = ParseSimple(item, html); word = new Adjective(forms[0]); word.AddForms(forms); break; case "(Preposition)": forms = ParseSimple(item, html); word = new Preposition(forms[0]); word.AddForms(forms); break; case "(Adverb)": case "(Uninflected adverb)": forms = ParseSimple(item, html); word = new Adverb(forms[0]); word.AddForms(forms); break; case "(Conjunction)": forms = ParseSimple(item, html); word = new Conjunction(forms[0]); word.AddForms(forms); break; case "(Interjection)": forms = ParseSimple(item, html); word = new Interjection(forms[0]); word.AddForm(forms[0]); break; case "(Pronoun)": case "(Quantitative plural pronoun)": case "(Uninflected interrogative pronoun)": case "(Demonstrative pronoun)": case "(Plural pronoun)": forms = ParseSimple(item, html); word = new Pronoun(forms[0], WordType.Pronoun); word.AddForms(forms); break; case "(Quantitative pronoun)": forms = ParseSimple(item, html); word = new Pronoun(forms[0], WordType.QuantitativePronoun); word.AddForms(forms); break; case "(Indefinite pronoun)": forms = ParseSimple(item, html); word = new Pronoun(forms[0], WordType.PronounIndefinite); word.AddForms(forms); break; case "(Uninflected pronoun)": forms = ParseSimple(item, html); word = new Pronoun(forms[0], WordType.PronounUninflected); word.AddForms(forms); break; case "(Relative pronoun)": case "(Relative pronoun 2)": forms = ParseSimple(item, html); word = new Pronoun(forms[0], WordType.PronounRelative); word.AddForms(forms); break; case "(1st person singular pronoun)": case "()": // (1st person plural pronoun ) forms = ParseSimple(item, html); word = new Pronoun(forms[0], WordType.PronounPerson1); word.AddForms(forms); break; case "(2nd person singular pronoun)": case "(2nd person plural pronoun )": forms = ParseSimple(item, html); word = new Pronoun(forms[0], WordType.PronounPerson2); word.AddForms(forms); break; case "(3rd person masculine singular pronoun)": case "(3rd person feminine singular pronoun )": case "(3rd person plural pronoun)": case "(3rd person neuter singular pronoun)": forms = ParseSimple(item, html); word = new Pronoun(forms[0], WordType.PronounPerson2); word.AddForms(forms); break; default: throw new NotSupportedException(string.Format("The type {0} is not defined", type)); } #endregion words.Add(word); } return(words); }