Phyla-Lang: Procedural Language Generation
A Rust library that generates consistent, deterministic constructed languages (conlangs) based on cultural personality traits and geographic influences.
Features
- Deterministic Generation: Same inputs always produce the same outputs
- Cultural Personality Mapping: HEXACO traits influence phonology, morphology, and syntax
- Geographic Influences: Mountains, coasts, deserts, etc. shape sound systems
- Infinite Scalability: Generate unlimited unique languages without storing dictionaries
- Memory Efficient: Store only generation parameters (~3KB per language), not full lexicons
- Thread-Safe: Language objects are Send + Sync for multi-threaded use
Quick Start
Add to your Cargo.toml
:
[]
= "0.1.0"
Basic Usage
use ;
// Define a cultural profile (HEXACO personality traits, 1-5 scale)
let coastal_culture = new;
// Create a language
let language = from_culture;
// Translate words
let word = language.translate_word;
println!;
// Translate phrases (applies word order rules)
let phrase = language.translate_phrase;
println!;
// Determinism: same input always produces same output
assert_eq!;
How It Works
1. Cultural Parameters → Linguistic Features
The library maps personality traits and geography to linguistic properties:
Personality Traits:
- High Agreeableness → More nasals (m, n), liquids (l, r), softer sounds
- Low Agreeableness → More stops (p, t, k), harsh fricatives, consonant clusters
- High Openness → Larger phoneme inventory, complex syllable structures
- High Conscientiousness → Regular patterns, SOV word order
- High Emotionality → More vowels, flowing sounds
Geography:
- Mountains → Glottal stops, ejectives (k', t'), harsh sounds
- Coastal → Liquids, flowing sounds, vowel-heavy syllables
- Desert → Guttural consonants (ħ, ʕ, x), emphatic sounds
- Forest → Softer sounds, breathy voice, nasals
- Plains/River Valleys → Balanced phoneme distribution
2. Deterministic Word Generation
- Hash concept string + language seed → deterministic seed
- Use seeded RNG to determine syllable count
- For each syllable:
- Choose syllable pattern (CV, CVC, CCVC, etc.)
- Fill with phonemes weighted by category probabilities
- Return generated word (always the same for same inputs)
3. Grammar Application
- Supports 6 word orders: SVO, SOV, VSO, VOS, OVS, OSV
- Word order is determined by cultural conscientiousness
- Phrase translation automatically applies word order rules
Examples
Different Cultures, Different Languages
use ;
// Agreeable, emotional coastal folk
let coastal = new;
let lang1 = from_culture;
// Disagreeable, disciplined mountain warriors
let mountain = new;
let lang2 = from_culture;
println!; // Flowing, soft
println!; // Harsh, abrupt
Run the example:
Use Cases
- Game Worlds: Generate distinct languages for factions/cultures
- Worldbuilding: Create realistic language families with evolution
- Procedural Content: Generate names, places, dialogue
- Translation Systems: Convert between constructed languages
Architecture
Core Components
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 translation
Performance
- Word generation: < 100 microseconds
- Memory per language: < 5KB (genome only)
- Optional caching for frequently-used words
- Thread-safe for concurrent use
Testing
Run unit tests:
Run integration tests:
Run all tests with output:
Design Philosophy
Languages emerge from parameterized cultural profiles rather than being manually designed. This enables:
- Infinite scalability: Generate unlimited languages without storing dictionaries
- Narrative consistency: Same concept always translates to same word
- Memory efficiency: Store only parameters, not full lexicons
- Emergent authenticity: Languages feel real because they follow consistent rules
Future Enhancements
- Writing system generation (orthography)
- Historical sound changes and language evolution
- Language family relationships (proto-languages, daughter languages)
- Dialectal variation
- Full morphological analysis (affixes, inflections)
- Phonotactic constraints (rules about sound combinations)
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.