从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相关的更广泛项目系列的一部分:
- Converter:当前项目。在
- Model:基于UD的spaCy模型(pip安装the_large_model)。当使用转换器作为spaCy管道组件时需要这个模型(因为spaCy不提供基于UD格式的模型)。在
- 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调用都可以获得以下可选参数:
Name | Type | Default | Explanation |
---|---|---|---|
enhance_ud | boolean | True | Include Stanford's EnhancedUD conversions. |
enhanced_plus_plus | boolean | True | Include Stanford's EnhancedUD++ conversions. |
enhanced_extra | boolean | True | Include BART's unique conversions. |
conv_iterations | int | inf | Stop the (defaultive) behaivor of iterating on the list of conversions after ^{ |
remove_eud_info | boolean | False | Do not include Stanford's EnhancedUD&EnhancedUD++'s extra label information. |
remove_extra_info | boolean | False | Do not include BART's extra label information. |
remove_node_adding_conversions | boolean | False | Do not include conversions that might add nodes to the given graph. |
remove_unc | boolean | False | Do not include conversions that might contain ^{ |
query_mode | boolean | False | Do not include conversions that add arcs rather than reorder arcs. |
funcs_to_cancel | ConvsCanceler class | Empty class instantiation | A list of conversions to prevent from occuring by their names. Use ^{ |
引用
如果你在研究中使用了皮巴特或巴特,请引用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是一个非盈利机构,其使命是通过高影响力的人工智能研究和工程来为人类做出贡献。 我们的队伍由约亚夫·戈德伯格、鲁特·萨尔法蒂和我自己组成。目前,我们是这个项目的贡献者,但我们将非常高兴任何人谁想帮助,通过问题和公关
- 项目
标签: