Giter VIP home page Giter VIP logo

lambeq's Introduction

lambeq

lambeq logo

Build status License PyPI version PyPI downloads arXiv

About

lambeq is a toolkit for quantum natural language processing (QNLP).


Note: Please do not try to read the documentation directly from the preview provided in the repository, since some of the pages will not be rendered properly.


Getting started

Prerequisites

  • Python 3.9+

Installation

lambeq can be installed with the command:

pip install lambeq

The default installation of lambeq includes Bobcat parser, a state-of-the-art statistical parser (see related paper) fully integrated with the toolkit.

To install lambeq with optional dependencies for extra features, run:

pip install lambeq[extras]

To enable DepCCG support, you will need to install the external parser separately.


Note: The DepCCG-related functionality is no longer actively supported in lambeq, and may not work as expected. We strongly recommend using the default Bobcat parser which comes as part of lambeq.


If you still want to use DepCCG, for example because you plan to apply lambeq on Japanese, you can install DepCCG separately following the instructions on the DepCCG homepage. After installing DepCCG, you can download its model by using the script provided in the contrib folder of this repository:

python contrib/download_depccg_model.py

Usage

The docs/examples directory contains notebooks demonstrating usage of the various tools in lambeq.

Example - parsing a sentence into a diagram (see docs/examples/ccg2discocat.ipynb):

from lambeq import BobcatParser

parser = BobcatParser()
diagram = parser.sentence2diagram('This is a test sentence')
diagram.draw()

Testing

Run all tests with the command:

pytest

Note: if you have installed in a virtual environment, remember to install pytest in the same environment using pip.

Building documentation

To build the documentation, first install the required dependencies:

pip install -r docs/requirements.txt

then run the commands:

cd docs
make clean
make html

the docs will be under docs/_build.

License

Distributed under the Apache 2.0 license. See LICENSE for more details.

Citation

If you wish to attribute our work, please cite the accompanying paper:

@article{kartsaklis2021lambeq,
   title={lambeq: {A}n {E}fficient {H}igh-{L}evel {P}ython {L}ibrary for {Q}uantum {NLP}},
   author={Dimitri Kartsaklis and Ian Fan and Richie Yeung and Anna Pearson and Robin Lorenz and Alexis Toumi and Giovanni de Felice and Konstantinos Meichanetzidis and Stephen Clark and Bob Coecke},
   year={2021},
   journal={arXiv preprint arXiv:2110.04236},
}

lambeq's People

Contributors

dimkart avatar ianyfan avatar thommy257 avatar y-richie-y avatar le-big-mac avatar gopal-dahale avatar ace07-sev avatar kinianlo avatar shiro-raven avatar wingcode avatar kentaroaoki avatar nikhilkhatri avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.