Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gridlabel为什么这样咨询 #121

Open
wuxiaohui0 opened this issue Jun 7, 2024 · 1 comment
Open

gridlabel为什么这样咨询 #121

wuxiaohui0 opened this issue Jun 7, 2024 · 1 comment

Comments

@wuxiaohui0
Copy link

    for entity in instance["ner"]:
        index = entity["index"]
        for i in range(len(index)):
            if i + 1 >= len(index):
                break
            _grid_labels[index[i], index[i + 1]] = 1
        _grid_labels[index[-1], index[0]] = vocab.label_to_id(entity["type"])
    # _grid_labels:

    """
    [[0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
    [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]]

想问一下关于gridlabel的问题,把上三角相应的开始和结束位置设置为1,下三角设置为对应的实体类型对应的标签,这样做的目的是啥呢

@dpj135
Copy link

dpj135 commented Sep 17, 2024

原论文中是将实体标注变成实体内各个元素的关联的标注,下三角用来表示实体类别(标签值>1),上三角用来表示元素的关联(标签值为1),这样做的目的是为了建模出嵌套和非连续实体的表示

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants