Skip to main content

Tools for linguistic semantics (lambda calculus, logic, etc), aimed at Jupyter

Project description

Lambda Notebook: Formal Semantics with Jupyter and Python

Author: Kyle Rawlins, kgr@jhu.edu

Website: https://rawlins.github.io/lambda-notebook/

Repository: https://github.com/rawlins/lambda-notebook

This project is a framework for linguists and especially semanticists developing analyses in compositional semantics. It aims to provide a means of developing 'digital fragments', following from the method of fragments in Montague grammar. Contributions, requests, and suggestions are welcome. To see some examples of the project in action, Have a look at the demo page, which is pre-rendered from an interactive Jupyter document. The project itself comes with many more examples, though you will need to download and work with them interactively: https://github.com/rawlins/lambda-notebook/tree/master/notebooks

The lead developer for this project is Kyle Rawlins. I'm an associate professor in the Cognitive Science Department at Johns Hopkins University, and I do both theoretical linguistic semantics and computational semantics. My eventual goal is for any theoretical linguistics I do to come with a lambda notebook file. (I'm a long way from that dream.)

Installation

See https://github.com/rawlins/lambda-notebook/wiki/Installation

Basically,

  • Install Jupyter Lab.
  • current release: install from PyPI. (pip install lambda-notebook.)
  • current development version: download/clone the repository and ensure you have Jupyter installed (probably via anaconda). Run ./install_lambda_kernel.py from the repository root to install the kernel.
  • See the above link for information on using the package on colab. VSCode and other Jupyter notebook interfaces are not supported.

Getting started

Once you have installed the package, you can then open open lambda notebook files by using the newly installed kernel from any jupyter lab (or notebook) instance. The kernel for regular installs is named Lambda notebook (Python 3), and it can be selected as a new kernel from the launcher, or via the Change Kernel... menu item in the Kernel menu.

Alternatively, with the lamb module installed in the python path, you can run import lamb.auto, which is fully equivalent to loading a notebook with the kernel.

I recommend starting with some of the notebook files in this repository.

Code overview

There are three main parts to the code, structured into lamb.meta and submodules ("meta" for metalanguage), lamb.types, and lamb.lang.

  • meta and types together provide a typed logical metalanguage. Some of meta's key submodules:
    • lamb.meta.core: core machinery for typed expressions and functions
    • lamb.meta.boolean: boolean expressions
    • lamb.meta.quantifiers: quantified expressions
    • lamb.meta.sets: set theoretic expressions
    • lamb.meta.meta: meta-meta-language expressions
    • lamb.meta.ply: tools for manipulating metalanguage expressions
  • lamb.types provides implementations of type systems for a simply typed lambda calculus, a polymorphic lambda calculus using the "Damas-Hindley-Milner" type system, and various accessories.
  • lamb.lang provides machinery for doing composition on an object language.

Two additional files, magics.py and parsing.py provide support for using cell magics in the notebook to directly type expressions in the metalanguage. See the notebooks for demos and documentation.

License information

The lambda notebook is released under the BSD 3-clause license.

The module lamb.tree_mini provides a modified and dependency-less version of the nltk.tree module from the nltk package. See here for NLTK license information (Apache license).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lambda_notebook-0.8.1.tar.gz (11.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lambda_notebook-0.8.1-py3-none-any.whl (432.3 kB view details)

Uploaded Python 3

File details

Details for the file lambda_notebook-0.8.1.tar.gz.

File metadata

  • Download URL: lambda_notebook-0.8.1.tar.gz
  • Upload date:
  • Size: 11.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for lambda_notebook-0.8.1.tar.gz
Algorithm Hash digest
SHA256 74ceafc49761eb6dbe822669acde77c5c2e5a3884b563ca9ea773e80b5cb3a62
MD5 43ef81d34581c44c8c8221a929bf9d79
BLAKE2b-256 a4b16c22153623d40b8dab4b4ddd85e0958a94fa1f614eb39d25db3761500b39

See more details on using hashes here.

File details

Details for the file lambda_notebook-0.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for lambda_notebook-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42b64cfcae19fbb0940b876a89daeb64d1de33f888a55a71ad12ceba2358b2e6
MD5 ff5659dfc3dbea79a490f0884dc6e704
BLAKE2b-256 bbd04898ce919cb95b4ffb14c8e55b23fcaf45b5eeda773e7e2b7e14f02f7602

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page