module ExampleCT1 where import CTy.DSL import CTy.TestVal -- import CTy.Concretization import CTy.CRule import CTy.TCgen -- The classification tree provided by this example: -- a function to fill in class with some dummy test-value, and weigth val_ v = v %%= (Frag v, (1.1::Float)) ct :: CTree (TestVal,Float) ct = tree [color, shape, size, volume, material, inside ] where color = "Color" <== map val_ ["Red", "Blue", "Yellow", "Green", "Purple"] shape = "Shape" <== [ val_ "Circle", "4side" <== map val_ ["Square", "Rectangle"], "Triangle" <== map val_ ["Isosceles", "Equilateral", "Scalene"] ] size = "Size" <== map val_ ["Big","Small"] volume = "Volume" <== [ val_ "Pyramid", val_ "Sphere", "Cube" <== map val_ ["Dice", "Rubik"] ] material = "Material" <== [ val_ "Wood", val_ "Plastic", val_ "Rubber", "Metal" <== map val_ ["Iron", "Steel"] ] inside = "Inside" <== [val_ "Hollow", val_ "Full"] -- -- Some examples of rules -- -- #2400 fullsuite = allf ct -- #2040 r1 = rule (excl ["Blue"] &&* incl "Size" &&* incl "Shape") |+| rule (incl ["Blue"] &&* incl ["Triangle"] &&* incl ["Big"]) suite1 = ct $$ r1 >>= paddingf >>= fixorder >>= lift_ . strip2 suite1b = ct $$ r1 >>= paddingf >>= fixorder >>= wsort >>= lift_ . strip2 >>= lift_ . take 100 r5 = rule (incl ["Dice"] `norf` incl ["Circle"]) |&| rule (incl ["Rubik"] `equf` incl ["Rectangle"]) suite5 = ct $$ r5 >>= paddingf >>= fixorder >>= lift_ . strip2 suite5b = ct $$ r5 >>= paddingf >>= fixorder >>= wsort >>= lift_ . strip2 >>= lift_ . take 100 suites = [suite1,suite5] suitesSort = [suite1b,suite5b]