🐛[BugFix]fix seqeval
MEMBER
I think this is good but can you detail a bit the behavior before and after your fix?
2020-07-08T13:33:20Z
https://github.com/huggingface/datasets/pull/352#issuecomment-655522843
https://api.github.com/repos/huggingface/datasets/issues/352
MDEyOklzc3VlQ29tbWVudDY1NTUyMjg0Mw==
https://api.github.com/repos/huggingface/datasets/issues/comments/655522843/reactions
2020-07-08T13:33:20Z
https://api.github.com/repos/huggingface/datasets/issues/comments/655522843
https://avatars.githubusercontent.com/u/7353373?v=4
https://api.github.com/users/thomwolf/events{/privacy}
https://api.github.com/users/thomwolf/followers
https://api.github.com/users/thomwolf/following{/other_user}
https://api.github.com/users/thomwolf/gists{/gist_id}
https://github.com/thomwolf
thomwolf
MDQ6VXNlcjczNTMzNzM=
https://api.github.com/users/thomwolf/orgs
https://api.github.com/users/thomwolf/received_events
https://api.github.com/users/thomwolf/repos
https://api.github.com/users/thomwolf/starred{/owner}{/repo}
https://api.github.com/users/thomwolf/subscriptions
User
https://api.github.com/users/thomwolf
public
CONTRIBUTOR
examples:

input: `['B', 'I', 'I', 'O', 'B', 'I']`
before: `[('B', 0, 0), ('I', 1, 2), ('B', 4, 4), ('I', 5, 5)]`
after: `[('_', 0, 2), ('_', 4, 5)]`

input: `['B-ARGM-LOC', 'I-ARGM-LOC', 'I-ARGM-LOC', 'O', 'B-ARGM-TIME', 'I-ARGM-TIME']`
before: `[('LOC', 0, 2), ('TIME', 4, 5)]`
after: `[('ARGM-LOC', 0, 2), ('ARGM-TIME', 4, 5)]`

This is my test code:

```python
from metrics.seqeval.seqeval import end_of_chunk, start_of_chunk


def before_get_entities(seq, suffix=False):
    """Gets entities from sequence.
    Args:
        seq (list): sequence of labels.
    Returns:
        list: list of (chunk_type, chunk_start, chunk_end).
    """
    if any(isinstance(s, list) for s in seq):
        seq = [item for sublist in seq for item in sublist + ['O']]

    prev_tag = 'O'
    prev_type = ''
    begin_offset = 0
    chunks = []
    for i, chunk in enumerate(seq + ['O']):
        if suffix:
            tag = chunk[-1]
            type_ = chunk.split('-')[0]
        else:
            tag = chunk[0]
            type_ = chunk.split('-')[-1]

        if end_of_chunk(prev_tag, tag, prev_type, type_):
            chunks.append((prev_type, begin_offset, i - 1))
        if start_of_chunk(prev_tag, tag, prev_type, type_):
            begin_offset = i
        prev_tag = tag
        prev_type = type_

    return chunks


def after_get_entities(seq, suffix=False):
    """Gets entities from sequence.
    Args:
        seq (list): sequence of labels.
    Returns:
        list: list of (chunk_type, chunk_start, chunk_end).
    """
    if any(isinstance(s, list) for s in seq):
        seq = [item for sublist in seq for item in sublist + ['O']]

    prev_tag = 'O'
    prev_type = ''
    begin_offset = 0
    chunks = []
    for i, chunk in enumerate(seq + ['O']):
        if suffix:
            tag = chunk[-1]
            type_ = chunk[:-1].rsplit('-', maxsplit=1)[0] or '_'
        else:
            tag = chunk[0]
            type_ = chunk[1:].split('-', maxsplit=1)[-1] or '_'

        if end_of_chunk(prev_tag, tag, prev_type, type_):
            chunks.append((prev_type, begin_offset, i - 1))
        if start_of_chunk(prev_tag, tag, prev_type, type_):
            begin_offset = i
        prev_tag = tag
        prev_type = type_

    return chunks


def main():
    examples_1 = ['B', 'I', 'I', 'O', 'B', 'I']
    print(before_get_entities(examples_1))
    print(after_get_entities(examples_1))
    examples_2 = ['B-ARGM-LOC', 'I-ARGM-LOC', 'I-ARGM-LOC', 'O', 'B-ARGM-TIME', 'I-ARGM-TIME']
    print(before_get_entities(examples_2))
    print(after_get_entities(examples_2))


if __name__ == '__main__':
    main()
```
2020-07-08T14:22:53Z
https://github.com/huggingface/datasets/pull/352#issuecomment-655552111
https://api.github.com/repos/huggingface/datasets/issues/352
MDEyOklzc3VlQ29tbWVudDY1NTU1MjExMQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/655552111/reactions
2020-07-08T14:23:54Z
https://api.github.com/repos/huggingface/datasets/issues/comments/655552111
https://avatars.githubusercontent.com/u/20281571?v=4
https://api.github.com/users/AlongWY/events{/privacy}
https://api.github.com/users/AlongWY/followers
https://api.github.com/users/AlongWY/following{/other_user}
https://api.github.com/users/AlongWY/gists{/gist_id}
https://github.com/AlongWY
AlongWY
MDQ6VXNlcjIwMjgxNTcx
https://api.github.com/users/AlongWY/orgs
https://api.github.com/users/AlongWY/received_events
https://api.github.com/users/AlongWY/repos
https://api.github.com/users/AlongWY/starred{/owner}{/repo}
https://api.github.com/users/AlongWY/subscriptions
User
https://api.github.com/users/AlongWY
public
CONTRIBUTOR
And we can get more examples not correct, such as:

