public MetaTableDescription ConstructDescription(SourceTable sourceTable, TableExtractionTask task, ITextRender logger) { //if (sourceTable[0, 0].Value.isNullOrEmpty()) //{ // sourceTable[0, 0].Value = "ID"; //} MetaTableDescription metaDescription = null; builderForText reporter = task.score.CurrentEntry().reporter; switch (task.score.executionMode) { case ExtractionTaskEngineMode.Training: SourceTableDescription sourceDesc = sourceContentAnalysis.GetDescription(sourceTable); metaDescription = new imbSCI.DataExtraction.MetaTables.Descriptors.MetaTableDescription(sourceDesc, imbSCI.DataExtraction.MetaTables.Descriptors.MetaTableFormatType.vertical); // task.tableDescription = metaDescription; //task.score.CurrentEntry().metaTableDescription = metaDescription; break; case ExtractionTaskEngineMode.Validation: default: case ExtractionTaskEngineMode.Application: if (task.tableDescription == null) { throw new Exception("Task [" + task.name + "] has no table description set."); } break; } if (folder != null) { String sp = folder.pathFor("UMTC_Construct_" + task.name + "_" + task.score.executionMode.toString() + ".txt"); File.WriteAllText(sp, reporter.GetContent()); } return(metaDescription); }
public static MetaTableDescription CompileDescription(this TableExtractionTask task, List <SourceTableDescription> sourceDescriptions) { MetaTableDescription metaDescription = null; SourceTableDescriptionAggregation aggregatedDescriptions = sourceDescriptions.CompileSourceDescription(); // new SourceTableDescriptionAggregation(); //task.score.LastEntry().aggregatedDescriptions; // List<SourceTableDescription> sourceDescriptions = task.score.TaskRuns.Where(x => x.executionMode == ExtractionTaskEngineMode.Training).Where(x => x.IsSuccess).Select(x => x.metaTableDescription.sourceDescription).ToList(); //aggregatedDescriptions.Report(report_folder, reporter); metaDescription = new imbSCI.DataExtraction.MetaTables.Descriptors.MetaTableDescription(new SourceTableDescription(), imbSCI.DataExtraction.MetaTables.Descriptors.MetaTableFormatType.unknown); metaDescription.Comment = "Created by for " + task.name; SourceTableSliceTestAggregation SelectedAsPropertyUID = null; SourceTableSliceTestAggregation SelectedAsEntryUID = null; if (aggregatedDescriptions.rowTestAggregation.IsPreferedAsPropertyUID) { SelectedAsPropertyUID = aggregatedDescriptions.rowTestAggregation; } else if (aggregatedDescriptions.columnTestAggregation.IsPreferedAsPropertyUID) { SelectedAsPropertyUID = aggregatedDescriptions.columnTestAggregation; } else if (aggregatedDescriptions.rowTestAggregation.IsSuitableAsUID) { SelectedAsPropertyUID = aggregatedDescriptions.rowTestAggregation; } else if (aggregatedDescriptions.columnTestAggregation.IsSuitableAsUID) { SelectedAsPropertyUID = aggregatedDescriptions.columnTestAggregation; } else if (aggregatedDescriptions.rowTestAggregation.IsAcceptableAsPropertyUID) { SelectedAsPropertyUID = aggregatedDescriptions.rowTestAggregation; } else if (aggregatedDescriptions.columnTestAggregation.IsAcceptableAsPropertyUID) { SelectedAsPropertyUID = aggregatedDescriptions.columnTestAggregation; } if (SelectedAsPropertyUID == null) { metaDescription.index_propertyID = -1; } else { if (aggregatedDescriptions.rowTestAggregation == SelectedAsPropertyUID) { SelectedAsEntryUID = aggregatedDescriptions.columnTestAggregation; } else if (aggregatedDescriptions.columnTestAggregation == SelectedAsPropertyUID) { SelectedAsEntryUID = aggregatedDescriptions.rowTestAggregation; } } if (SelectedAsEntryUID != null) { if (SelectedAsEntryUID.IsDistinctValue) { } else { SelectedAsEntryUID = null; metaDescription.index_entryID = -1; } } if (SelectedAsEntryUID != null) { metaDescription.entrySource = SelectedAsEntryUID.format; metaDescription.index_entryID = 0; } if (SelectedAsPropertyUID != null) { metaDescription.propertySource = SelectedAsPropertyUID.format; metaDescription.index_propertyID = 0; } if (metaDescription.propertySource == SourceTableSliceType.undefined) { if (aggregatedDescriptions.sourceWidth.Range <= aggregatedDescriptions.sourceHeight.Range) { metaDescription.propertySource = SourceTableSliceType.column; } else if (aggregatedDescriptions.sourceWidth.Range > aggregatedDescriptions.sourceHeight.Range) { metaDescription.propertySource = SourceTableSliceType.row; } } if (metaDescription.entrySource == SourceTableSliceType.undefined) { switch (metaDescription.propertySource) { default: break; case SourceTableSliceType.column: metaDescription.entrySource = SourceTableSliceType.row; break; case SourceTableSliceType.row: metaDescription.entrySource = SourceTableSliceType.column; break; } } switch (metaDescription.propertySource) { default: break; case SourceTableSliceType.column: metaDescription.sourceDescription.valueZone.y = 0; // metaDescription.index_propertyID + 1; metaDescription.sourceDescription.valueZone.x = 0; //metaDescription.index_entryID + 1; // metaDescription.IsTransposed = true; // metaDescription.entrySource = SourceTableSliceType.row; metaDescription.format = MetaTableFormatType.vertical; break; case SourceTableSliceType.row: // metaDescription.entrySource = SourceTableSliceType.column; metaDescription.format = MetaTableFormatType.horizontal; metaDescription.sourceDescription.valueZone.x = 0; // metaDescription.index_propertyID + 1; metaDescription.sourceDescription.valueZone.y = 0; // metaDescription.index_entryID + 1; break; } // metaDescription.Report(report_folder, reporter); return(metaDescription); }