Skip to content

JAPE Rule writing Guidelines


  1. Follow Initial Cap letter Syntax for all JAPE parser related keywords (Phase, Input, Options, Control, Rule etc)
  2. Follow Java Class Name Sysntax (EachWordWithCaps) for Phase, Rule and Annotation Type Names (TestPhase,TestRule, TestAnnotation)
  3. Follow Camel case convention for label names on LHS
  4. In Annotation features Map, key should be in camel case and try to keep value in smallcase, deviate from this if it is strongly required
  5. Annotation feature map should contain ruleName, phaseName without fail.
  6. On RHS side for java code follow java coding guidelines as it is.

JAPE Some useful tips


  1. Before writing rules for any pattern, please gather at least 100 samples for target pattern
  2. Place all these context patterns in single text file and run ANNIE over this.
  3. Observe features of your required pattern from Annotation Type (Token, Sentence, NE outputs etc) feature set generated by ANNIE PRS
  4. Divide Single large problem into mutiple probelms. Build rules in higherarchy manner so outputs from one step (Phase) will be use as Input to another Step (Phase). That will make rule more readable, easy to debug and it will increase performace by cutdowning the large Annotation Types (Token etc) by eliminating second level phases.
  5. Test Rule over first on 100 samples, dont write rule as hard coded it should be more generic to work on new instances as well
  6. Keep Initial Sample patterns as Test bed for future modifications impact over rul. Make Test samples as GoldenSet so you can test over these smaples in future.
  7. Once final commited rules shoul seriallize. so you can save some time while loaidng those in Application.
  8. Try to use Jape Plus for initilizinf rules if possible.