A Python port of the Lisp ulf2english package by Gene Kim.
Project description
Python ULF-to-English
Maps Unscoped Logical Form (ULF) formulas to English sentences. A Python port of the original Common Lisp ulf2english implementation by Gene Kim.
Dependencies
- pattern; If using Python 3, install with
pip install pattern
. - ulflib
- transduction
- memoization
Summary
Install the package using pip install ulf2english
.
The following example shows how to convert ULF to English using the package:
from ulf2english import ulf2english
ulf = ['this.pro', [['pres', 'be.v'], ['=', ['a.d', ['test.n', 'ulf.n']]]]]
ulf2english.convert(ulf)
# -> "This is a test ulf."
The following optional parameters can be given to the convert function:
add_punct = False
: omit any final punctuation in the generated sentence.capitalize_front = False
: do not capitalize the first word in the generated sentence.add_commas = True
: add commas to the generated sentence in particular sub-expressions.standardize = True
: standardize the generated sentence by converting to all-lowercase and adding space around all punctuation.verbose = True
: print the intermediate staged output after each processing stage.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ulf2english-0.0.9.tar.gz
(39.1 kB
view hashes)
Built Distribution
Close
Hashes for ulf2english-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 398d437c81543ba7e0d87ff770f85dcd1472a55ac393df2d324e8f3b8fed0f90 |
|
MD5 | 769cee612ab1839cb7cce2842c2fd934 |
|
BLAKE2b-256 | 5f96f33718920ddec90ec40ffd018c1288d85e9fad1eac223f196c53c15cff2f |