Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

## Python and Vim utilities for the Toki Pona minimalist conlang

This repository holds both:
- the tokipona Python package (with tools to deal with Toki Pona); and
- the tokipona Vim plugin (mainly with syntax file and some advanced capabilities for coloring

They might be used and installed independently,
although:
- the Python package, among other things, synthesizes the Vim syntax files;
- the Vim plugin, among other things, is proposed to also bring the
tokipona Python package into the Vim editor.

### Table of Contents
Items / Sections / Headers:
* [Overall description and installation](#overall-description-and-installation)
+ [Of the tokipona Python package](#of-the-tokipona-python-package)
* [Usage example of the Python package](#usage-example-of-the-python-package)
+ [Of the tokipona Vim plugin](#of-the-tokipona-vim-plugin)
- [Screenshots of the syntax highlighting (in Vim)](#screenshots-of-the-syntax-highlighting--in-vim-)
* [deployment](#deployment)
+ [of Python package to PyPI](#of-python-package-to-pypi)
+ [of the Vim plugin to vim.org](#of-the-vim-plugin-to-vimorg)
* [TODO:](#todo-)
* [Further notes](#further-notes)
* [Most important links](#most-important-links)

### Overall description and installation
For the Python package and the Vim plugin.

#### Of the tokipona Python package
This package contains routines to:
- analyze the official Toki Pona vocabulary
- synthesize phrases. sentences, paragraphs, short stories and poems in Toki Pona
- the achievement of (very preliminary) Toki Pona wordnets
- synthesize Vim syntax files for the Toki Pona language
- maybe something more

Such facilities are implemented in accordance with the [Toki Pona article],
of which the Latex and PDF files are in the article/ directory
of this repository (ttm/tokipona).

Install with:

$ pip install tokipona
or

$ python setup.py tokipona

For customization ease, hacking and debugging, clone the repository and install with 'pip3 install -e':

$ git clone https://github.com/ttm/tokipona.git
$ pip3 install -e <path_to_repo>

This install method is especially useful when reloading the modified module in subsequent runs.

### Usage example of the Python package


```python
# to import changes made in local package files,
# e.g. if installed with pip3 install -e ~/repos/tokipona/
import sys
keys=tuple(sys.modules.keys())
for key in keys:
if "tokipona" in key:
del sys.modules[key]

### Basic usage
import tokipona as t

### the main functionalities are:

# 1 - make a syntax highlighting file for Vim
sh = t.syntax()

# 2 - analyze the official Toki Pona vocabulary
st = t.stats()

# 3 - obtain (very preliminary) Toki Pona wordnet synsets
wn = t.wordnet()

# 4 - synthesize texts in Toki Pona
sy = t.synthesis()

print( sy.createParagraph() )
print( sy.createPhrase() )
print( sy.createPoem() )
print( sy.createSentence() )

# sh, st, wn, sy have objects related to each of the
# functions as further described in this README.

# 5 - further routines and variables in utils:
v, c = t.utils.vowels, t.utils.consonants
str_ = "TP vowels are: {}; TP consonants are: {}".format(v, c)
print(str_)

possible_words = t.utils.allTokiPonaPossibleWords(n=2)
print("all possible words with two syllables given the TP rules are {}".format(possible_words))

##############################################
### check files in tokipona/
# for many other functionalities and convenient variables.

# Tweak at will.
##############################################

```


#### Of the tokipona Vim plugin
To avoid redundancy upkeep, please visit
the [Toki Pona Vim plugin] page for an overview of the
implemented facilities.

To install it by hand, one might copy:
- the plugin/ directory to ~/.vim/plugin/
- the syntax/ directory to ~/.vim/syntax/

or clone the repository to a directory in your :echo &runtimepath.
For example:

$ git clone https://github.com/ttm/tokipona ~/.vim/

If you change the syntax file,
a file with highlighted text (in Toki Pona)
will have the highlighting updated upon
reload (:e<CR> in Vim).
For more information in using the plugin,
see the vim.org page for the [Toki Pona Vim plugin].

Also, check the [Toki Pona article] because it is a carefully built
document that contextualizes and describes the routines available
in this repository.

##### Screenshots of the syntax highlighting (in Vim)

A simple text:
![Toki Pona text highlighted in Vim](https://imgur.com/xTLGVjE.jpg)

Some texts with another color scheme:
![Some Toki Pona texts highlighted in Vim](https://imgur.com/6OGc5bT.jpg)

And yet in another color scheme:
![Some Toki Pona texts highlighted in Vim (in a dfferent color scheme)](https://imgur.com/fj4hQkt.jpg)

And an HTML export (through :TOhtml Vim command)
of the syntax coloring:
![And an HTML export (through :TOhtml Vim command) of the syntax coloring:](https://imgur.com/v7a3hME.jpg)

### deployment

#### of Python package to PyPI
This package іs delivered by running:
$ python3 setup.py sdist
$ python3 setup.py bdist\_wheel
$ twine upload dist/

Maybe use "python setup.py sdist upload -r pypi" ?

#### of the Vim plugin to vim.org
For making the Vimball for sharing this plugins and derivatives,
check the instructions in file ./tokiponaVimballInfo.txt

### TODO:
For now:
- check issues in this repository
- check the vim.org page for the [Toki Pona Vim plugin].

### Further notes
This Python package is intended to help in answering these (types of) questions:
- What are the most usual letters, in the beginning and end,and sequences of letters?
- What is the distribution of word sizes, smallest and largest words?
- What is the basic statistics obtained if one scrapes toki pona sites?

### Most important links

[Toki Pona article]: https://arxiv.org/abs/1712.09359
[Toki Pona Vim plugin]: https://vim.sourceforge.io/scripts/script.php?script_id=5656


Metadata

Release files for tokipona 0.1b0

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

Source distribution (sdist)

Source distribution for tokipona 0.1b0
File Size Uploaded Provenance
tokipona-0.1b0.tar.gz 14.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 36.4 kB

Release files / tokipona-0.1b0.tar.gz

Download URL tokipona-0.1b0.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
48593f639e1425f94113eb0befb9541b6966b830b38bfed5ec77aae016e3e211
BLAKE2b-256 checksum
How to use checksums
3945a59ec07a83bf108066be8d461570479580e598d2159a29e949b605290e87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / tokipona-0.1b0-py3-none-any.whl

Download URL tokipona-0.1b0-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23f95cfb86bbfe50ef3295b3db334e0dde6f0002afb43cc0109e2be1c9d583fd
BLAKE2b-256 checksum
How to use checksums
1509e1f9bbebe4f09165eb169480ecc37022f8621de130b72f06a3f055c5d3a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for tokipona 0.1b0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release
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