public Sentence ShuffleSentence(Sentence sentence) { if (!sentence.HasModifier()) { return(sentence); } _mdSentenceDecorator = new MdSentenceDecorator(sentence); List <Text> modifiersUpToVbPastPresOrBkp; int firstModifierPosition = _mdSentenceDecorator.FirstModifierPosition; if (_mdSentenceDecorator.HasMoreThanOneModifier()) { modifiersUpToVbPastPresOrBkp = _mdSentenceDecorator.GetModifierUnitUpToVbPastPresBkp(firstModifierPosition); if (modifiersUpToVbPastPresOrBkp.Count > 1) { var mdPositions = ModifierPositionHelper.GetMDUnitPositions( modifiersUpToVbPastPresOrBkp); ReverseModifierUnit(modifiersUpToVbPastPresOrBkp, firstModifierPosition, mdPositions); AddDeParticleToMDUnit(sentence, mdPositions); UnderlineMdUnit( firstModifierPosition, _mdSentenceDecorator.Texts.Skip(firstModifierPosition).ToList().FindIndex(text => text.IsDe())); } } else // one modifier unit { modifiersUpToVbPastPresOrBkp = _mdSentenceDecorator.GetModifierUnitUpToVbPastPresBkp(firstModifierPosition); UnderlineMdUnit(firstModifierPosition, modifiersUpToVbPastPresOrBkp.Count - 1); } var textsbeforeMdUnit = TextsBefore(firstModifierPosition).ToList(); if (textsbeforeMdUnit.Any()) { ApplySearchLeftRules( sentence, textsbeforeMdUnit, firstModifierPosition, modifiersUpToVbPastPresOrBkp); } return(sentence); }
private static void MoveMdUnitAfterMdbk( Sentence sentence, MdSentenceDecorator mdSentenceDecorator, int modifierPosition, int mdbkPosition) { var mdUnit = mdSentenceDecorator.GetModifierUnitUpToVbPastPresBkp(modifierPosition); sentence.Texts.RemoveRange(modifierPosition, mdUnit.Count); sentence.Texts.InsertRange( mdbkPosition + 1 + sentence.Texts[mdbkPosition].pe_merge_ahead, mdUnit); }