@Deprecated public void setGrammarURL(URL grammar) { try { this.setGrammarURL(new ResourceReference(grammar)); } catch(URISyntaxException e) { throw new RuntimeException("Error converting URL to ResourceReference",e); } }
/** * The grammarURL parameter provides the ANNIE main.jape file as a default * for this PR. * * @param newGrammarURL */ @CreoleParameter( comment = "The URL to the grammar file.", suffixes = "jape", defaultValue = "resources/NE/main.jape" ) @Override public void setGrammarURL(ResourceReference newGrammarURL) { super.setGrammarURL(newGrammarURL); }
/** * The grammarURL parameter provides the ANNIE VerbGroups.jape file as a default * for this PR. * * @param newGrammarURL */ @CreoleParameter( comment = "The URL to the grammar file.", suffixes = "jape", defaultValue = "resources/VP/VerbGroups.jape" ) @Override public void setGrammarURL(ResourceReference newGrammarURL) { super.setGrammarURL(newGrammarURL); }
/** * Loads the specified JAPE grammar into GATE and then serializes it * into the specified file. This file can then be used to create * a new transducer instance via the <code>binaryGrammarURL</code> * init time parameter. */ public static void compile(URL jape, File ser) throws Exception { Transducer transducer = new Transducer(); transducer.setGrammarURL(new ResourceReference(jape)); transducer.setEncoding(defaultEncoding); transducer.init(); FileOutputStream out = new FileOutputStream(ser); ObjectOutputStream s = new ObjectOutputStream(out); transducer.serialize(s); s.flush(); s.close(); out.close(); }