CulturalProfile

Struct CulturalProfile 

Source
pub struct CulturalProfile {
    pub agreeableness: f32,
    pub openness: f32,
    pub conscientiousness: f32,
    pub extraversion: f32,
    pub honesty_humility: f32,
    pub emotionality: f32,
}
Expand description

HEXACO personality model scores (1-5 scale). These traits map to linguistic features.

Fields§

§agreeableness: f32

Agreeableness: cooperation, empathy, patience. High → softer sounds (nasals, liquids), Low → harsher sounds (stops, clusters)

§openness: f32

Openness to experience: creativity, curiosity, unconventionality. High → larger phoneme inventory, complex patterns, Low → simpler patterns

§conscientiousness: f32

Conscientiousness: organization, diligence, perfectionism. High → regular patterns, consistent rules, Low → irregular patterns

§extraversion: f32

Extraversion: social engagement, assertiveness, energy. High → louder consonants, Low → softer consonants

§honesty_humility: f32

Honesty-Humility: sincerity, fairness, modesty. Affects formality and politeness markers

§emotionality: f32

Emotionality: anxiety, sentimentality, fearfulness. High → more vowels, flowing sounds, Low → more consonants

Implementations§

Source§

impl CulturalProfile

Source

pub fn new( agreeableness: f32, openness: f32, conscientiousness: f32, extraversion: f32, honesty_humility: f32, emotionality: f32, ) -> Self

Create a new cultural profile with all traits.

