首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GATE 8.0编译器问题

GATE 8.0编译器问题
EN

Stack Overflow用户
提问于 2015-05-05 01:08:14
回答 1查看 588关注 0票数 2

我一直在尝试用Groovy (使用Eclipse)构建一个简单的应用程序来调用GATE,并且偶然发现了令人困惑的编译器错误--几年前我在GATE用户身上看到过类似的问题,但是没有一个解决方案能帮我修复这个错误。

代码:

代码语言:javascript
复制
import gate.*
import gate.creole.*
import gate.creole.SerialAnalyserController
import gate.util.persistence.PersistenceManager

class AnnieExtraction {

    static main(args) {
        println "--Initializing GATE--"
        Gate.init()
        Gate.getCreoleRegister().registerDirectories(new File("C:/apps/GATE_Developer_8.0/plugins/ANNIE").toURI().toURL())
        println "--GATE initialized--"

        SerialAnalyserController pipeline = (SerialAnalyserController) Factory.createResource("gate.creole.SerialAnalyserController")
        println "--Initializing PR--"
        ProcessingResource token = (ProcessingResource) Factory.createResource("gate.creole.tokeniser.DefaultTokeniser", Factory.newFeatureMap())


    }

}

并返回错误:

代码语言:javascript
复制
Error: The type postprocessCannotActionClass4 must implement the inherited abstract method RhsAction.doit(Document, Map, AnnotationSet, AnnotationSet, Ontology) at line 10 in japeactionclasses.postprocessCannotActionClass4
Error: The type Map is not generic; it cannot be parameterized with arguments <String, AnnotationSet> at line 18 in japeactionclasses.postprocessCannotActionClass4
Error: Syntax error, parameterized types are only available if source level is 5.0 at line 18 in japeactionclasses.postprocessCannotActionClass4
Error: Type mismatch: cannot convert from Object to Annotation at line 24 in japeactionclasses.postprocessCannotActionClass4
Error: The operator + is undefined for the argument type(s) Long, long at line 31 in japeactionclasses.postprocessCannotActionClass4

The offending input was:

 1  // postprocessCannotActionClass4
 2  package japeactionclasses;
 3  import gate.*;
 4  import java.io.*;
 5  import java.util.*;
 6  import gate.util.*;
 7  import gate.jape.*;
 8  import gate.creole.ontology.*;
 9 
10  public class postprocessCannotActionClass4
11  implements java.io.Serializable, gate.jape.RhsAction {
12    private gate.jape.ActionContext ctx;
13    public java.lang.String ruleName() { return "Cannot"; }
14    public java.lang.String phaseName() { return "postprocess"; }
15    public void setActionContext(gate.jape.ActionContext ac) { ctx = ac; }
16    public gate.jape.ActionContext getActionContext() { return ctx; }
17    public void doit(gate.Document doc,
18                     java.util.Map<java.lang.String, gate.AnnotationSet> bindings,
19                     gate.AnnotationSet inputAS, gate.AnnotationSet outputAS,
20                     gate.creole.ontology.Ontology ontology) throws gate.jape.JapeException {
21      gate.AnnotationSet cannotAnnots = bindings.get("cannot");
22      if(cannotAnnots != null && cannotAnnots.size() != 0) {
23 
24    Annotation cannot = cannotAnnots.iterator().next();
25    String cannotStr = cannot.getFeatures().get("string").toString();
26    String canStr = cannotStr.substring(0,3);
27    String notStr = cannotStr.substring(3,6);
28 
29    Long start = cannot.getStartNode().getOffset();
30    Long end   = cannot.getEndNode().getOffset();
31    Long middle = start + 3L;
32 
33    /* Copy orth, &c., from the original Token;
34     * overwrite the others appropriately.  */
35    FeatureMap canFM = Factory.newFeatureMap();
36    FeatureMap notFM = Factory.newFeatureMap();
37    canFM.putAll(cannot.getFeatures());
38    notFM.putAll(cannot.getFeatures());
39 
40    canFM.put("string", canStr);
41    notFM.put("string", notStr);
42    canFM.put("length", Integer.toString(3));
43    notFM.put("length", Integer.toString(3));
44 
45    try {
46      outputAS.add(start, middle, "Token", canFM);
47      outputAS.add(middle, end, "Token", notFM);
48    }
49    catch (InvalidOffsetException e) {
50      /* This should never happen */
51      e.printStackTrace();
52    }
53 
54    outputAS.remove(cannot);
55 
56      }
57    }
58  }

我已经尝试了一系列编译器的变体,JDK版本,甚至尝试了GATE7.1而不是8.0。

目前使用的是Java版本1.7,因为我读到jasper-compiler-jdt.jar在Java 1.8上不能很好地工作。编译器版本也是1.7。

我知道问题一定与编译器jar类型有关,但它们似乎都在GATE本身和Eclipse之间匹配。GATE GUI指向正确的JDK。使用jasper编译器生成的: gate/util/compilers/eclipse/jdt/internal/compiler/env/INameEnvironment :java.lang.NoClassDefFoundError

因此,我不得不包含一个gate-compiler-jdt jars,它会产生上面的第一个错误。

据我所知,所有其余的jar文件都正确地与GATE8.0关联。谁能告诉我错误可能在哪里,或者哪组编译器是正确的?

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2017-01-07 21:57:47

正如您和Ian所说,我是通过在POM.XML中设置'gate- compiler -jdt‘的编译器版本来使用GATE 8.1工作的,方法与GATE_HOME/lib中的版本类似

代码语言:javascript
复制
'C:\Program Files\GATE_Developer_8.2\lib'
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30035844

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档