Am 08.05.2013 um 13:07 schrieb harshal patni <[email protected]>:
>>> I am trying to call AnalysisEngineDescription XML
>>> files within UIMAFIT. Here is what I do..
>>>
>>> CollectionReader reader =
>>> UriCollectionReader.getCollectionReaderFromFiles(files);
>>>
>>> XMLInputSource in1 = new
>> XMLInputSource("desc/analysisenginedescription.xml"
>>> );
>>>
>>> AnalysisEngineDescription aeDesc2 =
>>> UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in1);
>>>
>>> AggregateBuilder builder = new AggregateBuilder();
>>>
>>> builder.add(aeDesc2);
>>>
>>> SimplePipeline.runPipeline(reader, builder.createAggregateDescription());
> Caused by: java.lang.NullPointerException
>
> at org.apache.uima.annotator.WhitespaceTokenizer.process(
> WhitespaceTokenizer.java:106)
No idea what happens here. The line reads (WhitespaceTokenizer 2.3.1)
char[] textContent = this.cas.getDocumentText().toCharArray();
I have created a simple test pipeline on my system reading:
CollectionReaderDescription reader =
CollectionReaderFactory.createDescription(
StringReader.class, StringReader.PARAM_TEXT, "This is a test .");
AnalysisEngineDescription tokenizer = AnalysisEngineFactory
.createAnalysisEngineDescription("WhitespaceTokenizer");
AggregateBuilder builder = new AggregateBuilder();
builder.add(tokenizer);
SimplePipeline.runPipeline(reader, builder.createAggregateDescription());
The StringReader does nothing more than create a single CAS with the text in
PARAM_TEXT
set as document text.
This appears to run without an error.
Is it possible that your reader is does not produce proper text? When I change
StringReader
to leave documentText = null, then I also get this exception:
Caused by: java.lang.NullPointerException
at
org.apache.uima.annotator.WhitespaceTokenizer.process(WhitespaceTokenizer.java:106)
-- Richard