CogComp / cogcomp-nlp

CogComp's Natural Language Processing Libraries and Demos: Modules include lemmatizer, ner, pos, prep-srl, quantifier, question type, relation-extraction, similarity, temporal normalizer, tokenizer, transliteration, verb-sense, and more.
http://nlp.cogcomp.org/
Other
470 stars 142 forks source link

dependency edu.illinois.cs.cogcomp:illinois-nlp-pipeline:4.0.15 not found #719

Closed eveliao closed 5 years ago

eveliao commented 5 years ago

I created a maven project. The pom.xml is :

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>edu.illinois.cs.cogcomp</groupId>
    <artifactId>illinoisDemo</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>CogcompSoftware</id>
            <name>CogcompSoftware</name>
            <url>http://cogcomp.cs.illinois.edu/m2repo/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>edu.illinois.cs.cogcomp</groupId>
            <artifactId>illinois-nlp-pipeline</artifactId>
            <version>4.0.15</version>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.20.1</version>
                    <configuration>
                        <!--increase the memory requirements if you need more space-->
                        <argLine>-Xmx16g</argLine>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

</project>

It only worked when I switched the version to 4.0.13. But with 4.0.13, the code failed to execute. Code:

import java.io.IOException;
import edu.illinois.cs.cogcomp.annotation.AnnotatorException;
import edu.illinois.cs.cogcomp.annotation.AnnotatorService;
import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation;
import edu.illinois.cs.cogcomp.pipeline.main.PipelineFactory;
import edu.illinois.cs.cogcomp.core.datastructures.ViewNames;

public class PipelineDemo {
    public static void main(String[] args) throws IOException, AnnotatorException {
        String docId = "APW-20140101.3018"; // arbitrary string identifier
        String textId = "body"; // arbitrary string identifier
        String text = "This is a test."; // contains plain text to be annotated
        AnnotatorService pipeline = PipelineFactory.buildPipeline(ViewNames.POS, ViewNames.SRL_VERB);
        TextAnnotation ta = pipeline.createAnnotatedTextAnnotation( docId, textId, text );
    }
}

The exception is:

Exception in thread "main" java.lang.NoSuchMethodError: edu.illinois.cs.cogcomp.core.datastructures.ViewNames.getAllViewNames()Ljava/util/List;
    at edu.illinois.cs.cogcomp.pipeline.main.PipelineFactory.buildPipeline(PipelineFactory.java:72)
    at edu.illinois.cs.cogcomp.pipeline.main.PipelineFactory.buildPipeline(PipelineFactory.java:189)
    at PipelineDemo.main(PipelineDemo.java:26)

Can somebody help me figure this out? Or is there any other ways to use this NLP tool(e.g. using jar)? Thx!

yxd126 commented 5 years ago

Please try: mvn clean install -DskipTest in the cogcomp-nlp folder