ENV.defaultStringPatternFlags = 2

ner = { type: "CLASS", value: "edu.stanford.nlp.ling.CoreAnnotations$NamedEntityTagAnnotation" }
tokens = { type: "CLASS", value: "edu.stanford.nlp.ling.CoreAnnotations$TokensAnnotation" }
mytokens = { type: "CLASS", value: "edu.stanford.nlp.ling.tokensregex.demo.MyAnnotations$MyTokensAnnotation" }

$Disease = (
  /cancer/|
  /allergy/| 
  /acne/|
  /breast/ /cancer/
)

ENV.defaults["ruleType"] = "tokens"

ENV.defaults["stage"] = 1
ENV.defaultResultAnnotationKey = ner
ENV.defaultNestedResultsAnnotationKey= mytokens 
{
  pattern: ( $Disease ), 
  result: "DISEASE" 
}

ENV.defaults["ruleType"] = "composite"
{
  pattern: ( ( [ { ner:PERSON } ]) /has/ ([ { ner:DISEASE } ] ) ),
  result: Format("hasDisease(%s,%s)",$1[0].word, $2[0].word)
}
