private IOrderedEnumerable<SentenceWord> _compileMeaningPart(Stage4ResultElement meaningPart) { var result = new List<SentenceWord> { meaningPart }; result.AddRange(meaningPart.ServiceParts); result.AddRange(meaningPart.AddedWordsCase1); result.AddRange(meaningPart.AddedWordsCase2); return result.OrderBy(word => word.Order); }
public override void ProcessSentence(Sentence sentence) { _sentence = sentence; Debug.Assert(_stage3Result != null); // ищем частицы List<SentenceWord> particles = sentence.WordList.Where(x => x.PartOfSpeech.Value == PartOfSpeech.Particle.Value).ToList(); foreach (var itemStage3 in _stage3Result.Items) { Stage4ResultElement item = new Stage4ResultElement(); item.CopyFromSourceWord(itemStage3); SentenceWord particle; particle = particles.Find(x => x.DOM == item.Id); if (particle != null) { SentenceWord word = new SentenceWord(); word.CopyFromSourceWord(particle); if (item.Id != word.Id) item.ServiceParts.Add(word); } particle = particles.Find(x => item.ServiceParts.Select(y => y.Id).ToList().Contains(x.DOM)); if (particle != null) { SentenceWord word = new SentenceWord(); word.CopyFromSourceWord(particle); if (item.Id != word.Id) item.ServiceParts.Add(word); } particle = particles.Find(x => item.AddedWordsCase1.Concat(item.AddedWordsCase2).Select(y => y.Id).ToList().Contains(x.DOM)); if (particle != null) { SentenceWord word = new SentenceWord(); word.CopyFromSourceWord(particle); if (item.Id != word.Id) item.ServiceParts.Add(word); } Result.Items.Add(item); } }