(tags, length, ignore_index=-1)
| 7 | |
| 8 | |
| 9 | def 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 | |
| 26 | def get_opinions(tags, length, ignore_index=-1): |
no outgoing calls
no test coverage detected