We present lambeq, the first high-level Python library for Quantum Natural Language Processing (QNLP). The open-source toolkit offers a detailed hierarchy of modules and classes implementing all stages of a pipeline for converting sentences to string diagrams, tensor networks, and quantum circuits ready to be used on a quantum computer. lambeq supports syntactic parsing, rewriting and simplification of string diagrams, ansatz creation and manipulation, as well as a number of compositional models for preparing quantum-friendly representations of sentences, employing various degrees of syntax sensitivity. We present the generic architecture and describe the most important modules in detail, demonstrating the usage with illustrative examples. Further, we test the toolkit in practice by using it to perform a number of experiments on simple NLP tasks, implementing both classical and quantum pipelines.
翻译:开放源码工具包提供了详细的模块和班级等级,以实施将句子转换成弦图、高压网络和量子电路的管道各阶段,供量子计算机使用。 羊角工具支持对弦图进行综合分析、改写和简化,创建和操作ansatz,以及使用不同程度的通识性语言敏感度编制量子友好化的句子表述模式。 我们介绍了通用结构,并详细描述最重要的模块,用示例举例说明其使用情况。 此外,我们在实践中测试该工具包,利用它来进行一些关于简单NLP任务的实验,同时实施古典和量子管道。