-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathPOSTag_universal.go
67 lines (59 loc) · 1.31 KB
/
POSTag_universal.go
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
59
60
61
62
63
64
65
66
67
// +build !stanfordtags
package lingo
//go:generate stringer -type=POSTag -output=POSTag_universal_string.go
const BUILD_TAGSET = "universaltags"
const (
X POSTag = iota // aka NULLTAG
UNKNOWN_TAG
ROOT_TAG
ADJ
ADP
ADV
AUX
CONJ
DET
INTJ
NOUN
NUM
PART
PRON
PROPN
PUNCT
SCONJ
SYM
VERB
MAXTAG // MAXTAG is provided here as index support
)
// POSTagShortcut is a shortcut function to help the POSTagger shortcircuit some decisions about what the tag is
func POSTagShortcut(l Lexeme) (POSTag, bool) {
switch l.LexemeType {
case Number:
return NUM, true
case Punctuation:
return PUNCT, true
case Symbol:
return SYM, true
case URI:
return X, true
case Date:
return NUM, true
case Time:
return NUM, true
case EOF:
return X, true
}
return X, false
}
var Adjectives = []POSTag{ADJ}
var Nouns = []POSTag{NOUN, PROPN}
var ProperNouns = []POSTag{PROPN}
var Verbs = []POSTag{VERB}
var Adverbs = []POSTag{ADV}
var Determiners = []POSTag{DET}
var Interrogatives = []POSTag{PRON, DET, ADV}
var Numbers = []POSTag{NUM}
var Symbols = []POSTag{SYM, PUNCT}
// IsIN returns true if the POSTag is a subordinating conjunction.
// The reason why this exists is because in the stanford tag, IN is the POSTag
// while in the universal dependencies, it's the SCONJ POSTag
func IsIN(x POSTag) bool { return x == SCONJ }