synyi / poplar Goto Github PK
View Code? Open in Web Editor NEWA web-based annotation tool for natural language processing (NLP)
Home Page: https://synyi.github.io/poplar/
License: GNU General Public License v3.0
A web-based annotation tool for natural language processing (NLP)
Home Page: https://synyi.github.io/poplar/
License: GNU General Public License v3.0
在Demo中选择了vanilla进行学习,发现有很多交互时间无效,这个Demo的功能是不是不太完善说明文档中的部分方法无效。
如题,测试文本如下,报如上的错误,直接渲染不出来:
双眼lpi孔通
tyn(+)
颜色可
右眼下方盘沿稍窄
右眼1级 上/下方盘沿稍窄
双眼注视眼位可
后巩膜葡萄肿
双眼外眼前节未见明显异常
相应处rnfld 左眼3级 上下方盘沿均变窄
瞳孔膜闭
双眼球突出
视盘斜入
瞳孔正常
双眼:滤过泡弥散
眼底视盘色淡
左眼盘沿形态未见明显异常
双眼高度近视眼底
左眼视盘水肿
右眼翼状胬肉
乳头+
左眼前节未见明显异常
直径6mm
眼底c/d=0.4
直径5mm
左眼1级 上/下方盘沿稍窄
色尚可
对光反射存
抵抗感(-)
右眼-
斜入
眼底窥视不清
晶体后囊轻混
眼球轻突出
瞳圆
双but< 5s
右眼晶体皮质楔形混浊
右眼rapd(+)
左眼注视
无充血
虹膜纹理清晰
左眼结膜下出血
右j4
视网膜血管细
微血管瘤
双眼黄斑区未见明显异常
瞳孔对光反射存在
双外眼未见明显异常
晶体表面色素沉着
前房深 双眼c/d=05
眼底:双眼盘沿形态未见异常
右眼上/下方盘沿稍窄
余视不清
右眼滤过弥散
左眼角膜弥漫水肿
前房轴深中深
角膜明
根切孔可见
各方向可见大量激光斑
直径2mm
右眼色淡
{"content": "The aim of the presented study was to characterize the anticonvulsant effects of levetiracetam in combination with various antiepileptic drugs (carbamazepine, phenytoin, topiramate and vigabatrin) in the mouse 6Hz psychomotor seizure model. Limbic (psychomotor) seizure activity was evoked in albino Swiss mice by a current (32mA, 6Hz, 3s stimulus duration) delivered via ocular electrodes; type II isobolographic analysis was used to characterize the consequent anticonvulsant interactions between the various drug combinations for fixed-ratios of 1:1, 1:2, 1:5 and 1:10. With type II isobolographic analysis, the combinations of levetiracetam with carbamazepine and phenytoin for the fixed-ratios of 1:5 and 1:10 were supra-additive (synergistic; P<0.01) in terms of seizure suppression, while the combinations for the fixed-ratios of 1:1 and 1:2 were additive. Levetiracetam combined with topiramate and vigabatrin for the fixed-ratio of 1:10 exerted supra-additive interaction (P<0.05), and simultaneously, the two-drug combinations for the fixed-ratios of 1:1, 1:2 and 1:5 produced additive interaction in the mouse 6Hz psychomotor seizure model. The combinations of levetiracetam with carbamazepine and phenytoin for the fixed-ratios of 1:5 and 1:10, as well as the combinations of levetiracetam with topiramate and vigabatrin for the fixed-ratio of 1:10 appear to be particularly favorable combinations exerting supra-additive interaction in the mouse 6Hz psychomotor seizure model. Finally, it may be concluded that because of the synergistic interactions between levetiracetam and carbamazepine, phenytoin, topiramate and vigabatrin, the combinations might be useful in clinical practice."}
上面为出问题的文本,上面只是出问题的一个例子。我用其中的多个部分进行测试可以正常标记,但是整体就会出错,文本区域只显示小量黑点,其他什么也没有。如下图所示:
Firefox中console的错误为:
DOMException: "Index or size is negative or greater than the allowed amount"
Chrome中的错误为:
vue.runtime.esm.js:1888 DOMException: Failed to execute 'getExtentOfChar' on 'SVGTextContentElement': The charnum provided (47) is greater than or equal to the maximum bound (47).
数据格式形如:
{
"content": "你好呀的你\n好呀的你好呀的你好呀的你好呀",
"labelCategories": [
{
"id": 0,
"text": "你好",
"color": "#eac0a2",
"borderColor": "#a38671"
}
],
"labels": [
{
"id": 0,
"categoryId": 0,
"startIndex": 4,
"endIndex": 8
}
],
"connectionCategories": [],
"connections": []
}
页面渲染“你好”的label并没有成功,并且在手动标注“你好”的时候,报错如下:
Error: Insert label across hard line is not supported now! Please remove the \n in content first!
什么时候能支持到呢?
您好,现在贵公司poplar是没打算开源吗?那synyi版本是已经开源使用了吗?感谢
连线的颜色怎么修改, 文档里没有找到相关的配置项?
我搭建了一个vue项目,然后在该项目中安装了这个工具,可是在模板中只是导入之后就会报错,想知道具体的问题出在哪里,可以帮帮我吗?(qq:1216498454)
可以设置不能重复关联吗?
两个实体关系不允许进行连接的配置,比如A不允许和B连接,也不允许和相同类型进行连接
作者您好,我运行您的demo分支代码发现一个问题,我输入一个新的文本(非样本文件)之后,进行标注,label能被添加到json文件中,但是左侧页面上确没有高亮出来,请问这个问题您能帮忙解决一下吗?看您源代码上好像加了TODO
cache的实现是否可以考虑使用一个全局的Map而不是加载class的constructor里?
1.谷歌:选中文字过程中,只有第一个文字会有高亮效果,但是标记功能是正常的
2.火狐:添加标记后,标签宽度一直是6px
看到src/Action/Label.ts
里面调用的:
apply(store: Store) {
if (store.content.slice(this.startIndex, this.endIndex).includes("\n")) {
// todo: support this?
throw Error("Insert label across hard line is not supported now! Please remove the \\n in content first!");
}
store.labelRepo.add(new LabelModel.Enthity(null, this.categoryId, this.startIndex, this.endIndex, store));
}
想问下这个换行符好不好支持啊
在使用升级的V2.0后,我的data格式如下:
{
"content": "文本内容",
"labelCategories": [
{
"id": 0,
"text": "名词",
"color": "#eac0a2",
"borderColor": "#a38671"
},
{
"id":8,
"text": "动词",
"color": "#619dff",
"borderColor": "#436db2"
},
{
"id": 2,
"text": "形容词",
"color": "#9d61ff",
"borderColor": "#6d43b2"
},
{
"id": 99,
"text": "副词",
"color": "#ff9d61",
"borderColor": "#b26d43"
}
],
"labels": [
{
"id": 0,
"categoryId": 99,
"startIndex": 0,
"endIndex": 2
},
{
"id": 1,
"categoryId": 0,
"startIndex": 3,
"endIndex": 4
}
],
"connectionCategories": [
{
"id": 0,
"text": "修饰"
},
{
"id": 1,
"text": "限定"
},
{
"id": 2,
"text": "是...的动作"
}
],
"connections": []
}
labelCategories及connectionCategories从数据库取出来的的id是乱序,并非是从0开始连续自增的,这样就会导致对label新增的时候,新增的label名称并非选中的label名,connections也是同样的。
对此我有两点问题:
1、不是很明白作者为什么要设计labelCategories及connectionCategories的id是从0开始连续自增的?
2、这样对版本迁移非常不友好呢,像我司开始用您的V1.0版本是允许labelCategories及connectionCategories的id随意的,升级V2.0版本后,若要按此规则的话,之前用V1.0版本标注的数据都不能用了呢,请问有什么解决办法吗?(目前我的办法是将后端传过来的数据labelCategories及connectionCategories的id处理成从0开始连续自增,在标注结束后,提交保存前,再对应还原数据库的labelCategories及connectionCategories的id)
package.json文件的第11行,scripts节点里面,实际的启动应该是 npm run start:dev
但readme里面写的是 npm run dev
对于我这样的小白,解决这个命令还花了点时间.
适应用户设置的字体大小
目前内容部分好像自带一定的padding,能否根据业务需求自行调节?
你好,看到poplar没有开源协议,请问下能否添加一份开源协议?
请问怎么修改行距呢,当文字字体变大时,行距太小了,影响文字显示效果
感谢开源,解决了标注的大问题,我这边主要用来提取机构
项目是放在公安网使用的,http://www.w3.org/2000/svg在内网无法访问,目前升级V2.0出现很多V1.0没有的问题,不知道是不是这个的原因,我看您把V2.0的svg.js移除换成http://www.w3.org/2000/svg了。
麻烦您看见尽快回复本人一下哦!
测试json:
{
"content": "1. Carbamazepine (CBZ) is an antiepileptic drug with narrow therapeutic window and administration in humans receiving long-term therapy with diosmin (DSN) may occur, which leads to CYP3A4-mediated drug interactions. The purpose of the present study was to assess the influence of DSN on the metabolism and pharmacokinetics of CBZ in healthy volunteers. 2. An open-label, sequential, two-period study was conducted in 12 healthy male volunteers. A single dose of DSN 500 mg was administered once daily for 10 days during treatment phase. A single dose of CBZ 200 mg was administered during control and after treatment phases under fasting conditions. The blood samples were collected after CBZ dosing at predetermined time intervals and analyzed by LC-MS/MS. 3. Treatment with DSN significantly enhanced the maximum plasma concentration (Cmax),area under the curve (AUC), half-life (t1/2) and significantly decreased the apparent oral clearance (CL/F) and elimination rate constant (Kel) of CBZ. On the other hand, treatment with DSN significantly decreased the Cmaxand AUC of carbamazepine 10, 11-epoxide (CBZE). Furthermore, treatment with DSN significantly decreased the metabolite to parent ratios of Cmaxand AUC, indicating the reduced metabolism of CBZ to CBZE. 4. The results suggest that the altered CYP3A4 enzyme activity and pharmacokinetics of CBZ might be attributed to DSN-mediated inhibition of CYP3A4 enzyme, which indicates pharmacokinetic interaction present between DSN and CBZ. Therefore, we conclude that DSN has an inhibiting effect on the metabolism and disposition of CBZ.",
"labelCategories": [
{
"id": 0,
"text": "Herb/herbal component",
"color": "#eac0a2",
"borderColor": "#8c7361"
},
{
"id": 1,
"text": "Western Drug",
"color": "#7ed321",
"borderColor": "#f8e71c"
}],
"labels": [
{
"id": 0,
"categoryId": 1,
"startIndex": "3",
"endIndex": "16"
},
{
"id": 1,
"categoryId": 1,
"startIndex": "1076",
"endIndex": "1104"
}],
"connections": [
{
"id": 0,
"categoryId": 12,
"fromId": 1,
"toId": 0
}],
"connectionCategories": [
{
"id": 12,
"text": "Metabolite of"
}]
}
上面的json载入后,就会报错:
TypeError: this.svgElement is null ConnectionView.ts:141:6
请帮忙看下,谢谢。
英文单词换行时会被强制拆开,建议换到下一行或者超过单行字符限制延长
大致异常如下: Error in v-on handler: "TypeError: Cannot read property 'svgElement' of null"
使用最新版svgjs会整体错位,具体表现在所有的annotations会上移,每往下一行偏移越多
项目中只需要使用展示功能不需要点击操作交互,如果能提供配置项禁用点击就好了
每个标签label都有对应的快捷键。选择文本后,直接按下快捷键,就对该文本进行标注了。
在升级V2.0版本后使用Action.Label.Update方法时,对于单独的label修改并不生效,若修改有connection的label,则报错TypeError: Cannot read property 'startIndex' of undefined;,根据官方demo中vue版本做了修改以此来复现该问题,请fork此链接项目,只需修改Annotate.vue文件备注部分即可。
虽然可以设置maxLineWidth来决定每行的字数
但是不同的萤幕大小所能承受的maxLineWidth是不同的,这样除了自动计算不同萤幕的maxLineWidth之外,不知道是否有更好的做法?
请问一下,这个项目怎么让它运行起来呢
Originally posted by @2638720389 in #16 (comment)
feature: relation
span multi-lines
在标注的过程中,中文中出现了小数点的情况,会导致直接换行的情况,这个能够做出合理的判断吗?
另外,现在的版本中,在chrome浏览器上,划词功能选中的高亮样式好像没有了,只能看到划词开始的位置,而并看不到划词结束的位置,这个需要怎么解决呢?
可以在vue项目中用吗?安装了那个工具,不知道怎么导入,使用,求教。
我这样用:
this.annotator.on('labelClicked', (id) => {
// 输出用户点击的label的ID
console.log(id);
});
仅仅是答应一个日志,但是为什么在鼠标左键点击标签时,还是会触犯连接标签的箭头呢?
我想要的是:用户点击标签时也不要触发连接功能,也就是完全禁止用户操作。怎么做才能达到这个要求!
如想把文字進行更新,有remove()在new Annotator()之外的方法嗎?
测试文本:
The procedure was successfully applied for the determination of carbamazepine in pharmaceutical samples, human plasma and breast milk.
然后标记procedure正常,标记“successfully” 开始位置正确,结束位置错了,“successfully”后面的词标记的开始和结束都错位了。
本地和https://synyi.github.io/poplar/#/annotate 在线测试都是同样结果。
如题
可以教我一下怎么用这个工具吗?我按照开发文档,在js中导入,然后就报错了(qq:1216498454)
今天看了下源码 poplar\src\Annotator\Store\Entities路径下的Line.ts中的第65行!!。.??"\n这里把.去掉还有第70行!!。.??”"a-zA-Z这里也把.去掉 小数点就不会换行了 demo中找到vendor.6884fc746c954a8feea5.js这个文件和源码Line.ts第65、70行相对应的地方改掉就可以了
Originally posted by @dllmm in #16 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.