Examples found in repository?
examples/compare_with_js.rs (lines 81-88)
79fn create_melodic_coastal() -> Language {
80    // Based on JavaScript: agreeableness: 4, openness: 3, conscientiousness: 2
81    let culture = CulturalProfile::new(
82        4.0, // agreeableness
83        3.0, // openness
84        2.0, // conscientiousness
85        3.0, // extraversion
86        3.0, // honesty_humility
87        4.0, // emotionality (high for emotional culture)
88    );
89
90    Language::from_culture(culture, Geography::Coastal, 1001)
91}
92
93fn create_mountain_warriors() -> Language {
94    // Based on JavaScript: agreeableness: 1, openness: 2, conscientiousness: 4
95    let culture = CulturalProfile::new(
96        1.0, // agreeableness (disagreeable)
97        2.0, // openness
98        4.0, // conscientiousness
99        4.0, // extraversion (brave, assertive)
100        3.0, // honesty_humility
101        2.0, // emotionality (stoic)
102    );
103
104    Language::from_culture(culture, Geography::Mountains, 1002)
105}
106
107fn create_river_scholars() -> Language {
108    // Based on JavaScript: agreeableness: 3, openness: 4, conscientiousness: 4
109    let culture = CulturalProfile::new(
110        3.0, // agreeableness
111        4.0, // openness (intellectual, creative)
112        4.0, // conscientiousness (organized, precise)
113        3.0, // extraversion
114        4.0, // honesty_humility (modest scholars)
115        3.0, // emotionality
116    );
117
118    Language::from_culture(culture, Geography::RiverValley, 1003)
119}
120
121fn create_desert_nomads() -> Language {
122    // Based on JavaScript: agreeableness: 2, openness: 2, conscientiousness: 3
123    let culture = CulturalProfile::new(
124        2.0, // agreeableness (independent)
125        2.0, // openness (traditional)
126        3.0, // conscientiousness
127        3.0, // extraversion
128        3.0, // honesty_humility
129        2.0, // emotionality (hardy, resilient)
130    );
131
132    Language::from_culture(culture, Geography::Desert, 1004)
133}
More examples
Hide additional examples
examples/basic_usage.rs (lines 9-16)
5fn main() {
6    println!("=== Phyla-Lang: Procedural Language Generation ===\n");
7
8    // Define different cultures
9    let coastal_folk = CulturalProfile::new(
10        4.0, // High agreeableness - cooperative, empathetic
11        3.0, // Moderate openness
12        2.0, // Lower conscientiousness - more flexible
13        3.0, // Moderate extraversion
14        3.0, // Moderate honesty-humility
15        4.0, // High emotionality - sensitive, expressive
16    );
17
18    let mountain_warriors = CulturalProfile::new(
19        1.0, // Low agreeableness - more competitive
20        2.0, // Lower openness - traditional
21        4.0, // High conscientiousness - disciplined
22        3.0, // Moderate extraversion
23        3.0, // Moderate honesty-humility
24        2.0, // Lower emotionality - stoic
25    );
26
27    let river_scholars = CulturalProfile::new(
28        3.0, // Moderate agreeableness
29        4.0, // High openness - innovative, curious
30        4.0, // High conscientiousness - organized
31        3.0, // Moderate extraversion
32        4.0, // High honesty-humility - modest, sincere
33        3.0, // Moderate emotionality
34    );
35
36    // Create languages
37    let melodic = Language::from_culture(coastal_folk, Geography::Coastal, 1001);
38    let harsh = Language::from_culture(mountain_warriors, Geography::Mountains, 1002);
39    let scholarly = Language::from_culture(river_scholars, Geography::RiverValley, 1003);
40
41    println!("1. MELODIC COASTAL LANGUAGE (Agreeable, Emotional, Coastal)");
42    println!("   Word order: {:?}", melodic.word_order());
43    demonstrate_language(&melodic);
44
45    println!("\n2. MOUNTAIN WARRIOR LANGUAGE (Disagreeable, Conscientious, Mountains)");
46    println!("   Word order: {:?}", harsh.word_order());
47    demonstrate_language(&harsh);
48
49    println!("\n3. RIVER VALLEY SCHOLAR LANGUAGE (Open, Conscientious, River Valley)");
50    println!("   Word order: {:?}", scholarly.word_order());
51    demonstrate_language(&scholarly);
52
53    // Demonstrate determinism
54    println!("\n=== DETERMINISM DEMONSTRATION ===");
55    println!("Creating two identical languages with the same parameters...\n");
56
57    let lang1 = Language::from_culture(coastal_folk, Geography::Coastal, 5555);
58    let lang2 = Language::from_culture(coastal_folk, Geography::Coastal, 5555);
59
60    let word1 = lang1.translate_word("forever");
61    let word2 = lang2.translate_word("forever");
62
63    println!("Language 1 translates 'forever' as: {}", word1);
64    println!("Language 2 translates 'forever' as: {}", word2);
65    println!("Are they the same? {}", word1 == word2);
66
67    // Demonstrate word variation
68    println!("\n=== VOCABULARY SAMPLE ===");
69    let concepts = vec![
70        "water", "fire", "earth", "wind", "sun", "moon", "star", "tree", "stone", "mountain",
71    ];
72
73    println!("\nCoastal Language:");
74    for concept in &concepts {
75        println!("  {} → {}", concept, melodic.translate_word(concept));
76    }
77
78    println!("\nMountain Language:");
79    for concept in &concepts {
80        println!("  {} → {}", concept, harsh.translate_word(concept));
81    }
82
83    println!("\nScholar Language:");
84    for concept in &concepts {
85        println!("  {} → {}", concept, scholarly.translate_word(concept));
86    }
87}
Source

pub fn normalized_agreeableness(&self) -> f32

Get normalized agreeableness (0-1).

Source

pub fn normalized_openness(&self) -> f32

Get normalized openness (0-1).

Source

pub fn normalized_conscientiousness(&self) -> f32

Get normalized conscientiousness (0-1).

Source

pub fn normalized_extraversion(&self) -> f32

Get normalized extraversion (0-1).

Source

pub fn normalized_emotionality(&self) -> f32

Get normalized emotionality (0-1).

Trait Implementations§

Source§

impl Clone for CulturalProfile

Source§

fn clone(&self) -> CulturalProfile

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CulturalProfile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for CulturalProfile

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.