Skip to content

Commit ecaaee0

Browse files
committedApr 28, 2018
Reorganize project structure
1 parent 20a9d59 commit ecaaee0

32 files changed

+524
-531
lines changed
 

‎.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Configuration
2-
config.json
3-
41
# Byte-compiled / optimized / DLL files
52
__pycache__/
63
*.py[cod]

‎evaluate.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
3-
PYTHONIOENCODING=utf-8 python3 "$DIR/neam/evaluate.py" $1 $2
3+
PYTHONIOENCODING=utf-8 python3 "$DIR/neam/python/evaluation/evaluate.py" $1 $2

‎neam/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__all__ = ['classification', 'neam']
2+
3+
from neam.python import classification, neam

‎neam/beautify.py

-92
This file was deleted.

‎neam/java/Classify.class

-931 Bytes
Binary file not shown.

‎neam/java/Classify.java

-40
This file was deleted.

‎neam/java/NEAMClassifier.class

-2.51 KB
Binary file not shown.

‎neam/java/NEAMDict.class

-958 Bytes
Binary file not shown.

‎neam/java/NEAMDict.java

-19
This file was deleted.

‎neam/java/Util.class

-1.1 KB
Binary file not shown.

‎neam/java/Util.java

-38
This file was deleted.
Binary file not shown.

‎neam/java/NEAMClassifier.java ‎neam/java/neam/clms/neam/classify/NEAMClassifier.java

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package clms.neam.classify;
2+
13
import edu.stanford.nlp.ling.*;
24
import edu.stanford.nlp.ling.CoreAnnotations.*;
35
import edu.stanford.nlp.pipeline.*;
@@ -11,7 +13,7 @@
1113
* Initialize with a CoreNLP Properties object, then call classify on a file name to
1214
* classify that file.
1315
*/
14-
class NEAMClassifier {
16+
public class NEAMClassifier {
1517

1618
/**
1719
* The CoreNLP pipeline to use to classify incoming text
@@ -21,15 +23,17 @@ class NEAMClassifier {
2123
/**
2224
* Map of Stanford tags to TEI tags
2325
*/
24-
public final NEAMDict tags = new NEAMDict();
26+
private Properties tags;
2527

2628
/**
2729
* Initializes the classifier.
2830
*
2931
* @param props CoreNLP Properties to initialize the pipeline with
32+
* @param tags
3033
*/
31-
public NEAMClassifier(Properties props) {
34+
public NEAMClassifier(Properties props, Properties tags) {
3235
pipeline = new StanfordCoreNLP(props);
36+
this.tags = tags;
3337
}
3438

3539
/**
@@ -38,8 +42,11 @@ public NEAMClassifier(Properties props) {
3842
* @param fileName The name of the file to classify
3943
* @return The text of the file, marked up with NE tags
4044
*/
41-
public String classify(String fileName) {
42-
Annotation document = new Annotation(Util.loadFile(fileName));
45+
public String classify(String text) {
46+
return classify(new Annotation(text));
47+
}
48+
49+
public String classify(Annotation document) {
4350
pipeline.annotate(document);
4451
return tagDocument(document);
4552
}
@@ -66,7 +73,7 @@ private String tagDocument(Annotation document) {
6673
phrase = namedEntity.toString();
6774

6875
if (tags.containsKey(tag)) {
69-
tag = tags.get(tag);
76+
tag = tags.getProperty(tag);
7077
}
7178

7279
// Find the location of the current phrase in the document
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
33

4-
javac "$DIR/Classify.java" -Xlint:unchecked
4+
javac "$DIR"/clms/neam/**/*.java -Xlint:unchecked

‎neam/java/run

-4
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.