allenai / science-parse

Science Parse parses scientific papers (in PDF form) and returns them in structured form.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception in thread "main" java.lang.NoSuchMethodError: org.allenai.common.Enum: method <init>()V not found

dax-westerman opened this issue · comments

I am wrapping this in a maven project, and I've encountered this error post model generation. Enclosed is the a copy of the main, the pom, and the error I received.

Error

09:12:37.194 [main] DEBUG o.a.p.SectionTitleExtractor$ - Number section titles detected, pruning sections titles that were not numbered
Exception in thread "main" java.lang.NoSuchMethodError: org.allenai.common.Enum: method <init>()V not found
	at org.allenai.pdffigures2.FigureType.<init>(Figure.scala:6)
	at org.allenai.pdffigures2.FigureType$Figure$.<init>(Figure.scala:9)
	at org.allenai.pdffigures2.FigureType$Figure$.<clinit>(Figure.scala)
	at org.allenai.pdffigures2.CaptionDetector$.findCaptions(CaptionDetector.scala:130)
	at org.allenai.pdffigures2.FigureExtractor.parseDocument(FigureExtractor.scala:121)
	at org.allenai.pdffigures2.FigureExtractor.getFiguresWithText(FigureExtractor.scala:52)
	at org.allenai.scienceparse.Parser.doParse(Parser.java:1147)
	at org.allenai.scienceparse.Parser.doParse(Parser.java:976)
	at [app.Main.main(Main.java:27)]

Main

package app;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import org.allenai.scienceparse.Parser;
import org.allenai.scienceparse.ExtractedMetadata;

public class Main {

	public static void main(String[] args) throws Exception {
		final String sourceFolder = "U:\\Workspaces\\techknowledgist\\example\\data\\2018\\";
		File initialFile = new File(sourceFolder + "GP-004.pdf");
	        InputStream inputStream = new FileInputStream(initialFile);
		
		String modelFile = "X:\\tools\\science-parse-wrapper\\default_datastore\\public\\org.allenai.scienceparse\\productionModel-v9.dat";
		String gazetteerFile = "X:\\tools\\science-parse-wrapper\\default_datastore\\public\\org.allenai.scienceparse\\gazetteer-v5.json";
		String bibModelFile = "X:\\tools\\science-parse-wrapper\\default_datastore\\public\\org.allenai.scienceparse\\productionBibModel-v7.dat";
		
		final Parser parser = new Parser(modelFile, gazetteerFile, bibModelFile);

		// Parse without timeout
		final ExtractedMetadata em = parser.doParse(inputStream);
		
		String result = em.toString();
	}
}

pom.xml