input: `['B', 'I', 'I-I']`
before: `[('B', 0, 0), ('I', 1, 2)]`
after: `[('_', 0, 1), ('I', 2, 2)]`

input: `['B-ARGM-TIME', 'I-ARGM-TIME', 'I-TIME']`
before: `[('TIME', 0, 2)]`
after: `[('ARGM-TIME', 0, 1), ('TIME', 2, 2)]`
2020-07-08T14:45:24Z
https://github.com/huggingface/datasets/pull/352#issuecomment-655565108
https://api.github.com/repos/huggingface/datasets/issues/352
MDEyOklzc3VlQ29tbWVudDY1NTU2NTEwOA==
https://api.github.com/repos/huggingface/datasets/issues/comments/655565108/reactions
2020-07-08T14:45:24Z
https://api.github.com/repos/huggingface/datasets/issues/comments/655565108
https://avatars.githubusercontent.com/u/20281571?v=4
https://api.github.com/users/AlongWY/events{/privacy}
https://api.github.com/users/AlongWY/followers
https://api.github.com/users/AlongWY/following{/other_user}
https://api.github.com/users/AlongWY/gists{/gist_id}
https://github.com/AlongWY
AlongWY
MDQ6VXNlcjIwMjgxNTcx
https://api.github.com/users/AlongWY/orgs
https://api.github.com/users/AlongWY/received_events
https://api.github.com/users/AlongWY/repos
https://api.github.com/users/AlongWY/starred{/owner}{/repo}
https://api.github.com/users/AlongWY/subscriptions
User
https://api.github.com/users/AlongWY
public
CONTRIBUTOR
I think i didn't break any thing. Maybe the checks should be restart?
2020-07-10T02:37:48Z
https://github.com/huggingface/datasets/pull/352#issuecomment-656447803
https://api.github.com/repos/huggingface/datasets/issues/352
MDEyOklzc3VlQ29tbWVudDY1NjQ0NzgwMw==
https://api.github.com/repos/huggingface/datasets/issues/comments/656447803/reactions
2020-07-10T02:37:48Z
https://api.github.com/repos/huggingface/datasets/issues/comments/656447803
https://avatars.githubusercontent.com/u/20281571?v=4
https://api.github.com/users/AlongWY/events{/privacy}
https://api.github.com/users/AlongWY/followers
https://api.github.com/users/AlongWY/following{/other_user}
https://api.github.com/users/AlongWY/gists{/gist_id}
https://github.com/AlongWY
AlongWY
MDQ6VXNlcjIwMjgxNTcx
https://api.github.com/users/AlongWY/orgs
https://api.github.com/users/AlongWY/received_events
https://api.github.com/users/AlongWY/repos
https://api.github.com/users/AlongWY/starred{/owner}{/repo}
https://api.github.com/users/AlongWY/subscriptions
User
https://api.github.com/users/AlongWY
public
MEMBER
Could you please rebase from master @AlongWY ? This should fix the CI stuff
2020-07-10T14:18:01Z
https://github.com/huggingface/datasets/pull/352#issuecomment-656700412
https://api.github.com/repos/huggingface/datasets/issues/352
MDEyOklzc3VlQ29tbWVudDY1NjcwMDQxMg==
https://api.github.com/repos/huggingface/datasets/issues/comments/656700412/reactions
2020-07-10T14:18:01Z
https://api.github.com/repos/huggingface/datasets/issues/comments/656700412
https://avatars.githubusercontent.com/u/42851186?v=4
https://api.github.com/users/lhoestq/events{/privacy}
https://api.github.com/users/lhoestq/followers
https://api.github.com/users/lhoestq/following{/other_user}
https://api.github.com/users/lhoestq/gists{/gist_id}
https://github.com/lhoestq
lhoestq
MDQ6VXNlcjQyODUxMTg2
https://api.github.com/users/lhoestq/orgs
https://api.github.com/users/lhoestq/received_events
https://api.github.com/users/lhoestq/repos
https://api.github.com/users/lhoestq/starred{/owner}{/repo}
https://api.github.com/users/lhoestq/subscriptions
User
https://api.github.com/users/lhoestq
public
CONTRIBUTOR
ok, i will do it
2020-07-15T02:59:16Z
https://github.com/huggingface/datasets/pull/352#issuecomment-658516355
https://api.github.com/repos/huggingface/datasets/issues/352
MDEyOklzc3VlQ29tbWVudDY1ODUxNjM1NQ==
https://api.github.com/repos/huggingface/datasets/issues/comments/658516355/reactions
2020-07-15T02:59:16Z
https://api.github.com/repos/huggingface/datasets/issues/comments/658516355
https://avatars.githubusercontent.com/u/20281571?v=4
https://api.github.com/users/AlongWY/events{/privacy}
https://api.github.com/users/AlongWY/followers
https://api.github.com/users/AlongWY/following{/other_user}
https://api.github.com/users/AlongWY/gists{/gist_id}
https://github.com/AlongWY
AlongWY
MDQ6VXNlcjIwMjgxNTcx
https://api.github.com/users/AlongWY/orgs
https://api.github.com/users/AlongWY/received_events
https://api.github.com/users/AlongWY/repos
https://api.github.com/users/AlongWY/starred{/owner}{/repo}
https://api.github.com/users/AlongWY/subscriptions
User
https://api.github.com/users/AlongWY
public
MEMBER
Indeed the official repo is quite stale. Let's merge it here, thanks @AlongWY 
2020-07-16T08:26:41Z
https://github.com/huggingface/datasets/pull/352#issuecomment-659246630
https://api.github.com/repos/huggingface/datasets/issues/352
MDEyOklzc3VlQ29tbWVudDY1OTI0NjYzMA==
https://api.github.com/repos/huggingface/datasets/issues/comments/659246630/reactions
2020-07-16T08:26:41Z
https://api.github.com/repos/huggingface/datasets/issues/comments/659246630
https://avatars.githubusercontent.com/u/7353373?v=4
https://api.github.com/users/thomwolf/events{/privacy}
https://api.github.com/users/thomwolf/followers
https://api.github.com/users/thomwolf/following{/other_user}
https://api.github.com/users/thomwolf/gists{/gist_id}
https://github.com/thomwolf
thomwolf
MDQ6VXNlcjczNTMzNzM=
https://api.github.com/users/thomwolf/orgs
https://api.github.com/users/thomwolf/received_events
https://api.github.com/users/thomwolf/repos
https://api.github.com/users/thomwolf/starred{/owner}{/repo}
https://api.github.com/users/thomwolf/subscriptions
User
https://api.github.com/users/thomwolf
public
Fix seqeval process labels such as 'B', 'B-ARGM-LOC'