Skip to main content

Current Status build

This is just a starting point - an alpha version - mainly a wrapper around SimpleNLG.

Although it is possible to go from first order logic to text, there is no sophistication in how things are processed. The library is still missing basics like aggregation or referring expression generation.

Installation

Either download the code from the repository and run python setup.py install or use pip: pip install nlglib.

Intro

NLGlib is a library for natural language generation (NLG) written in Python. It seeks to fill a gap in the NLG field. There are currently no off-the-shelf libraries that one could take and incorporate into other projects. The aim of this library is to be useful for general projects that would like to add a bit of text generation to their capabilities.

Audience

The library should be usable by programmers with no prior linguistic knowledge. Given that the aim of the library is language generation, some linguistic knowledge is necessary but you should be able to pick it up from the examples.

Scope

The aim of the library is to create a base for NLG system starting from content selection all the way to realisation. The library will cover document structuring tools, lexicalisation, referring expression generation and aggregation. Realisation will be done using other realisation libraries (SimpleNLG or pynlg).

History

NLGlib started as a part of the EPSRC project Scrutable Autonomous Systems (SAsSy): www.scrutable-systems.org When the project finished, the code was moved to this repository to create a stand-alone re-usable library.

Example

from nlglib.realisation.simplenlg.realisation import Realiser
from nlglib.microplanning import *

realise_en = Realiser(host='nlg.kutlak.info', port=40000)
realise_es = Realiser(host='nlg.kutlak.info', port=40001)


def main():
    p = Clause("María", "perseguir", "un mono")
    p['TENSE'] = 'PAST'
    # expected = 'María persigue un mono.'
    print(realise_es(p))
    p = Clause(NP("la", "rápida", "corredora"), VP("perseguir"), NP("un", "mono"))
    subject = NP("la", "corredora")
    objekt = NP("un", "mono")
    verb = VP("perseguir")
    subject.premodifiers.append("rápida")
    p.subject = subject
    p.predicate = verb
    p.object = objekt
    # expected = 'La rápida corredora persigue un mono.'
    print(realise_es(p))
    p = Clause(NP('this', 'example'), VP('show', 'how cool simplenlg is'))
    # expected = This example shows how cool simplenlg is.
    print(realise_en(p))


if __name__ == '__main__':
    main()

Metadata

Release files for nlglib 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nlglib 0.2.1
File Size Uploaded
nlglib-0.2.1.tar.gz 55.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nlglib 0.2.1
File Interpreter ABI Platform
nlglib-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 3.3 MB

Release files / nlglib-0.2.1.tar.gz

Download URL nlglib-0.2.1.tar.gz
Size 55.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1bc4f9fc03efd9e744f0ddaadd324a13e61da47ac238427f25094e6164d5617f
BLAKE2b-256 checksum
How to use checksums
8b7e6ec0cab56865c6ad845118d88f9c1e7a95e4769e9dc3c400fd8bbc720fbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.5

Release files / nlglib-0.2.1-py3-none-any.whl

Download URL nlglib-0.2.1-py3-none-any.whl
Size 3.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
85953dcf24fd01c1ed2a957e590dbc3f3c8f5dc5bf30c5b4062ca0fc34582d1d
BLAKE2b-256 checksum
How to use checksums
d2bde3572164a3aaa806019c6f51c53d036d256b7c8fc03a880d3a2e073675cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.0.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page