public override bool Transform(Sentence sentence) { if (sentence.Complete()) { return(true); } bool success = false; KeyValuePair <string, string> nks = NeighborKinds(sentence); if (nks.Value == ".") { sentence.AbsorbNext(this); success = true; } if (!success && !sentence.Complete()) { string last = constituents[constituents.Count - 1].Part; if (nks.Key == "" && last == ".") { sentence.AddFirstToCompletes(); success = true; } else { sentence.Separate(this); success = true; } } return(success); }
public override bool Transform(Sentence sentence) { if (!sentence.phrases.Contains(this)) { return(false); } KeyValuePair <string, string> nks; bool success = false; bool lastFound = true; while (lastFound) { nks = NeighborKinds(sentence); if (nks.Key == "" && nks.Value == ".") { sentence.AbsorbNext(this); } else if (nks.Key == "" && nks.Value == "!") { sentence.AbsorbNext(this); } else { lastFound = false; } if (lastFound) { success = true; } } nks = NeighborKinds(sentence); if (nks.Key == "" && nks.Value == "") { return(success); } if (!success) { string last = constituents[constituents.Count - 1].Part; if (nks.Key == "" && (last == "." || last == "!")) { sentence.AddFirstToCompletes(); success = true; } else { sentence.Separate(this); success = true; } } return(success); }