module ExampleCT2 where import Sequenic.CTy.Types import Sequenic.CTy.Combinations -- The classification tree provided by this example: inp :: Input inp = [color,shape,size,volume,material,inside] where color :: Category color = "Color" <=== leaves ["Red", "Blue", "Yellow", "Green", "Purple"] shape :: Category shape = "Shape" <=== [Leaf "Circle",foursides,triangle] where foursides :: Partition foursides = "4side" <== leaves ["Square", "Rectangle"] triangle :: Partition triangle = "Triangle" <== leaves ["Isosceles", "Equilateral", "Scalene"] size :: Category size = "Size" <=== leaves ["Big","Small"] volume :: Category volume = "Volume" <=== leaves ["Pyramid","Sphere"] ++ [cube] where cube :: Partition cube = "Cube" <== leaves ["Dice", "Rubik"] material :: Category material = "Material" <=== leaves ["Wood", "Plastic", "Rubber"] ++ [metal] where metal :: Partition metal = "Metal" <== leaves ["Iron", "Steel"] inside :: Category inside = "Inside" <=== leaves ["Hollow", "Full"] -- -- Some examples of rules -- r1 :: Rule r1 = exclude ["Blue"] |*| (allin "Size" |*| allin "Shape") |++| include ["Blue"] |*| (include ["Triangle"] |*| include ["Big"]) -- Blue => (Triangle /\ Big) is the same as ((Not Blue)**(Size**Shape))+(Blue**(Triangle**Big)) r2 :: Rule r2 = ["Red","Blue"] `equ_` ["Square"] -- (Blue \/ Red) <=> Square r3 :: Rule r3 = include ["Triangle"] -- Triangle r4 :: Rule r4 = (["Metal"] `nor_` ["Pyramid"]) |*| include ["4side"] r5 :: Rule r5 = ["Dice"] `nor_` ["Circle"] |&&| ["Rubik"] `equ_` ["Rectangle"] rules :: [Rule] rules = [r1,r2,r3,r4,r5]