public Stage1(MainParts.Algorithms.Stage4Result mainPartsStage4Result, MeaningParts.Algorithms.Stage4Result meaningPartStage4Result) : base(GetAlgorithmName(), GetAlgorithmLO(), GetSourceInfoType(), GetStage()) { _result = new Stage1Result(); _meaningPartStage4Result = meaningPartStage4Result; _mainPartsStage4Result = mainPartsStage4Result; }
private void GetDependantResultsForObjectType(Sentence sentence, ObjectType objType, List<string> listOfMainIds, ref Stage1Result result) { var serviceMeaningParts = _meaningPartStage4Result.Items.Select(x => x.ServiceParts).ToList(); var serviceMainParts = _mainPartsStage4Result.Items.Select(x => x.ServiceParts).ToList(); var serviceIds = new List<string>(); foreach (var servicePart in serviceMeaningParts.Concat(serviceMainParts)) foreach (var item in servicePart) serviceIds.Add(item.Id); foreach (var word in listOfMainIds) { foreach (var item in sentence.ElementList.FindAll(x => (x.SyntacticParentWordId == word))) { if ((_meaningPartStage4Result.Items.Find(y => y.Id == item.Id) == null) && (_mainPartsStage4Result.Items.Find(y => y.Id == item.Id) == null) && !serviceIds.Contains(item.Id) ) { Stage1ResultElement addItem = new Stage1ResultElement(); addItem.CopyFromSourceWord(sentence.ElementList.Find(x => x.Id == item.Id)); addItem.ObjectType = objType; if (result.Items.Find(x => x.Id == addItem.Id) == null) result.Items.Add(addItem); } } } }