从UDtree到BARTgraph表示的python转换器

pybart-nlp的Python项目详细描述


改进{/str}/str{/str}>1的str{/str}>1/str}/str}/1/str}/str}/str{/str}1/str}1/str}/str{/str}1/str}/str{/str}1/str}/str}/str}/str}/str}/str{/str}1/str}/str}/str}/str}/str}/str}/str}/str。在

请参阅我们的pyBART: Evidence-based Syntactic Transformations for IE以获取有关BART的创建/语言验证/评估过程的详细描述,以及转换列表。在

本项目是与BART相关的更广泛项目系列的一部分:

  1. Converter:当前项目。在
  2. Model:基于UD的spaCy模型(pip安装the_large_model)。当使用转换器作为spaCy管道组件时需要这个模型(因为spaCy不提供基于UD格式的模型)。在
  3. Demo:Web演示使用转换器,比较UD和BART表示。在

目录

使用markdown生成目录

转换器说明

  • 将UD(v1.4)转换为BART。在
  • 支持Conll-U格式、spaCy文档和spaCy管道组件(请参见Usage)。在
  • 高度可配置(请参见Configuration)。在

注意:BART表示包含斯坦福的增强转换,这些转换被描述为here,并且已经由core-NLP Java converter实现。因此,python用户无法使用它们,因此我们将它们移植到pyBART,并尽量保持它们的行为合理。在

安装

pyBART需要python3.7或更高版本。安装pyBART的首选方法是通过pip。只需在Python环境中运行pip install pybart-nlp,就可以开始了! 如果您想使用pyBART作为spaCy管道组件,那么还应该安装:(1)spaCy包和(2)基于UD格式的spaCy模型(我们碰巧提供了这种格式)(详细信息是here

# if you want to use pyBART as a spaCy pipeline component, well,#   you need spaCy installed and a spaCy model (based on UD-format):
pip install spacy
pip install https://storage.googleapis.com/en_ud_model/en_ud_model_lg-1.1.0.tar.gz

# or if you want smaller models:#   medium: https://storage.googleapis.com/en_ud_model/en_ud_model_md-1.1.0.tar.gz#   small: https://storage.googleapis.com/en_ud_model/en_ud_model_sm-1.1.0.tar.gz# and this is us. please don't confuse with pybart/bart-py/bart
pip install pybart-nlp

使用

一旦安装了pyBART,就可以用以下方法之一使用该包。 请注意,对于这两种方法,可以使用可选参数列表调用API调用,以配置转换过程。下一步我们将详细介绍它们。在

空间管道组件

^{pr2}$

CONEHU格式<3>
frompybart.apiimportconvert_bart_conllu# read a CoNLL-U formatted filewithopen(conllu_formatted_file_in)asf:sents=f.read()# convertconverted=convert_bart_conllu(sents)# use it, probably wanting to write the textual output to a new filewithopen(conllu_formatted_file_out,"w")asf:f.write(converted)

配置

我们的每个API调用都可以获得以下可选参数:

NameTypeDefaultExplanation
enhance_udbooleanTrueInclude Stanford's EnhancedUD conversions.
enhanced_plus_plusbooleanTrueInclude Stanford's EnhancedUD++ conversions.
enhanced_extrabooleanTrueInclude BART's unique conversions.
conv_iterationsintinfStop the (defaultive) behaivor of iterating on the list of conversions after ^{} iterations, though before reaching convergance (that is, no change in graph when conversion-list is applied).
remove_eud_infobooleanFalseDo not include Stanford's EnhancedUD&EnhancedUD++'s extra label information.
remove_extra_infobooleanFalseDo not include BART's extra label information.
remove_node_adding_conversionsbooleanFalseDo not include conversions that might add nodes to the given graph.
remove_uncbooleanFalseDo not include conversions that might contain ^{} (see paper for detailed explanation).
query_modebooleanFalseDo not include conversions that add arcs rather than reorder arcs.
funcs_to_cancelConvsCanceler classEmpty class instantiationA list of conversions to prevent from occuring by their names. Use ^{} for the full conversion name list

引用

如果你在研究中使用了皮巴特或巴特,请引用pyBART: Evidence-based Syntactic Transformations for IE。在

@inproceedings{Tiktinsky2020pyBARTES,title={pyBART: Evidence-based Syntactic Transformations for IE},author={Aryeh Tiktinsky and Yoav Goldberg and Reut Tsarfaty},year={2020}}

团队

pyBART是一个开源项目,由the Allen Institute for Artificial Intelligence (AI2)支持,由Bar Ilan University作为my论文的一部分,在Yoav Goldberg的监督下。 AI2是一个非盈利机构,其使命是通过高影响力的人工智能研究和工程来为人类做出贡献。 我们的队伍由约亚夫·戈德伯格、鲁特·萨尔法蒂和我自己组成。目前,我们是这个项目的贡献者,但我们将非常高兴任何人谁想帮助,通过问题和公关

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java希望直接扫描要上传到网页的文档   java JavaFX使对象可见,但不使用(忽略)点击   java LibGdx奇怪的纹理行为   java JavaFx ComboBox在第一次单击时未获得正确的值   api WebDav服务器库最好使用Java   java在Android中维护应用程序状态   java保存在Android中拖放RecyclerView后所做的更改我已经阅读了所有内容   无法读取项目中所需库tomcatembedwebsocket的java存档,或者该存档不是有效的ZIP文件   c#类在系统中有哪些关联?如何在UML中最好地表示它们?   java如何使用bazaar访问两台计算机上的同一文件夹   Java易失性与缓存一致性   java如何解决http11。校长:例外?   java liferaymavenplugin从maven Liferay 6.2.5(6.2 ga6)部署war   安卓的jar for java在哪里。木卫一。文件   java邻接矩阵中BFS的顺序是什么?   虚拟机如何从java启动linux虚拟机?   向DefaultListModel添加元素时java JList未更新   java JMSListener批注无法与REST服务一起使用   java DirectoryStream返回路径的顺序是什么?文件名,上次修改,文件大小?   java DropWizard Hibernate doc想说什么?