Skip to content

Commit 199a568

Browse files
committed
Merge pull request #4 from manalishah/Viz
Visualization JSON generator added
2 parents 57fd7bf + 367cd71 commit 199a568

File tree

10 files changed

+432
-26
lines changed

10 files changed

+432
-26
lines changed

nltkrest-examples/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ target
22
.classpath
33
.settings
44
.project
5-
5+
.idea
6+
*.iml

nltkrest-examples/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,18 @@ Connecting to NLTKRest at: [http://localhost:8881/nltk]
3838
"result": "success"
3939
}
4040
```
41+
Generating JSON for comparing NLTK and CoreNLP
42+
==============================================
43+
NLTKandCoreNLP compares the results of Named Entities recognized by Stanford CoreNLP against those extracted by Tika trunk containing ability to use NLTKNeRecignizer Parser.
4144

45+
1. `java -cp target/nltkrest-examples-1.0-SNAPSHOT.jar edu.usc.ir.visualization.NLTKandCoreNLP "url/to/solr/dev" "username" "password" "path/to/destination/folder"`
46+
47+
Which should return:
48+
49+
```
50+
Json ready for Visualization: path/to/destination/folder/nltk_vs_corenlp.json
51+
```
52+
You can then follow the procedure to see a beautiful visualization using instructions from [Tika-NLTKvsCoreNLP](https://github.com/manalishah/Tika-NLTKvsCoreNLP.git)
4253

4354
Questions, comments?
4455
===================

nltkrest-examples/pom.xml

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,44 @@ the License.
4545
<url>https://github.com/manalishah/NLTKRest.git</url>
4646
<connection>scm:git:git://github.com/manalishah/NLTKRest.git</connection>
4747
</scm>
48+
<properties>
49+
<maven.compiler.target>1.7</maven.compiler.target>
50+
<maven.compiler.source>1.7</maven.compiler.source>
51+
</properties>
4852
<build>
4953
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
5054
<plugins>
55+
<plugin>
56+
<groupId>org.apache.maven.plugins</groupId>
57+
<artifactId>maven-assembly-plugin</artifactId>
58+
<version>2.3</version>
59+
<configuration>
60+
<descriptors>
61+
<descriptor>src/main/assembly/assembly.xml</descriptor>
62+
</descriptors>
63+
</configuration>
64+
</plugin>
65+
<plugin>
66+
<groupId>org.codehaus.mojo</groupId>
67+
<artifactId>animal-sniffer-maven-plugin</artifactId>
68+
<version>1.7</version>
69+
<executions>
70+
<execution>
71+
<id>signature-check</id>
72+
<phase>verify</phase>
73+
<goals>
74+
<goal>check</goal>
75+
</goals>
76+
</execution>
77+
</executions>
78+
<configuration>
79+
<signature>
80+
<groupId>org.codehaus.mojo.signature</groupId>
81+
<artifactId>java17</artifactId>
82+
<version>1.0</version>
83+
</signature>
84+
</configuration>
85+
</plugin>
5186
<plugin>
5287
<artifactId>maven-shade-plugin</artifactId>
5388
<executions>
@@ -75,7 +110,7 @@ the License.
75110
</filters>
76111
<transformers>
77112
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
78-
<mainClass>edu.usc.cs.ir.nltkrest.CXFClient</mainClass>
113+
<mainClass>edu.usc.ir.nltkrest.CXFClient</mainClass>
79114
</transformer>
80115
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
81116
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
@@ -106,29 +141,7 @@ the License.
106141
<source>1.7</source>
107142
<target>1.7</target>
108143
</configuration>
109-
</plugin>
110-
<plugin>
111-
<groupId>org.apache.maven.plugins</groupId>
112-
<artifactId>maven-enforcer-plugin</artifactId>
113-
<version>1.4.1</version>
114-
<executions>
115-
<execution>
116-
<id>enforce-java</id>
117-
<phase>validate</phase>
118-
<goals>
119-
<goal>enforce</goal>
120-
</goals>
121-
<configuration>
122-
<rules>
123-
<requireJavaVersion>
124-
<version>[1.7.0,1.8)</version>
125-
<message>Error:: Please use jdk7 for compilation.</message>
126-
</requireJavaVersion>
127-
</rules>
128-
</configuration>
129-
</execution>
130-
</executions>
131-
</plugin>
144+
</plugin>
132145
</plugins>
133146
</build>
134147
<profiles>
@@ -235,5 +248,17 @@ the License.
235248
<version>3.8.1</version>
236249
<scope>test</scope>
237250
</dependency>
251+
<dependency>
252+
<groupId>com.fasterxml.jackson.core</groupId>
253+
<artifactId>jackson-databind</artifactId>
254+
<version>2.4.4</version>
255+
</dependency>
256+
<dependency>
257+
<groupId>org.apache.tika</groupId>
258+
<artifactId>tika-app</artifactId>
259+
<version>1.13-SNAPSHOT</version>
260+
<!-- <scope>system</scope>
261+
<systemPath>/Users/manali/cs599_dr/tika/tika-app/target/tika-app-1.13-SNAPSHOT.jar</systemPath> -->
262+
</dependency>
238263
</dependencies>
239264
</project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
4+
<!-- TODO: a jarjar format would be better -->
5+
<id>jar-with-dependencies</id>
6+
<formats>
7+
<format>jar</format>
8+
</formats>
9+
<includeBaseDirectory>false</includeBaseDirectory>
10+
<dependencySets>
11+
<dependencySet>
12+
<outputDirectory>/</outputDirectory>
13+
<useProjectArtifact>true</useProjectArtifact>
14+
<unpack>true</unpack>
15+
<scope>runtime</scope>
16+
</dependencySet>
17+
</dependencySets>
18+
</assembly>

nltkrest-examples/src/main/java/edu/usc/ir/nltkrest/CXFClient.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717
package edu.usc.ir.nltkrest;
1818

19-
import javax.ws.rs.core.Form;
2019
import javax.ws.rs.core.Response;
2120
import org.apache.cxf.jaxrs.client.WebClient;
2221

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package edu.usc.ir.visualization;
18+
19+
import java.util.ArrayList;
20+
import edu.usc.ir.visualization.Series;
21+
22+
public class Labels {
23+
ArrayList<String> labels;
24+
Series[] series;
25+
public Labels(ArrayList<String> labels, Series[] series) {
26+
this.labels = labels;
27+
this.series = series;
28+
}
29+
public ArrayList<String> getLabels() {
30+
return labels;
31+
}
32+
public void setLabels(ArrayList<String> labels) {
33+
this.labels = labels;
34+
}
35+
public Series[] getSeries() {
36+
return series;
37+
}
38+
public void setSeries(Series[] series) {
39+
this.series = series;
40+
}
41+
}

0 commit comments

Comments
 (0)