private Clusters ElideStringClusters(Clusters cs, ROInvertedHistogram ih, Graph graph) { var output = new HashSet <ImmutableHashSet <AST.Address> >(); foreach (ImmutableHashSet <AST.Address> c in cs) { if (!c.All(a => EntropyModelBuilder2.AddressIsStringValued(a, ih, graph))) { output.Add(c); } } return(output.ToImmutableHashSet()); }
public void IsStringTest() { using (var app = new Application()) { using (var wb = app.OpenWorkbook(@"..\..\TestData\DataTest.xlsx")) { var p = Progress.NOPProgress(); var graph = wb.buildDependenceGraph().Worksheets[0]; var conf = (new FeatureConf()).enableShallowInputVectorMixedFullCVectorResultantOSI(true); var m = ModelBuilder.initEntropyModel(app.XLApplication(), conf, graph, p); var ih = m.InvertedHistogram; var wbname = graph.Workbook; var wsname = graph.Worksheet; var path = graph.Path; // A1 var a1_addr = AST.Address.fromA1withMode(1, "A", AST.AddressMode.Absolute, AST.AddressMode.Absolute, wsname, wbname, path); // B1 var b1_addr = AST.Address.fromA1withMode(1, "B", AST.AddressMode.Absolute, AST.AddressMode.Absolute, wsname, wbname, path); // C1 var c1_addr = AST.Address.fromA1withMode(1, "C", AST.AddressMode.Absolute, AST.AddressMode.Absolute, wsname, wbname, path); // A2 var a2_addr = AST.Address.fromA1withMode(2, "A", AST.AddressMode.Absolute, AST.AddressMode.Absolute, wsname, wbname, path); // B2 var b2_addr = AST.Address.fromA1withMode(2, "B", AST.AddressMode.Absolute, AST.AddressMode.Absolute, wsname, wbname, path); // C2 var c2_addr = AST.Address.fromA1withMode(2, "C", AST.AddressMode.Absolute, AST.AddressMode.Absolute, wsname, wbname, path); // A3 var a3_addr = AST.Address.fromA1withMode(3, "A", AST.AddressMode.Absolute, AST.AddressMode.Absolute, wsname, wbname, path); Assert.IsTrue(EntropyModelBuilder2.AddressIsStringValued(a1_addr, ih, graph)); Assert.IsTrue(EntropyModelBuilder2.AddressIsStringValued(b1_addr, ih, graph)); Assert.IsTrue(EntropyModelBuilder2.AddressIsStringValued(c1_addr, ih, graph)); Assert.IsFalse(EntropyModelBuilder2.AddressIsStringValued(a2_addr, ih, graph)); Assert.IsFalse(EntropyModelBuilder2.AddressIsStringValued(b2_addr, ih, graph)); Assert.IsFalse(EntropyModelBuilder2.AddressIsStringValued(c2_addr, ih, graph)); Assert.IsFalse(EntropyModelBuilder2.AddressIsStringValued(a3_addr, ih, graph)); } } }