-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPOSTaggedToken.java
58 lines (49 loc) · 1.44 KB
/
POSTaggedToken.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
57
58
/*
* Token with a Part-of-Speech tag and (optionally) a lemma.
*
* Copyright (C) 2013 Lisa Vitolo <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the Creative Commons
* Attribution-NonCommercial-ShareAlike 3.0 license.
* You should have received a copy of the license with this product.
* Otherwise, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
*/
public class POSTaggedToken
{
public String token;
public String tag;
public String lemma;
public POSTaggedToken(String token, String tag, String lemma)
{
this(token, tag);
this.lemma = lemma;
}
public POSTaggedToken(String token, String tag)
{
this.token = token;
this.tag = tag;
this.lemma = "";
}
public POSTaggedToken()
{
this("", "", "");
}
@Override public boolean equals(Object o)
{
if (o instanceof POSTaggedToken) {
POSTaggedToken other = (POSTaggedToken)o;
/* Case-insensitive comparison */
return (token.toLowerCase().equals(other.token.toLowerCase()) && tag.equals(other.tag));
}
return false;
}
@Override public int hashCode()
{
return (token.hashCode() + tag.hashCode());
}
@Override public String toString()
{
return token + "_" + tag + "_" + lemma;
}
}