1
0
mirror of https://github.com/fumiama/jieba.git synced 2026-07-01 09:30:29 +08:00

removed unecessary stateTag struct, using string instead

This commit is contained in:
Wang Bin
2015-03-25 15:13:46 +08:00
parent 1c378c28a7
commit 8687ca58b8
7 changed files with 85513 additions and 85537 deletions

View File

@@ -66,24 +66,24 @@ func (p *Posseg) cutDetailInternal(sentence string) chan WordTag {
go func() {
runes := []rune(sentence)
_, posList := viterbi(runes)
posList := viterbi(runes)
begin := 0
next := 0
for i, char := range runes {
pos := posList[i].State
switch pos {
pos := posList[i]
switch pos[0] {
case 'B':
begin = i
case 'E':
result <- WordTag{string(runes[begin : i+1]), posList[i].Tag}
result <- WordTag{string(runes[begin : i+1]), string(pos[1:])}
next = i + 1
case 'S':
result <- WordTag{string(char), posList[i].Tag}
result <- WordTag{string(char), string(pos[1:])}
next = i + 1
}
}
if next < len(runes) {
result <- WordTag{string(runes[next:]), posList[next].Tag}
result <- WordTag{string(runes[next:]), string(posList[next][1:])}
}
close(result)
}()