| Crates.io | phyla-lang |
| lib.rs | phyla-lang |
| version | 0.1.0 |
| created_at | 2025-10-03 22:53:05.777032+00 |
| updated_at | 2025-10-03 22:53:05.777032+00 |
| description | A procedural language generation library that creates consistent, deterministic constructed languages based on cultural personality traits and geographic influences |
| homepage | https://github.com/dragon-panic/phyla-lang |
| repository | https://github.com/dragon-panic/phyla-lang |
| max_upload_size | |
| id | 1867293 |
| size | 75,969 |
A Rust library that generates consistent, deterministic constructed languages (conlangs) based on cultural personality traits and geographic influences.
Add to your Cargo.toml:
[dependencies]
phyla-lang = "0.1.0"
use phyla_lang::{Language, CulturalProfile, Geography};
// Define a cultural profile (HEXACO personality traits, 1-5 scale)
let coastal_culture = CulturalProfile::new(
4.0, // Agreeableness - cooperative, empathetic
3.0, // Openness - creative, curious
2.0, // Conscientiousness - organized, disciplined
3.0, // Extraversion - social, assertive
3.0, // Honesty-Humility - sincere, modest
4.0, // Emotionality - sensitive, expressive
);
// Create a language
let language = Language::from_culture(
coastal_culture,
Geography::Coastal,
12345, // seed for deterministic generation
);
// Translate words
let word = language.translate_word("house");
println!("'house' in this language: {}", word);
// Translate phrases (applies word order rules)
let phrase = language.translate_phrase("I bring the beer quickly");
println!("Translated phrase: {}", phrase);
// Determinism: same input always produces same output
assert_eq!(word, language.translate_word("house"));
The library maps personality traits and geography to linguistic properties:
Personality Traits:
Geography:
use phyla_lang::{Language, CulturalProfile, Geography};
// Agreeable, emotional coastal folk
let coastal = CulturalProfile::new(4.0, 3.0, 2.0, 3.0, 3.0, 4.0);
let lang1 = Language::from_culture(coastal, Geography::Coastal, 1001);
// Disagreeable, disciplined mountain warriors
let mountain = CulturalProfile::new(1.0, 2.0, 4.0, 2.0, 3.0, 2.0);
let lang2 = Language::from_culture(mountain, Geography::Mountains, 1002);
println!("Coastal: {}", lang1.translate_word("sun")); // Flowing, soft
println!("Mountain: {}", lang2.translate_word("sun")); // Harsh, abrupt
Run the example:
cargo run --example basic_usage
LinguisticGenome: Complete specification of a language (phonology, syntax, morphology)PhonemeInventory: Available sounds (consonants and vowels)SyllableStructure: Patterns like CV, CVC, CCVCWordOrder: SVO, SOV, VSO, etc.Language: Public API for word/phrase translationRun unit tests:
cargo test
Run integration tests:
cargo test --test integration_test
Run all tests with output:
cargo test -- --nocapture
Languages emerge from parameterized cultural profiles rather than being manually designed. This enables:
Licensed under either of:
at your option.
Contributions are welcome! Please feel free to submit a Pull Request.