public static List<PredicatePartHelperObject> Analyze(int wordId, PredicatesBFinalResults predicates, Sentence sentence) { Debug.Assert(sentence.Elements.Count > 0); if (predicates.All.Count == 0) return null; Log.InfoFormat("Запущен алгоритм поиска управляющего сказуемого для слова с Id = {0}.", wordId); var canContinue = true; var parentElement = sentence.SyntacticParent(wordId); while (canContinue) { var rootPredicates = predicates.All.FindAll(x => x.PartType == PredicatePartType.Root); if (rootPredicates.Select(x => x.Id).Contains(parentElement.Id)) return predicates.Items.Find( x => x.Find(y => y.PartType == PredicatePartType.Root).Id == parentElement.Id); parentElement = sentence.SyntacticParent(parentElement); canContinue = parentElement != null; } return null; }
public override object Clone() { var result = new PredicatesBFinalResults(); foreach (var newLo in _items.Select(loPredicate => loPredicate.Select(predicate => predicate.Clone()).ToList())) result._items.Add(newLo); return result; }