Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Commit 672f5dc

Browse files
committed
Initial commit
0 parents  commit 672f5dc

21 files changed

+3117
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target/
2+
*.iml
3+
.idea/

LICENSE

+674
Large diffs are not rendered by default.

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Annot8 CoreNLP Components
2+
3+
This project contains components for the [Annot8 Data Processing Framework](https://github.com/annot8)
4+
which use the [Stanford CoreNLP](https://stanfordnlp.github.io/CoreNLP/) libraries to perform Natural
5+
Language Processing tasks such as Named Entity Recognition and Relation extraction.
6+
7+
## Building
8+
9+
This project uses the Maven build system, and standard Maven commands such as `mvn install` can be used.
10+
11+
To build a shaded version of the Annot8 CoreNLP Components suitable for use with [Baleen 3](https://github.com/dstl/baleen3),
12+
you can run the following command:
13+
14+
```
15+
mvn -Pplugins package
16+
```
17+
18+
## Licence
19+
20+
The code in this repository is licenced under a [GPLv3 Licence](LICENSE).

pom.xml

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>uk.gov.dstl.annot8</groupId>
8+
<artifactId>annot8-corenlp</artifactId>
9+
<version>1.0.0</version>
10+
11+
<name>Annot8 CoreNLP Components</name>
12+
<description>Annot8 components using Stanford's CoreNLP library</description>
13+
14+
<licenses>
15+
<license>
16+
<name>GNU General Public License Version 3</name>
17+
<url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
18+
</license>
19+
</licenses>
20+
21+
<properties>
22+
<maven.compiler.source>11</maven.compiler.source>
23+
<maven.compiler.target>11</maven.compiler.target>
24+
25+
<annot8-api.version>1.0</annot8-api.version>
26+
<annot8-implementation.version>1.0.2</annot8-implementation.version>
27+
<corenlp.version>4.2.0</corenlp.version>
28+
29+
<junit.version>5.7.0</junit.version>
30+
31+
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
32+
</properties>
33+
34+
<dependencies>
35+
<dependency>
36+
<groupId>io.annot8</groupId>
37+
<artifactId>annot8-api</artifactId>
38+
<version>${annot8-api.version}</version>
39+
</dependency>
40+
<dependency>
41+
<groupId>io.annot8</groupId>
42+
<artifactId>annot8-common-data</artifactId>
43+
<version>${annot8-implementation.version}</version>
44+
</dependency>
45+
<dependency>
46+
<groupId>io.annot8</groupId>
47+
<artifactId>annot8-components-base-text</artifactId>
48+
<version>1.1.0</version>
49+
</dependency>
50+
<dependency>
51+
<groupId>io.annot8</groupId>
52+
<artifactId>annot8-conventions</artifactId>
53+
<version>1.1.0</version>
54+
</dependency>
55+
56+
<dependency>
57+
<groupId>edu.stanford.nlp</groupId>
58+
<artifactId>stanford-corenlp</artifactId>
59+
<version>${corenlp.version}</version>
60+
</dependency>
61+
<dependency>
62+
<groupId>edu.stanford.nlp</groupId>
63+
<artifactId>stanford-corenlp</artifactId>
64+
<version>${corenlp.version}</version>
65+
<classifier>models</classifier>
66+
</dependency>
67+
68+
<!-- Testing -->
69+
<dependency>
70+
<groupId>org.junit.jupiter</groupId>
71+
<artifactId>junit-jupiter-api</artifactId>
72+
<version>${junit.version}</version>
73+
<scope>test</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>io.annot8</groupId>
77+
<artifactId>annot8-test-impl</artifactId>
78+
<version>${annot8-implementation.version}</version>
79+
<scope>test</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.slf4j</groupId>
83+
<artifactId>slf4j-simple</artifactId>
84+
<version>1.7.30</version>
85+
<scope>test</scope>
86+
</dependency>
87+
</dependencies>
88+
89+
<profiles>
90+
<profile>
91+
<id>plugins</id>
92+
<!-- This profile is used to build JAR which contain all dependencies -->
93+
<build>
94+
<plugins>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-shade-plugin</artifactId>
98+
<version>${maven-shade-plugin.version}</version>
99+
<executions>
100+
<execution>
101+
<phase>package</phase>
102+
<goals>
103+
<goal>shade</goal>
104+
</goals>
105+
<configuration>
106+
<shadedClassifierName>plugin</shadedClassifierName>
107+
<artifactSet>
108+
<excludes>
109+
<exclude>io.annot8:annot8-api</exclude>
110+
<exclude>javax.servlet:javax.servlet-api</exclude> <!-- If not excluded, then it conflicts with Baleen 3 and prevents use -->
111+
</excludes>
112+
</artifactSet>
113+
<shadedArtifactAttached>true</shadedArtifactAttached>
114+
<filters>
115+
<filter>
116+
<!-- filter out signature files from signed dependencies, else repackaging fails with security ex -->
117+
<artifact>*:*</artifact>
118+
<excludes>
119+
<exclude>META-INF/*.SF</exclude>
120+
<exclude>META-INF/*.DSA</exclude>
121+
<exclude>META-INF/*.RSA</exclude>
122+
</excludes>
123+
</filter>
124+
</filters>
125+
</configuration>
126+
</execution>
127+
</executions>
128+
</plugin>
129+
</plugins>
130+
</build>
131+
</profile>
132+
</profiles>
133+
134+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Crown Copyright (C) 2021 Dstl
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
package uk.gov.dstl.annot8.corenlp;
18+
19+
import io.annot8.api.settings.Description;
20+
21+
import java.util.Properties;
22+
23+
public class CoreNLPSettings implements io.annot8.api.settings.Settings {
24+
25+
protected Properties properties;
26+
27+
public CoreNLPSettings(){
28+
properties = new Properties();
29+
}
30+
31+
public CoreNLPSettings(Properties properties){
32+
this.properties = properties;
33+
}
34+
35+
@Description("Properties to pass to the CoreNLP annotator (including the prefix)")
36+
public Properties getProperties() {
37+
return properties;
38+
}
39+
public void setProperties(Properties properties) {
40+
this.properties = properties;
41+
}
42+
public void addProperty(String key, String value){
43+
properties.put(key, value);
44+
}
45+
46+
@Override
47+
public boolean validate() {
48+
return properties != null;
49+
}
50+
}

0 commit comments

Comments
 (0)