(tags, length, ignore_index=-1)
| 24 | |
| 25 | |
| 26 | def get_opinions(tags, length, ignore_index=-1): |
| 27 | spans = [] |
| 28 | start = -1 |
| 29 | for i in range(length): |
| 30 | if tags[i][i] == ignore_index: continue |
| 31 | elif tags[i][i] == 2: |
| 32 | if start == -1: |
| 33 | start = i |
| 34 | elif tags[i][i] != 2: |
| 35 | if start != -1: |
| 36 | spans.append([start, i - 1]) |
| 37 | start = -1 |
| 38 | if start != -1: |
| 39 | spans.append([start, length-1]) |
| 40 | return spans |
| 41 | |
| 42 | |
| 43 | class Metric(): |
nothing calls this directly
no outgoing calls
no test coverage detected