我使用 gradle 配置了 heidelTime。我正在获取值,但无法迭代字符串结果。
result = heidelTime.process(sentence, new Date());
JCas cas = JCasFactory.createJCas();
FSIterator it = cas.getAnnotationIndex(Timex3.type).iterator(); // Here I am getting error
错误是由于JCasImpl.class->TOP_Type getType(int i)
if (this.casImpl.getTypeSystem().getType(typeName) == null) {
// no - report error that JCAS type was not defined in XML
// descriptor
CASRuntimeException casEx = new CASRuntimeException(
CASRuntimeException.JCAS_TYPE_NOT_IN_CAS, new String[] { typeName });
throw casEx;
}
我检查了 github 项目,我看到 HeidelTime_TypeSystem.xml 文件在那里定义类型 System。
摇篮配置
compile group: 'com.github.heideltime', name: 'heideltime', version: '2.2.1'
compile group: 'org.apache.uima', name: 'uimaj-core', version: '2.3.1'
堆栈跟踪
org.apache.uima.cas.CASRuntimeException: JCas type de.unihd.dbs.uima.types.heideltime.Timex3" used in Java code, but was not declared in the XML type descriptor.
at org.apache.uima.jcas.impl.JCasImpl.getType(JCasImpl.java:412) ~[uimaj-core-2.3.1.jar:2.3.1]
at org.apache.uima.jcas.impl.JCasImpl.getCasType(JCasImpl.java:436) ~[uimaj-core-2.3.1.jar:2.3.1]
at org.apache.uima.jcas.impl.JCasImpl.getAnnotationIndex(JCasImpl.java:1531) ~[uimaj-core-2.3.1.jar:2.3.1]
我是否需要手动添加任何文件才能使其正常工作?
types.txt 文件位置