Brat注释文件到json文件转换
我是使用 brat 注释工具的新手,我想将两个注释文件“test.ann”和“train.ann”转换为 .json 文件,以便我可以在我的神经网络中使用它们。有没有专门的转换工具?我尝试过一个cli工具,但它是用GO语言编写的,我想知道是否有用Python语言编写的
I am new to using brat annotation tool and I want to convert two of my annotation files "test.ann" and "train.ann" to .json files so that I can use them in my neural network. Is there any specific conversion tool for the same? I have tried a cli tool but it's written in the GO language and I would like to know if there is any written in the Python language
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我确实写了一些东西,但主要是为了我自己,所以它没有在 PyPI 上发布,也没有很好地记录。存储库位于此处。我不认为 bratpy.json 模块支持所有可能性,但是如果您缺少某些东西,请告诉我,我会尝试解决它。但是,它会产生一种特定格式的 JSON(与 brat 可视化输入兼容),如果您需要不同的东西,最好使用低级
bratpy.annotation
模块来解析 brat 文件并自己实现转换。bratpy.annotation
实际上与我们在 brat 本身中使用的代码相同,因此它完全实现了 brat 格式。bratpy.annotation
的使用在 源文件. bratpy.json 没有任何内容,但查看源文件应该很容易推断出来 - 您将需要使用 bratpy.annotation.TextAnnotationsWithText 对象,并且从 bratpy.conf 加载的配置文件。I did write a little something, but primarily for myself, so it is not published on PyPI, or documented very well. The repo is here. I don't think the
bratpy.json
module supports all of the possibilities, but if there is something you need that is missing, tell me and I'll try to work it in. However, it produces one specific format of JSON (compatible with brat visualisation input), and if you need something different, it would be better to use the low-levelbratpy.annotation
module to parse brat files and implement the conversion yourself.bratpy.annotation
is actually the same code that we used in brat itself, so it fully implements brat format.The usage of the
bratpy.annotation
has some documentation at the top of the source file.bratpy.json
doesn't have any, but it should be easy to deduce looking at the source file — you will need to use thebratpy.annotation.TextAnnotationsWithText
object, and the configuration files loaded frombratpy.conf
.