🐛[BugFix]fix seqeval
{'login': 'AlongWY', 'id': 20281571, 'node_id': 'MDQ6VXNlcjIwMjgxNTcx', 'avatar_url': 'https://avatars.githubusercontent.com/u/20281571?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/AlongWY', 'html_url': 'https://github.com/AlongWY', 'followers_url': 'https://api.github.com/users/AlongWY/followers', 'following_url': 'https://api.github.com/users/AlongWY/following{/other_user}', 'gists_url': 'https://api.github.com/users/AlongWY/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/AlongWY/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/AlongWY/subscriptions', 'organizations_url': 'https://api.github.com/users/AlongWY/orgs', 'repos_url': 'https://api.github.com/users/AlongWY/repos', 'events_url': 'https://api.github.com/users/AlongWY/events{/privacy}', 'received_events_url': 'https://api.github.com/users/AlongWY/received_events', 'type': 'User', 'site_admin': False}
[]
[]
['I think this is good but can you detail a bit the behavior before and after your fix?'
 'examples:\r\n\r\ninput: `[\'B\', \'I\', \'I\', \'O\', \'B\', \'I\']`\r\nbefore: `[(\'B\', 0, 0), (\'I\', 1, 2), (\'B\', 4, 4), (\'I\', 5, 5)]`\r\nafter: `[(\'_\', 0, 2), (\'_\', 4, 5)]`\r\n\r\ninput: `[\'B-ARGM-LOC\', \'I-ARGM-LOC\', \'I-ARGM-LOC\', \'O\', \'B-ARGM-TIME\', \'I-ARGM-TIME\']`\r\nbefore: `[(\'LOC\', 0, 2), (\'TIME\', 4, 5)]`\r\nafter: `[(\'ARGM-LOC\', 0, 2), (\'ARGM-TIME\', 4, 5)]`\r\n\r\nThis is my test code:\r\n\r\n```python\r\nfrom metrics.seqeval.seqeval import end_of_chunk, start_of_chunk\r\n\r\n\r\ndef before_get_entities(seq, suffix=False):\r\n    """Gets entities from sequence.\r\n    Args:\r\n        seq (list): sequence of labels.\r\n    Returns:\r\n        list: list of (chunk_type, chunk_start, chunk_end).\r\n    """\r\n    if any(isinstance(s, list) for s in seq):\r\n        seq = [item for sublist in seq for item in sublist + [\'O\']]\r\n\r\n    prev_tag = \'O\'\r\n    prev_type = \'\'\r\n    begin_offset = 0\r\n    chunks = []\r\n    for i, chunk in enumerate(seq + [\'O\']):\r\n        if suffix:\r\n            tag = chunk[-1]\r\n            type_ = chunk.split(\'-\')[0]\r\n        else:\r\n            tag = chunk[0]\r\n            type_ = chunk.split(\'-\')[-1]\r\n\r\n        if end_of_chunk(prev_tag, tag, prev_type, type_):\r\n            chunks.append((prev_type, begin_offset, i - 1))\r\n        if start_of_chunk(prev_tag, tag, prev_type, type_):\r\n            begin_offset = i\r\n        prev_tag = tag\r\n        prev_type = type_\r\n\r\n    return chunks\r\n\r\n\r\ndef after_get_entities(seq, suffix=False):\r\n    """Gets entities from sequence.\r\n    Args:\r\n        seq (list): sequence of labels.\r\n    Returns:\r\n        list: list of (chunk_type, chunk_start, chunk_end).\r\n    """\r\n    if any(isinstance(s, list) for s in seq):\r\n        seq = [item for sublist in seq for item in sublist + [\'O\']]\r\n\r\n    prev_tag = \'O\'\r\n    prev_type = \'\'\r\n    begin_offset = 0\r\n    chunks = []\r\n    for i, chunk in enumerate(seq + [\'O\']):\r\n        if suffix:\r\n            tag = chunk[-1]\r\n            type_ = chunk[:-1].rsplit(\'-\', maxsplit=1)[0] or \'_\'\r\n        else:\r\n            tag = chunk[0]\r\n            type_ = chunk[1:].split(\'-\', maxsplit=1)[-1] or \'_\'\r\n\r\n        if end_of_chunk(prev_tag, tag, prev_type, type_):\r\n            chunks.append((prev_type, begin_offset, i - 1))\r\n        if start_of_chunk(prev_tag, tag, prev_type, type_):\r\n            begin_offset = i\r\n        prev_tag = tag\r\n        prev_type = type_\r\n\r\n    return chunks\r\n\r\n\r\ndef main():\r\n    examples_1 = [\'B\', \'I\', \'I\', \'O\', \'B\', \'I\']\r\n    print(before_get_entities(examples_1))\r\n    print(after_get_entities(examples_1))\r\n    examples_2 = [\'B-ARGM-LOC\', \'I-ARGM-LOC\', \'I-ARGM-LOC\', \'O\', \'B-ARGM-TIME\', \'I-ARGM-TIME\']\r\n    print(before_get_entities(examples_2))\r\n    print(after_get_entities(examples_2))\r\n\r\n\r\nif __name__ == \'__main__\':\r\n    main()\r\n```'
 "And we can get more examples not correct, such as:\r\n\r\ninput: `['B', 'I', 'I-I']`\r\nbefore: `[('B', 0, 0), ('I', 1, 2)]`\r\nafter: `[('_', 0, 1), ('I', 2, 2)]`\r\n\r\ninput: `['B-ARGM-TIME', 'I-ARGM-TIME', 'I-TIME']`\r\nbefore: `[('TIME', 0, 2)]`\r\nafter: `[('ARGM-TIME', 0, 1), ('TIME', 2, 2)]`"
 "I think i didn't break any thing. Maybe the checks should be restart?"
 'Could you please rebase from master @AlongWY ? This should fix the CI stuff'
 'ok, i will do it'
 "Indeed the official repo is quite stale. Let's merge it here, thanks @AlongWY "]
{'url': 'https://api.github.com/repos/huggingface/datasets/pulls/352', 'html_url': 'https://github.com/huggingface/datasets/pull/352', 'diff_url': 'https://github.com/huggingface/datasets/pull/352.diff', 'patch_url': 'https://github.com/huggingface/datasets/pull/352.patch', 'merged_at': datetime.datetime(2020, 7, 16, 8, 26, 46)}
Fix seqeval process labels such as 'B', 'B-ARGM-LOC'
{'url': 'https://api.github.com/repos/huggingface/datasets/issues/352/reactions', 'total_count': 0, '+1': 0, '-1': 0, 'laugh': 0, 'hooray': 0, 'confused': 0, 'heart': 0, 'rocket': 0, 'eyes': 0}