public void VerbProcessAdposition() { Assert.AreEqual(this.Verb.ExtensionsAfter.Count, 0); Assert.AreEqual(this.Verb.ExtensionsBefore.Count, 0); var adp = new Adposition(0, "adp", "_"); this.Verb.Process(adp, this.SentenceGraph); Assert.AreEqual(this.Verb.DrawableAdposition, adp); adp.DependencyType = "compound"; this.Verb.Process(adp, this.SentenceGraph); Assert.AreEqual(this.Verb.PhrasePart, adp); }
/// <summary> /// Method for creating new text elements /// </summary> /// <param name="parts">UDPipe service response line</param> /// <returns>New text element</returns> public IProcessable Create(string[] parts) { // Map known cases this.MapKnownCases(parts[2], ref parts[3]); IProcessable part = null; switch (parts[3]) { case "PROPN": case "NOUN": part = this.ProcessNoun(parts); break; case "ADJ": part = this.ProcessAdj(parts); break; case "ADP": part = new Adposition(int.Parse(parts[0]), parts[2], parts[7]); break; case "NUM": part = new Numeral(int.Parse(parts[0]), parts[2], parts[7]); break; case "VERB": part = this.ProcessVerb(parts); break; case "ADV": part = new Adverb(int.Parse(parts[0]), parts[2], parts[7]); break; case "CONJ": part = new Coordination(int.Parse(parts[0]), parts[2], parts[7]); break; case "NEG": part = new Negation(int.Parse(parts[0]), parts[2], parts[7]); break; default: break; } return(part); }
public void NounSetProcessAdposition() { this.NounSet.Nouns.ForEach(n => Assert.AreEqual(this.Noun.Adpositions.Count, 0)); var adp = new Adposition(2, "adp", "_"); this.NounSet.Process(adp, this.SentenceGraph); Assert.AreEqual(this.NounSet.Adpositions.Count, 1); Assert.AreEqual(this.NounSet.Adpositions[0], adp); this.NounSet.Adpositions.Clear(); adp.Process(new Adposition(3, "adp1", "_"), this.SentenceGraph); this.NounSet.Process(adp, this.SentenceGraph); Assert.AreEqual(this.NounSet.Adpositions.SelectMany(a => a.GetAdpositions()).Count(), 2); Assert.AreEqual(this.NounSet.Adpositions[0], adp); }