- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从 java 上下文运行 UIMA RUTA 脚本,但出现异常。
java.lang.ArrayIndexOutOfBoundsException: -1
at org.apache.uima.ruta.parser.RutaParser.emitErrorMessage(RutaParser.java:306)
at org.apache.uima.ruta.parser.RutaParser.reportError(RutaParser.java:327)
at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(BaseRecognizer.java:613)
at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115)
at org.apache.uima.ruta.parser.RutaParser.file_input(RutaParser.java:566)
at org.apache.uima.ruta.engine.RutaEngine.loadScriptIS(RutaEngine.java:939)
在深入研究时没有其他消息,我看到了这个异常。
MissingTokenException(inserted [@-1,0:0='<missing EOF>',<-1>,15:0] at CALL)
看起来子脚本抛出异常,但相同的脚本在 UIMA 工作台中给出了正确的输出。
我在这里缺少什么?
引擎
<?xml version="1.0" encoding="UTF-8"?>
<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>true</primitive>
<annotatorImplementationName>org.apache.uima.ruta.engine.RutaEngine</annotatorImplementationName>
<analysisEngineMetaData>
<name>org.test.MainEngine</name>
<description/>
<version>1.0</version>
<vendor/>
<configurationParameters searchStrategy="language_fallback">
<configurationParameter>
<name>seeders</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>debug</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>additionalScripts</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>profile</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>debugWithMatches</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>statistics</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>additionalEngines</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>additionalExtensions</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>debugOnlyFor</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>scriptEncoding</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>additionalEngineLoaders</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>resourcePaths</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>defaultFilteredTypes</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>mainScript</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>scriptPaths</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>descriptorPaths</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>removeBasics</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>dynamicAnchoring</name>
<description>Activates dynamic anchoring (possible speed up).</description>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>greedyRuleElement</name>
<description>Activates greedy anchoring for rule elements.</description>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>greedyRule</name>
<description>Activates greedy anchoring for complete rules.</description>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>lowMemoryProfile</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>createdBy</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>simpleGreedyForComposed</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>additionalUimafitEngines</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>strictImports</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>varNames</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>varValues</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>rules</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>dictRemoveWS</name>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
<configurationParameter>
<name>reindexOnly</name>
<type>String</type>
<multiValued>true</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
</configurationParameters>
<configurationParameterSettings>
<nameValuePair>
<name>debug</name>
<value>
<boolean>false</boolean>
</value>
</nameValuePair>
<nameValuePair>
<name>profile</name>
<value>
<boolean>false</boolean>
</value>
</nameValuePair>
<nameValuePair>
<name>debugWithMatches</name>
<value>
<boolean>true</boolean>
</value>
</nameValuePair>
<nameValuePair>
<name>defaultFilteredTypes</name>
<value>
<array>
<string>org.apache.uima.ruta.type.SPACE</string>
<string>org.apache.uima.ruta.type.BREAK</string>
<string>org.apache.uima.ruta.type.MARKUP</string>
</array>
</value>
</nameValuePair>
<nameValuePair>
<name>removeBasics</name>
<value>
<boolean>false</boolean>
</value>
</nameValuePair>
<nameValuePair>
<name>seeders</name>
<value>
<array>
<string>org.apache.uima.ruta.seed.DefaultSeeder</string>
</array>
</value>
</nameValuePair>
<nameValuePair>
<name>createdBy</name>
<value>
<boolean>false</boolean>
</value>
</nameValuePair>
<nameValuePair>
<name>mainScript</name>
<value>
<string>org.test.Main</string>
</value>
</nameValuePair>
<nameValuePair>
<name>scriptPaths</name>
<value>
<array>
<string>../../scripts</string>
</array>
</value>
</nameValuePair>
<nameValuePair>
<name>descriptorPaths</name>
<value>
<array>
<string>../descriptor</string>
</array>
</value>
</nameValuePair>
<nameValuePair>
<name>resourcePaths</name>
<value>
<array>
<string>/Users/Gaurav/Documents/workspace/Paragraph/resources</string>
</array>
</value>
</nameValuePair>
<nameValuePair>
<name>additionalScripts</name>
<value>
<array>
<string>org.test.Email</string>
<!--<string>org.test.number.Number</string>
<string>org.test.Date</string>-->
<!--<string>org.test.USAAddress</string>
<string>org.test.Name</string>
<string>org.test.number.PhoneNumber</string>-->
</array>
</value>
</nameValuePair>
<nameValuePair>
<name>additionalEngines</name>
<value>
<array/>
</value>
</nameValuePair>
<nameValuePair>
<name>additionalUimafitEngines</name>
<value>
<array/>
</value>
</nameValuePair>
<nameValuePair>
<name>additionalExtensions</name>
<value>
<array>
<string>org.apache.uima.ruta.string.bool.BooleanOperationsExtension</string>
<string>org.apache.uima.ruta.string.StringOperationsExtension</string>
<string>org.apache.uima.ruta.block.OnlyFirstBlockExtension</string>
<string>org.apache.uima.ruta.block.OnlyOnceBlockExtension</string>
<string>org.apache.uima.ruta.block.fst.FSTBlockExtension</string>
</array>
</value>
</nameValuePair>
<nameValuePair>
<name>additionalEngineLoaders</name>
<value>
<array/>
</value>
</nameValuePair>
</configurationParameterSettings>
<typeSystemDescription>
<imports>
<import location="MainTypeSystem.xml"/>
</imports>
</typeSystemDescription>
<typePriorities>
<priorityList>
<type>org.apache.uima.ruta.type.RutaFrame</type>
<type>uima.tcas.Annotation</type>
<type>org.apache.uima.ruta.type.RutaBasic</type>
</priorityList>
</typePriorities>
<fsIndexCollection/>
<capabilities>
<capability>
<inputs/>
<outputs/>
<languagesSupported/>
</capability>
<capability>
<inputs>
<type>org.test.Main.Filters</type>
</inputs>
<outputs>
<type>org.test.Main.Filters</type>
</outputs>
<languagesSupported/>
</capability>
</capabilities>
<operationalProperties>
<modifiesCas>true</modifiesCas>
<multipleDeploymentAllowed>true</multipleDeploymentAllowed>
<outputsNewCASes>true</outputsNewCASes>
</operationalProperties>
</analysisEngineMetaData>
<resourceManagerConfiguration/>
</analysisEngineDescription>
脚本
PACKAGE org.test;
SCRIPT org.test.Email;
Document{->LOG("starting Processed")};
WORDLIST FiltersList = 'test/dictionaries/ValueFilters.txt';
DECLARE Filters;
DocumentAnnotation{-> MARKFAST(Filters, FiltersList)};
CALL(Email);
Document{-> ADDRETAINTYPE(MARKUP)};
最佳答案
问题已修复,Ruta 子脚本调用存在问题。
我们必须使用以下语法来调用下标
DocumentAnnotation{->CALL(Email)};
而不是
CALL(Email);
关于java - UIMA RUTA 中的数组 IndexOutOfBound 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43186949/
对于我的 CS 类,我必须编写一个从 LinkedList 扩展的 Stacks 接口(interface)。但是,我的 peek() 方法显然有一个错误。当我将其实现到我的其他程序之一时,我返回一个
每次我尝试运行此方法 private void resetOdds() { mOdds[1] = 0.10; mOdds[2] = 0.25; mOdds[3] = 0.35;
我正在学习Java语言,我正在尝试制作MasterMind游戏。我在尝试编译时收到以下错误,在尝试调试代码后,我找不到错误: Exception in thread "main" java.lang.
下面的代码旨在获取一个 byte[] 和其他一些东西(参见它提供的代码)。然后它构建一个具有一定长度的数据包并返回它。我的问题是,当我将文件读入主程序时,我需要数据报包的缓冲区为剩余要发送的字节数(如
我正在做一项作业,需要计算位置 (x,y) 周围像素的 NxN 平均值。 当我传入一个大小变量时,我试图创建一个通用函数来执行此操作。 我只允许大小或 NxN 矩阵为 3x3、5x5 或 7x7。 我
这个问题在这里已经有了答案: Captured variable in a loop in C# (10 个答案) 关闭 3 年前。 我有两个代码循环片段,后者按预期工作,而前者抛出异常。为什么 f
我正在尝试统计一个计数数组,以跟上一组 50 个选择,其中每个选择有三个选项。根据我的导师的说法,计数数组应该有 150 个元素 (3 x 50 = 150)。但我在第 55 行不断收到 IndexO
我正在尝试构建一棵区间树。在这一部分中,我必须按升序排列所有左端点,并按升序排列所有右端点,并将它们放入单点列表中(无重复)。但是,当我尝试将正确的端点合并到点列表中时,我不断收到 indexOutO
我有一个看起来像这样的文本文件: Aaaaa 0.55 2 bbb 2.1 0.25 ccccc 71 21 ..... ..
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 已关闭 7 年前。 此问题是由拼写错误或无法再重现的问题引起的。虽然类似的问题可能是 on-topic在这里
这个问题已经有答案了: What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? (25 个回答)
我正在尝试计算金字塔的最小自下而上路径总和。我正在从文本文件读取输入。 我的文本文件示例: 5 6 6 5 3 5 8 3 9 2 1 4 7 9 2 7 第一行告知程序有关金字塔的大小,其他行正在组
我收到以下错误。 Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 at ja
有人能告诉我为什么我总是收到 IndexOutOfBoundsException 吗? Cheeses 只是一个包含一组字符串的数组。Alphabets 是一个包含单个字符串变量的类。 我正在尝试编写
我正在编写一个程序,该程序读取文件,然后检查是否有相同数量的右括号和左括号。因此,我所做的是使用 FileInputStream 和 Scanner 类来读取文件并将每个字符存储在 ArrayList
我正在尝试手动引发数组的索引越界异常。我知道要抛出常规异常,我可以执行以下操作: if(x>array.length){ throw new Exception("Bad choice!"); } 但
您好,我正在为编程类(class)编写一个程序,我得到: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 18
你好,我正在尝试编写 QuickSort 代码,但我总是遇到索引越界?我的代码如下: public class QuickSort { public void quickSort(ArrayL
到目前为止,这让我很困惑。 尝试运行此特定查询时,我不断收到 CursorIndexOutOfBounds。 Cursor c = db.rawQuery("SELECT * FROM tab
所以,我正在做一项作业,让一个类(class)接收为 Conway 的 Game Of Life 设置的文本文件。我已经写了所有东西,但是很难测试,因为我的错误处理很糟糕。我已经阅读了关于 try、c
我是一名优秀的程序员,十分优秀!