Skip to content

gismu / Lojban words scoring algorithm / gimyzba / lujvo splitter and generator

License

Notifications You must be signed in to change notification settings

La-Lojban/vlazba

Repository files navigation

vlazba

crates.io Docs

A Rust library and CLI for Lojban lujvo (compound word) generation and analysis.

Implements the gismu clash and jvozba algorithms described in The Complete Lojban Language.

Features

  • Generates gismu based on input from transliterations of words in multiple languages
  • Creates lujvo using the jvozba algorithm
  • Customizable language weighting
  • Efficient Rust implementation

Installation

  1. Ensure you have Rust installed and up to date:

    rustup default stable
    rustup update
  2. Clone the repository and build the project:

    git clone https://github.com/la-lojban/vlazba.git
    cd vlazba
    cargo build --release
  3. Install the CLI tool:

    cargo install vlazba --bin gimka

As a Library

Add to your Cargo.toml:

[dependencies]
vlazba = "0.7"

Basic usage:

use vlazba::jvozba::{jvozba, LujvoAndScore};

 let results = jvozba(
     &["klama".to_string(), "gasnu".to_string()],
     false,
     false
 );
 assert!(results.iter().any(|r| r.lujvo == "klagau"));

// Analyze existing lujvo
let decomposition = jvokaha::jvokaha("kalga'u").unwrap();

CLI Usage

Gismu Generation

Basic usage:

./target/release/vlazba "<Mandarin> <Hindi> <English> <Spanish> <Russian> <Arabic>"

Example:

./target/release/vlazba "uan rakan ekspekt esper predpologa mulud"

Custom weights:

./target/release/vlazba -w 0.271,0.170,0.130,0.125,0.104,0.076,0.064,0.060 mandarin english spanish hindi arabic bengali russian portuguese

Lujvo Creation (jvozba)

To create lujvo using the jvozba algorithm:

./target/release/vlazba --jvozba "<word1> <word2> <word3>"
./target/release/vlazba --jvozba --exp-rafsi "<word1> <word2> <word3>"

Examples:

./target/release/vlazba --jvozba "klama klama gasnu"
./target/release/vlazba --jvozba --exp-rafsi "corci klama gasnu"

Lujvo Reconstruction

To reconstruct a lujvo from its components:

./target/release/vlazba --reconstruct "<lujvo>"

Options:

  • --exp-rafsi: Include experimental rafsi in reconstruction
  • --forbid-cmevla: Forbid cmevla (name words) in reconstruction

Examples:

./target/release/vlazba --reconstruct "bramlatu"
./target/release/vlazba --reconstruct "bardymlatu" --exp-rafsi
./target/release/vlazba --reconstruct "toirbroda"
./target/release/vlazba --reconstruct "toirbroda" --forbid-cmevla

Lujvo Decomposition (jvokaha)

To split lujvo using the jvokaha algorithm:

./target/release/vlazba --jvokaha "<lujvo>"
./target/release/vlazba --jvokaha --exp-rafsi "<lujvo>"

Examples:

./target/release/vlazba --jvokaha "klaklagau"
./target/release/vlazba --jvokaha --exp-rafsi "cocklagau"

Options

  • -w, --weights: Specify custom language weights (default: 0.347,0.196,0.160,0.123,0.089,0.085)
  • -s, --shapes: Define gismu candidate shapes (default: "ccvcv,cvccv")
  • -a, --all-letters: Use all available letters instead of only those in input words
  • -d, --deduplicate: Path to existing gismu list for deduplication
  • --jvozba: Use jvozba function to create lujvo instead of gismu generation
  • --forbid-la-lai-doi: Forbid 'la', 'lai', 'doi' in lujvo when using jvozba
  • --jvokaha: Use jvokaha function to split lujvo into components
  • --exp-rafsi: Include experimental rafsi when generating lujvo

Debug

RUST_BACKTRACE=full cargo run -- "uan rakan ekspekt esper predpologa mulud"

Background

This project is a Rust rewrite of the original gimyzba and its Python port. It aims to provide a more efficient and maintainable implementation of the gismu generation algorithm. Additionally it ports jvozba algorithm for getting lujvo creation functionality.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE.

About

gismu / Lojban words scoring algorithm / gimyzba / lujvo splitter and generator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages