D3如何做出这样效果或者还有什么别的好的方式?求解

新手上路,请多包涵

`data: {

"sentences": [{
    "text": "我在北京骑单车逛五环。",
    "words": [{
        "id": 0,
        "text": "我",
        "offset": 0,
        "length": 1,
        "roles": []
    }, {
        "id": 1,
        "text": "在",
        "offset": 1,
        "length": 1,
        "roles": []
    }, {
        "id": 2,
        "text": "北京",
        "offset": 2,
        "length": 2,
        "roles": []
    }, {
        "id": 3,
        "text": "骑",
        "offset": 4,
        "length": 1,
        "roles": [{
            "text": "我",
            "offset": 0,
            "length": 1,
            "type": "A0"
        }, {
            "text": "在北京",
            "offset": 1,
            "length": 3,
            "type": "LOC"
        }, {
            "text": "单车",
            "offset": 5,
            "length": 2,
            "type": "A1"
        }]
    }, {
        "id": 4,
        "text": "单车",
        "offset": 5,
        "length": 2,
        "roles": []
    }, {
        "id": 5,
        "text": "逛",
        "offset": 7,
        "length": 1,
        "roles": [{
            "text": "我",
            "offset": 0,
            "length": 1,
            "type": "A0"
        }, {
            "text": "在北京",
            "offset": 1,
            "length": 3,
            "type": "LOC"
        }, {
            "text": "五环",
            "offset": 8,
            "length": 2,
            "type": "A1"
        }]
    }, {
        "id": 6,
        "text": "五环",
        "offset": 8,
        "length": 2,
        "roles": []
    }, {
        "id": 7,
        "text": "。",
        "offset": 10,
        "length": 1,
        "roles": []
    }]
}]

}
}`
image.png

阅读 805
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题