<?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.vanderbilt.mc.cphi.nlp</groupId>
	<artifactId>science-parse-wrapper</artifactId>
	<version>0.0.1-SNAPSHOT</version>

	<properties>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<encoding>UTF-8</encoding>
		<scala.tools.version>2.10</scala.tools.version>
		<scala.version>2.11.7</scala.version>
	</properties>

	<repositories>
		<repository>
			<id>Central Repo</id>
			<url>https://repo1.maven.org/maven2/</url>
		</repository>
		<repository>
			<id>AllenAI</id>
			<url>https://dl.bintray.com/allenai/maven/</url>
		</repository>
		<repository>
			<id>cloudera-repo-releases</id>
			<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
		</repository>
		<repository>
			<id>spring plugins</id>
			<url>https://repo.spring.io/plugins-release/</url>
		</repository>
		<repository>
			<id>Sonatype</id>
			<url>https://oss.sonatype.org/content/repositories/releases/</url>
		</repository>
	</repositories>

	<dependencies>

		<dependency>
			<groupId>org.allenai.common</groupId>
			<artifactId>common-core_2.11</artifactId>
			<version>2015.04.01-0</version>
		</dependency>

		<dependency>
			<groupId>org.allenai</groupId>
			<artifactId>pdffigures2_2.11</artifactId>
			<version>0.0.11</version>
		</dependency>

		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
			<version>2.7.9</version>
		</dependency>

		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.7.9</version>
		</dependency>

		<dependency>
			<groupId>com.fasterxml.jackson.module</groupId>
			<artifactId>jackson-module-scala_2.12</artifactId>
			<version>2.7.9</version>
		</dependency>

		<dependency>
			<groupId>org.apache.pdfbox</groupId>
			<artifactId>pdfbox</artifactId>
			<version>2.0.9</version>
			<scope>compile</scope>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.apache.pdfbox</groupId>
			<artifactId>fontbox</artifactId>
			<version>2.0.9</version>
			<scope>compile</scope>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jcl-over-slf4j</artifactId>
			<version>1.7.7</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.allenai</groupId>
			<artifactId>ml</artifactId>
			<version>0.16</version>
			<scope>compile</scope>
			<exclusions>
				<exclusion>
					<groupId>args4j</groupId>
					<artifactId>args4j</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-simple</artifactId>
				</exclusion>
			</exclusions>

		</dependency>

		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.16.20</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>com.goldmansachs</groupId>
			<artifactId>gs-collections</artifactId>
			<version>6.1.0</version>
			<scope>compile</scope>
		</dependency>

		<dependency>
			<groupId>org.scalatest</groupId>
			<artifactId>scalatest_2.11</artifactId>
			<version>2.2.1</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.testng</groupId>
			<artifactId>testng</artifactId>
			<version>6.8.1</version>
			<scope>compile</scope>
		</dependency>

		<dependency>
			<groupId>org.allenai.common</groupId>
			<artifactId>common-testkit_2.12</artifactId>
			<version>2.0.0</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.allenai.datastore</groupId>
			<artifactId>datastore_2.11</artifactId>
			<version>1.0.9</version>
		</dependency>

		<dependency>
			<groupId>org.bouncycastle</groupId>
			<artifactId>bcprov-jdk15on</artifactId>
			<version>1.54</version>
			<scope>compile</scope>
		</dependency>
		
		<dependency>
			<groupId>org.bouncycastle</groupId>
			<artifactId>bcmail-jdk15on</artifactId>
			<version>1.54</version>
			<scope>compile</scope>
		</dependency>
		
		<dependency>
			<groupId>org.bouncycastle</groupId>
			<artifactId>bcpkix-jdk15on</artifactId>
			<version>1.54</version>
			<scope>compile</scope>
		</dependency>
		
		<dependency>
			<groupId>org.jsoup</groupId>
			<artifactId>jsoup</artifactId>
			<version>1.8.1</version>
			<scope>compile</scope>
		</dependency>
		
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.4</version>
			<scope>compile</scope>
		</dependency>
		
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.4</version>
			<scope>compile</scope>
		</dependency>

		<dependency>
			<groupId>com.amazonaws</groupId>
			<artifactId>aws-java-sdk-s3</artifactId>
			<version>1.11.213</version>
			<scope>compile</scope>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>com.medallia.word2vec</groupId>
			<artifactId>word2vecjava_2.11</artifactId>
			<version>1.0-ALLENAI-4</version>
			<scope>compile</scope>
			<exclusions>
				<exclusion>
					<groupId>log4j</groupId>
					<artifactId>log4j</artifactId>
				</exclusion>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>18.0</version>
			<scope>compile</scope>
		</dependency>

		<dependency>
			<groupId>org.scala-lang.modules</groupId>
			<artifactId>scala-java8-compat_2.12</artifactId>
			<version>0.8.0</version>
		</dependency>

		<dependency>
			<groupId>org.scala-lang.modules</groupId>
			<artifactId>scala-xml_2.12</artifactId>
			<version>1.0.6</version>
		</dependency>

		<dependency>
			<groupId>org.scalaj</groupId>
			<artifactId>scalaj-http_2.12</artifactId>
			<version>2.3.0</version>
		</dependency>

		<dependency>
			<groupId>io.spray</groupId>
			<artifactId>spray-json_2.13</artifactId>
			<version>1.3.5</version>
		</dependency>

		<dependency>
			<groupId>de.ruedigermoeller</groupId>
			<artifactId>fst</artifactId>
			<version>2.47</version>
			<scope>compile</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.opennlp</groupId>
			<artifactId>opennlp-tools</artifactId>
			<version>1.7.2</version>
			<scope>compile</scope>
		</dependency>

		<dependency>
			<groupId>org.allenai.scienceparse</groupId>
			<artifactId>science-parse-core_2.11</artifactId>
			<version>3.0.0</version>
		</dependency>
				
		<dependency>
			<groupId>org.allenai.common</groupId>
			<artifactId>common-core_2.12</artifactId>
			<version>2.0.0</version>
		</dependency>
	</dependencies>
</project>