public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit) { if (paragraphUnit.IsStructure || !paragraphUnit.SegmentPairs.Any()) { return; } foreach (var segmentPair in paragraphUnit.SegmentPairs) { var segmentPairInfo = new SegmentPairInfo { FileId = _fileProperties.FileConversionProperties.FileId.Id, ParagraphUnit = paragraphUnit, SegmentPair = segmentPair, ParagraphUnitId = paragraphUnit.Properties.ParagraphUnitId.Id, SegmentId = segmentPair.Properties.Id.Id }; try { segmentPairInfo.SourceWordCounts = SegmentPairProcessor.GetSegmentPairInfo(segmentPair)?.SourceWordCounts; } catch { // catch all; ignore } SegmentPairInfos.Add(segmentPairInfo); } }
public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit) { if (paragraphUnit.IsStructure) { UpdateParagraphUnit(paragraphUnit); return; } if (!paragraphUnit.SegmentPairs.Any()) { return; } var segmentPairs = new List <ISegmentPair>(); foreach (var segmentPair in paragraphUnit.SegmentPairs) { if (_subSegmentParagraphUnitIds.Contains(paragraphUnit.Properties.ParagraphUnitId.Id) || _selectedSegments.Exists(a => a.ParagraphUnitId == paragraphUnit.Properties.ParagraphUnitId.Id && a.SegmentId == segmentPair.Properties.Id.Id)) { segmentPairs.Add(segmentPair); var subSegmentParagraphUnitIds = GetSubSegmentParagraphUnitIds(segmentPair); foreach (var paragraphUnitId in subSegmentParagraphUnitIds.Where(paragraphUnitId => !_subSegmentParagraphUnitIds.Exists(a => a == paragraphUnitId))) { _subSegmentParagraphUnitIds.Add(paragraphUnitId); } var segmentPairInfo = new SegmentPairInfo { FileId = _fileProperties.FileConversionProperties.FileId.Id, ParagraphUnit = paragraphUnit, SegmentPair = segmentPair, ParagraphUnitId = paragraphUnit.Properties.ParagraphUnitId.Id, SegmentId = segmentPair.Properties.Id.Id }; try { segmentPairInfo.SourceWordCounts = SegmentPairProcessor.GetSegmentPairInfo(segmentPair)?.SourceWordCounts; } catch { // catch all; ignore } SegmentPairInfos.Add(segmentPairInfo); } } AddSegmentPairs(paragraphUnit, segmentPairs); }