将声明式信息抽取嵌入Python流程,支持规则与自定义代码双向交互。
SpannerLib: Embedding Declarative Information Extraction in an Imperative Workflow
- 用Datalog风格规则在Python中声明信息抽取逻辑
- 规则可调用自定义Python函数(如机器学习模型)
- 适合需要灵活集成NLP模型的文本抽取开发者
文档跨度(Document spanners)作为从文本中进行声明式信息抽取(IE)的形式化框架,近年来在表达能力、复杂度以及自然结合文本分析与关系查询方面得到了深入研究。本文演示了SpannerLib——一个用于在Python代码中嵌入文档跨度的库。该库实现了基于Datalog的Spannerlog,支持规则嵌入Python代码,并可通过用户定义函数调用外部Python代码(如基于机器学习的NLP模型),实现双向交互。演示场景展示了在Jupyter Notebook中构建具有逐步复杂性的信息抽取程序,涵盖从简单模式匹配到复杂多步骤抽取的全流程。
原文摘要 · Abstract (English)
Document spanners have been proposed as a formal framework for declarative Information Extraction (IE) from text, following IE products from the industry and academia. Over the past decade, the framework has been studied thoroughly in terms of expressive power, complexity, and the ability to naturally combine text analysis with relational querying. This demonstration presents SpannerLib a library for embedding document spanners in Python code. SpannerLib facilitates the development of IE programs by providing an implementation of Spannerlog (Datalog-based documentspanners) that interacts with the Python code in two directions: rules can be embedded inside Python, and they can invoke custom Python code (e.g., calls to ML-based NLP models) via user-defined functions. The demonstration scenarios showcase IE programs, with increasing levels of complexity, within Jupyter Notebook.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。