public virtual SubjectObjectsTuple Process(SubsentTuple tuple, Language language, int directAndIndirectSpeechGlobalNumber , ObjectAllocateMethod objectAllocateMethod, SubjectObjectsTuple DSsubjectObjectsTuple) { #region [.condition.] var subjects = default(IEnumerable <SubjectData>); if (!IsParentMatchCondition(tuple, language, out subjects) || !IsChildMatchCondition(tuple, language)) { return(null); } #endregion //проверяем, что субъект высказывания Entity из DS остался тот же var e1 = from s1 in DSsubjectObjectsTuple.Subjects from s2 in s1.SubjectEssences select s2.Entity; var e2 = from s1 in subjects from s2 in s1.SubjectEssences select s2.Entity; if (e2.Except(e1).Any()) { return(null); } #region [.match condition.] MatchActionDebugInfoOutput(this.Id); //set 'ISSUBJECT' attribute for subject-entity subjects.SetAttributeISSUBJECTforAllEntity(directAndIndirectSpeechGlobalNumber); //set 'ISOBJECT' attribute for all object-entity var id = subjects.GetAttributeIDForce(); //allocate objects var subsents = tuple.CHILD.AfterAndSelfSubsents().ToArray(); var objects = subsents.TryAllocateObjectsInSubsents(objectAllocateMethod, id).ToArray(); //mark begin-end IndirectSpeech-subsents subsents.SetAttributeINDIRECTSPEECH_BEGINEND_4Subsents(directAndIndirectSpeechGlobalNumber); //add 2 result var v1 = from s1 in DSsubjectObjectsTuple.Subjects from s2 in s1.SubjectEssences select s2.VerbValue; var v2 = from s1 in subjects from s2 in s1.SubjectEssences select s2.VerbValue; //склеиваем название нескольких (к.п. 2-х) глаголов var verbsValues = v1.Concat(v2).Distinct().JoinBy(", "); //создем новые пары субъект высказывания Entity - название нескольких (к.п. 2-х) глаголов Verb var se = from s1 in DSsubjectObjectsTuple.Subjects from s2 in s1.SubjectEssences select new SubjectEssence(s2, verbsValues); //создем новый IEnumerable< SubjectData > subjects = new SubjectData ( se.ToList(), DSsubjectObjectsTuple.Subjects.First().LeftExtremeElement, subjects.Last().RightExtremeElement ) .RepeatOnce(); //создаем объединенный результат some-rule-DS + IS_ParentChild_DanglingParticipleAfterDS_01 return(new SubjectObjectsTuple(subjects, DSsubjectObjectsTuple.Objects.Select(o => o.Entity).Concat(objects), DSsubjectObjectsTuple.RuleId + " + " + Id)); #endregion }
public SubjectObjectsTuple Process(XElement sent, Language language, int directAndIndirectSpeechGlobalNumber, ObjectAllocateMethod objectAllocateMethod, SubjectObjectsTuple DSsubjectObjectsTuple) { var essences = GetEssence4Processing(sent); foreach (var essence in essences) { //if ( essence.IsNotHasSubject() ) //{ foreach (var rule in _Rules) { var sot = rule.Process(essence, language, directAndIndirectSpeechGlobalNumber, objectAllocateMethod, DSsubjectObjectsTuple); if (sot.IsNotNull()) { return(sot); } } //} } return(null); }