public CheckGBPrePreprocessingAlgorithm(GrammaticalBasises gbs, UniformPartsFinalResults ups)
     : base(AlgorithmProcessingType.PreProcessing,
     AlgorithmObjectType.WholeSentence,
     AlgorithmNames.PreProcessing.CheckGB,
     needPrintSourceData: false,
     needCopySentence: true)
 {
     _grammaticalBasises = gbs;
     _uniformParts = ups;
 }
Exemplo n.º 2
0
        protected override BaseSentenceAlgorithmData InitSourceData(List<BaseSentenceAlgorithm> algorithms)
        {
            GrammaticalBasises = new GrammaticalBasises();

            _fillInGOs(
                algorithms.FindHelperDataTableByAlgInternalName(AlgorithmNames.GrammaticalBasis.GrammaticalBaseStage1.InternalName),
                HelperDataGrammaticalBaseStage1PredicateId.Name,
                HelperDataGrammaticalBaseStage1SubjectId.Name);
            _fillInGOs(
                algorithms.FindHelperDataTableByAlgInternalName(AlgorithmNames.GrammaticalBasis.ParticiplePair.InternalName),
                HelperDataParticiplePairParticipleId.Name,
                HelperDataParticiplePairSubjectId.Name);
            _fillInGOs(
                algorithms.FindHelperDataTableByAlgInternalName(AlgorithmNames.GrammaticalBasis.AdverbialParticiplePair.InternalName),
                HelperDataParticiplePairAdvParticipleId.Name,
                HelperDataParticiplePairAdvParticipleSubjectId.Name);

            return new BaseSentenceAlgorithmData();
        }
        protected override void DoProcess(BaseSentenceAlgorithmData sourceData, BaseSentenceAlgorithmData result)
        {
            Debug.Assert(result.Sentence != null);
            result.HelperData = new ConjunctedGBObjectsHelperData(Info.InternalName);

            var newGBs = new GrammaticalBasises();

            var currentGBNr = 1;

            foreach (var gb in GrammaticalBasises)
            {
                var predicatesFinalResult = result.FinalResults.PredicateBFinalResults.Items;

                foreach (var loPredicate in predicatesFinalResult)
                {
                    var kso3PredicateId = PredicatesBFinalResults.KSO3PredicateId(loPredicate);
                    if (kso3PredicateId != gb.Predicate.First().Id) continue;

                    var newGB = gb.Clone();
                    newGB.Nr = currentGBNr++;
                    newGB.Predicate = loPredicate.Select(x => x.Clone()).ToList();
                    newGBs.Add(newGB);

                    result.HelperData.Rows.Add(Guid.NewGuid().ToString(), -1, newGB.Text
                        , newGB.KSOPredicate?.Id
                        , newGB.SubjectId
                        , string.Join(",", loPredicate.Select(x => x.Id))
                        , string.Join(",", loPredicate.Select(x => x.Id)) + "," + newGB.SubjectId
                        , newGB.Nr
                        );
                }
            }

            // полностью меняем все ГО, т.к. теперь работаем в том числе с ЛО Сказуемое
            GrammaticalBasises = newGBs;
        }
        protected override BaseSentenceAlgorithmData InitSourceData(List<BaseSentenceAlgorithm> algorithms)
        {
            GrammaticalBasises = ((FindConjunctedGB)algorithms.FindByInternalName(AlgorithmNames.SimpleSentencesWithNoUniformElements.FindConjunctedGB.InternalName)).GrammaticalBasises;

            return new BaseSentenceAlgorithmData();
        }
 protected override BaseSentenceAlgorithmData InitSourceData(List<BaseSentenceAlgorithm> algorithms)
 {
     GrammaticalBasises = ((AllGO)algorithms.FindByInternalName(AlgorithmNames.GrammaticalBasis.AllGO.InternalName)).GrammaticalBasises;
     return new BaseSentenceAlgorithmData();
 }
        protected override BaseSentenceAlgorithmData InitSourceData(List<BaseSentenceAlgorithm> algorithms)
        {
            GrammaticalBasises = ((MainAndSubordinatingPredicates) algorithms.FindByInternalName(AlgorithmNames.SimpleSentencesWithNoUniformElements.MainAndSubordinatingPredicates.InternalName)).GrammaticalBasises;

            return new BaseSentenceAlgorithmData();
        }