public virtual SubjectObjectsTuple Process(SubsentPair pair, Language language , ref int directAndIndirectSpeechGlobalNumber, ObjectAllocateMethod objectAllocateMethod) { #region [.condition.] SubsentsIsSwaped = false; var subjects = default(IEnumerable <SubjectData>); if (!IsSubsent2MatchCondition(pair, language) || !IsSubsent1MatchCondition(pair, language, out subjects)) { pair = pair.SwapSubsents(); SubsentsIsSwaped = true; if (!IsSubsent2MatchCondition(pair, language) || !IsSubsent1MatchCondition(pair, language, out subjects)) { return(null); } } #endregion #region [.match condition.] //allocate objects var subsents = (SubsentsIsSwaped ? pair.SUBSENT2.BeforeAndSelfSubsents() : pair.SUBSENT2.AfterAndSelfSubsents() ).ToArray(); if (subjects.HasAnySubjectEntityAncestorInAnySubsents(subsents)) { return(null); } MatchActionDebugInfoOutput(this.Id); //growup global IndirectSpeech-subsent number directAndIndirectSpeechGlobalNumber++; //set 'ISSUBJECT' attribute for subject-entity subjects.SetAttributeISSUBJECTforAllEntity(directAndIndirectSpeechGlobalNumber); //set 'ISOBJECT' attribute for all object-entity var id = subjects.GetAttributeIDForce(); var objects = subsents.TryAllocateObjectsInSubsents(objectAllocateMethod, id).ToArray(); //mark begin-end IndirectSpeech-subsents subsents.SetAttributeINDIRECTSPEECH_BEGINEND_4Subsents(directAndIndirectSpeechGlobalNumber); //add 2 result return(new SubjectObjectsTuple(subjects, objects, Id)); #endregion }
public virtual SubjectObjectsTuple Process(SubsentPair pair, Language language , ref int directAndIndirectSpeechGlobalNumber, ObjectAllocateMethod objectAllocateMethod) { #region [.condition.] SubsentsIsSwaped = false; var subjects = default(IEnumerable <SubjectData>); if (!IsSubsent1MatchCondition(pair, language, out subjects)) { pair = pair.SwapSubsents(); SubsentsIsSwaped = true; if (!IsSubsent1MatchCondition(pair, language, out subjects)) { return(null); } } #endregion #region [.match condition.] MatchActionDebugInfoOutput(this.Id); //growup global IndirectSpeech-subsent number directAndIndirectSpeechGlobalNumber++; //set 'ISSUBJECT' attribute for subject-entity subjects.SetAttributeISSUBJECTforAllEntity(directAndIndirectSpeechGlobalNumber); //set 'ISOBJECT' attribute for all object-entity var id = subjects.GetAttributeIDForce(); //allocate objects var subsent = pair.SUBSENT1; // (SubsentsIsSwaped ? pair.SUBSENT1 : pair.SUBSENT2); var objects = subsent.ElementsExceptT().TryAllocateObjectsInUnknownElements(objectAllocateMethod, id); //mark begin-end DirectSpeech-subsents subsent.Elements().SetAttributeDIRECTSPEECH_BEGINEND(directAndIndirectSpeechGlobalNumber); //add 2 result return(new SubjectObjectsTuple(subjects, objects, Id)); #endregion }