-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathNP.java
56 lines (46 loc) · 1.01 KB
/
NP.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package novels.entities;
import novels.Token;
import novels.Book;
public class NP implements Antecedent {
public int start;
public int end;
public int head;
public int gender = 0;
public int characterID=-1;
public boolean animate;
public boolean male;
public String phrase;
public String headPhrase;
public String toShortString(Book book) {
return phrase + "\t" + book.tokens.get(head).word + "\t" + gender;
}
public String toString(Book book) {
return start + "\t" + end + "\t" + phrase + "\t"
+ book.tokens.get(head).word + "\t" + animate;
}
public NP() {
phrase = "";
headPhrase = "";
}
public int getGender(Book book) {
return gender;
}
public Token getHead(Book book) {
return book.tokens.get(head);
}
public String getString(Book book) {
if (characterID == -1)
return headPhrase;
else
return book.characters[characterID].name;
}
public int getCharacterId() {
return characterID;
}
public int getStart() {
return start;
}
public int getEnd() {
return end;
}
}