Hi,
I think you are mixing up things. See comments inline below.
Am 10.05.2013 um 17:11 schrieb dvisser <
dale....@gmail.com>:
> I have the following dependencies defined:
>
> <dependency>
> <groupId>org.uimafit</groupId>
> <artifactId>uimafit</artifactId>
> <version>1.2.0</version>
> </dependency>
You should upgrade to 1.4.0.
> <dependency>
> <groupId>org.apache.opennlp</groupId>
> <artifactId>opennlp-uima</artifactId>
> <version>1.5.3</version>
> </dependency>
>
> This bit of code won't compile:
>
> import opennlp.tools.sentdetect.SentenceDetector;
> import org.apache.uima.analysis_component.AnalysisComponent;
> import org.apache.uima.analysis_engine.AnalysisEngine;
> import org.apache.uima.resource.ResourceInitializationException;
> import org.uimafit.factory.AnalysisEngineFactory;
> The compiler complains:
>
> [ERROR] /home/dale/Documents/git/3153/nlp/UIMAfit/src/main/java/org/ida/uimafit/SentenceDetect.java:[14,86] inconvertible types
> required: java.lang.Class<? extends org.apache.uima.analysis_component.AnalysisComponent>
> found: java.lang.Class<opennlp.tools.sentdetect.SentenceDetector>
>
> But SentenceDetector is descended from AnalysisComponent_ImplBase which implements AnalysisComponent?
opennlp.tools.sentdetect.SentenceDetector is an interface! It is not an UIMA component.
opennlp.uima.sentdetect.SentenceDetector is the one you are looking for.
> public class SentenceDetect {
>
> public SentenceDetect() throws ResourceInitializationException{
> AnalysisEngine analysisEngine = AnalysisEngineFactory.createPrimitive(
> SentenceDetector.class,
> new Object[] {"opennlp.uima.ModelName", "en-sent.bin"});
> }
> }
That is an invalid call to createPrimitive. It should be:
AnalysisEngine analysisEngine = AnalysisEngineFactory.createPrimitive(
SentenceDetector.class,
"opennlp.uima.ModelName", "en-sent.bin"
"opennlp.uima.SentenceType", "YourSentenceTypeName"
);
I am not sure, though, if that will work. You may also have to specify the "optional" parameters, in particular "opennlp.uima.ContainerType".
Once you get beyond the sentence splitter (or possibly even before!), you'll find the information on using OpenNLP components with uimaFIT on this wiki page helpful (search for OpenNLP):
https://code.google.com/p/uimafit/wiki/ExternalResources
-- Richard