Code for batch rule extraction