如何使用spacy或..在python中以jsonl格式(由prodigy提供)打印我的标签数据?

时间:2019-06-06 13:21:58

标签: python nlp spacy

我用prodigy注释了日期(spacy爆炸),现在我想使用spacy或..在python笔记本中查看带标签的数据。

数据格式为jsonl等
(我还有一个提供此类数据表单文本的spacy模型)

{"text":"In the Ptolemaic form, if C be the earth, A the center of the epicycle, and B Mars, CAB will not be able to be right, as CA and CB are to be made equal.","spans":[],"_input_hash":1359564022,"_task_hash":59176,"tokens":[{"text":"In","start":0,"end":2,"id":0},{"text":"the","start":3,"end":6,"id":1},{"text":"Ptolemaic","start":7,"end":16,"id":2},{"text":"form","start":17,"end":21,"id":3},{"text":",","start":21,"end":22,"id":4},{"text":"if","start":23,"end":25,"id":5},{"text":"C","start":26,"end":27,"id":6},{"text":"be","start":28,"end":30,"id":7},{"text":"the","start":31,"end":34,"id":8},{"text":"earth","start":35,"end":40,"id":9},{"text":",","start":40,"end":41,"id":10},{"text":"A","start":42,"end":43,"id":11},{"text":"the","start":44,"end":47,"id":12},{"text":"center","start":48,"end":54,"id":13},{"text":"of","start":55,"end":57,"id":14},{"text":"the","start":58,"end":61,"id":15},{"text":"epicycle","start":62,"end":70,"id":16},{"text":",","start":70,"end":71,"id":17},{"text":"and","start":72,"end":75,"id":18},{"text":"B","start":76,"end":77,"id":19},{"text":"Mars","start":78,"end":82,"id":20},{"text":",","start":82,"end":83,"id":21},{"text":"CAB","start":84,"end":87,"id":22},{"text":"will","start":88,"end":92,"id":23},{"text":"not","start":93,"end":96,"id":24},{"text":"be","start":97,"end":99,"id":25},{"text":"able","start":100,"end":104,"id":26},{"text":"to","start":105,"end":107,"id":27},{"text":"be","start":108,"end":110,"id":28},{"text":"right","start":111,"end":116,"id":29},{"text":",","start":116,"end":117,"id":30},{"text":"as","start":118,"end":120,"id":31},{"text":"CA","start":121,"end":123,"id":32},{"text":"and","start":124,"end":127,"id":33},{"text":"CB","start":128,"end":130,"id":34},{"text":"are","start":131,"end":134,"id":35},{"text":"to","start":135,"end":137,"id":36},{"text":"be","start":138,"end":140,"id":37},{"text":"made","start":141,"end":145,"id":38},{"text":"equal","start":146,"end":151,"id":39},{"text":".","start":151,"end":152,"id":40}],"answer":"accept"}
{"text":"So the anomaly of commutation2 ought to be more than 90\u00b0 or less than 270\u00b0.","spans":[],"_input_hash":1436787305,"_task_hash":247078210,"tokens":[{"text":"So","start":0,"end":2,"id":0},{"text":"the","start":3,"end":6,"id":1},{"text":"anomaly","start":7,"end":14,"id":2},{"text":"of","start":15,"end":17,"id":3},{"text":"commutation2","start":18,"end":30,"id":4},{"text":"ought","start":31,"end":36,"id":5},{"text":"to","start":37,"end":39,"id":6},{"text":"be","start":40,"end":42,"id":7},{"text":"more","start":43,"end":47,"id":8},{"text":"than","start":48,"end":52,"id":9},{"text":"90","start":53,"end":55,"id":10},{"text":"\u00b0","start":55,"end":56,"id":11},{"text":"or","start":57,"end":59,"id":12},{"text":"less","start":60,"end":64,"id":13},{"text":"than","start":65,"end":69,"id":14},{"text":"270","start":70,"end":73,"id":15},{"text":"\u00b0","start":73,"end":74,"id":16},{"text":".","start":74,"end":75,"id":17}],"answer":"accept"}
{"text":"If you wish to work a little more precisely, take from Copernicus or from an anticipation of Tycho\u2019s reformation the approximate ratio 1525:1000 as (in Copernicus) the ratio of the orbits of Mars and earth, (in Tycho) of Mars and the sun, or (in Ptolemy) of the eccentric and the epicycle.","spans":[{"start":135,"end":144,"token_start":24,"token_end":24,"label":"PARA","answer":"accept"}],"_input_hash":1467654974,"_task_hash":1024379779,"tokens":[{"text":"If","start":0,"end":2,"id":0},{"text":"you","start":3,"end":6,"id":1},{"text":"wish","start":7,"end":11,"id":2},{"text":"to","start":12,"end":14,"id":3},{"text":"work","start":15,"end":19,"id":4},{"text":"a","start":20,"end":21,"id":5},{"text":"little","start":22,"end":28,"id":6},{"text":"more","start":29,"end":33,"id":7},{"text":"precisely","start":34,"end":43,"id":8},{"text":",","start":43,"end":44,"id":9},{"text":"take","start":45,"end":49,"id":10},{"text":"from","start":50,"end":54,"id":11},{"text":"Copernicus","start":55,"end":65,"id":12},{"text":"or","start":66,"end":68,"id":13},{"text":"from","start":69,"end":73,"id":14},{"text":"an","start":74,"end":76,"id":15},{"text":"anticipation","start":77,"end":89,"id":16},{"text":"of","start":90,"end":92,"id":17},{"text":"Tycho","start":93,"end":98,"id":18},{"text":"\u2019s","start":98,"end":100,"id":19},{"text":"reformation","start":101,"end":112,"id":20},{"text":"the","start":113,"end":116,"id":21},{"text":"approximate","start":117,"end":128,"id":22},{"text":"ratio","start":129,"end":134,"id":23},{"text":"1525:1000","start":135,"end":144,"id":24},{"text":"as","start":145,"end":147,"id":25},{"text":"(","start":148,"end":149,"id":26},{"text":"in","start":149,"end":151,"id":27},{"text":"Copernicus","start":152,"end":162,"id":28},{"text":")","start":162,"end":163,"id":29},{"text":"the","start":164,"end":167,"id":30},{"text":"ratio","start":168,"end":173,"id":31},{"text":"of","start":174,"end":176,"id":32},{"text":"the","start":177,"end":180,"id":33},{"text":"orbits","start":181,"end":187,"id":34},{"text":"of","start":188,"end":190,"id":35},{"text":"Mars","start":191,"end":195,"id":36},{"text":"and","start":196,"end":199,"id":37},{"text":"earth","start":200,"end":205,"id":38},{"text":",","start":205,"end":206,"id":39},{"text":"(","start":207,"end":208,"id":40},{"text":"in","start":208,"end":210,"id":41},{"text":"Tycho","start":211,"end":216,"id":42},{"text":")","start":216,"end":217,"id":43},{"text":"of","start":218,"end":220,"id":44},{"text":"Mars","start":221,"end":225,"id":45},{"text":"and","start":226,"end":229,"id":46},{"text":"the","start":230,"end":233,"id":47},{"text":"sun","start":234,"end":237,"id":48},{"text":",","start":237,"end":238,"id":49},{"text":"or","start":239,"end":241,"id":50},{"text":"(","start":242,"end":243,"id":51},{"text":"in","start":243,"end":245,"id":52},{"text":"Ptolemy","start":246,"end":253,"id":53},{"text":")","start":253,"end":254,"id":54},{"text":"of","start":255,"end":257,"id":55},{"text":"the","start":258,"end":261,"id":56},{"text":"eccentric","start":262,"end":271,"id":57},{"text":"and","start":272,"end":275,"id":58},{"text":"the","start":276,"end":279,"id":59},{"text":"epicycle","start":280,"end":288,"id":60},{"text":".","start":288,"end":289,"id":61}],"answer":"accept"}
you see that there is a label in "span".
do you have any suggestion to have a colorful display in the notebook of labeled data?

0 个答案:

没有答案