MCPcopy Create free account
hub / github.com/NJUNLP/GTS / get_aspects

Function get_aspects

code/NNModel/utils.py:9–23  ·  view source on GitHub ↗
(tags, length, ignore_index=-1)

Source from the content-addressed store, hash-verified

7
8
9def get_aspects(tags, length, ignore_index=-1):
10 spans = []
11 start = -1
12 for i in range(length):
13 if tags[i][i] == ignore_index: continue
14 elif tags[i][i] == 1:
15 if start == -1:
16 start = i
17 elif tags[i][i] != 1:
18 if start != -1:
19 spans.append([start, i - 1])
20 start = -1
21 if start != -1:
22 spans.append([start, length-1])
23 return spans
24
25
26def get_opinions(tags, length, ignore_index=-1):

Callers 2

score_aspectFunction · 0.70
score_uniontagsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected