Skip to main content

voirs_conversion/style_transfer/
characteristics.rs

1//! Style characteristics types
2
3use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5
6/// Style characteristics
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct StyleCharacteristics {
9    /// Speaking style category
10    pub speaking_style: SpeakingStyleCategory,
11
12    /// Emotional characteristics
13    pub emotional_characteristics: EmotionalCharacteristics,
14
15    /// Prosodic characteristics
16    pub prosodic_characteristics: ProsodicCharacteristics,
17
18    /// Articulation characteristics
19    pub articulation_characteristics: ArticulationCharacteristics,
20
21    /// Voice quality characteristics
22    pub voice_quality_characteristics: VoiceQualityCharacteristics,
23
24    /// Cultural/regional characteristics
25    pub cultural_characteristics: CulturalCharacteristics,
26}
27
28/// Speaking style category
29#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
30pub enum SpeakingStyleCategory {
31    /// Conversational style
32    Conversational,
33
34    /// Formal presentation style
35    Formal,
36
37    /// Storytelling style
38    Storytelling,
39
40    /// News reading style
41    NewsReading,
42
43    /// Dramatic style
44    Dramatic,
45
46    /// Whispering style
47    Whispering,
48
49    /// Singing style
50    Singing,
51
52    /// Custom style
53    Custom(String),
54}
55
56/// Emotional characteristics
57#[derive(Debug, Clone, Serialize, Deserialize)]
58pub struct EmotionalCharacteristics {
59    /// Primary emotion
60    pub primary_emotion: EmotionType,
61
62    /// Emotional intensity (0.0 to 1.0)
63    pub intensity: f32,
64
65    /// Emotional stability
66    pub stability: f32,
67
68    /// Emotional range
69    pub emotional_range: Vec<EmotionType>,
70
71    /// Emotional transitions
72    pub transition_patterns: Vec<EmotionalTransition>,
73}
74
75/// Emotion type
76#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
77pub enum EmotionType {
78    /// Neutral emotion
79    Neutral,
80
81    /// Happy emotion
82    Happy,
83
84    /// Sad emotion
85    Sad,
86
87    /// Angry emotion
88    Angry,
89
90    /// Fearful emotion
91    Fearful,
92
93    /// Surprised emotion
94    Surprised,
95
96    /// Disgusted emotion
97    Disgusted,
98
99    /// Excited emotion
100    Excited,
101
102    /// Calm emotion
103    Calm,
104
105    /// Confident emotion
106    Confident,
107}
108
109/// Emotional transition
110#[derive(Debug, Clone, Serialize, Deserialize)]
111pub struct EmotionalTransition {
112    /// Source emotion
113    pub from_emotion: EmotionType,
114
115    /// Target emotion
116    pub to_emotion: EmotionType,
117
118    /// Transition duration (seconds)
119    pub duration: f32,
120
121    /// Transition curve
122    pub transition_curve: TransitionCurve,
123}
124
125/// Transition curve type
126#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
127pub enum TransitionCurve {
128    /// Linear transition
129    Linear,
130
131    /// Exponential transition
132    Exponential,
133
134    /// Sigmoid transition
135    Sigmoid,
136
137    /// Custom curve
138    Custom,
139}
140
141/// Prosodic characteristics
142#[derive(Debug, Clone, Serialize, Deserialize)]
143pub struct ProsodicCharacteristics {
144    /// Fundamental frequency characteristics
145    pub f0_characteristics: F0Characteristics,
146
147    /// Rhythm characteristics
148    pub rhythm_characteristics: RhythmCharacteristics,
149
150    /// Stress characteristics
151    pub stress_characteristics: StressCharacteristics,
152
153    /// Intonation patterns
154    pub intonation_patterns: Vec<IntonationPattern>,
155}
156
157/// F0 characteristics
158#[derive(Debug, Clone, Serialize, Deserialize)]
159pub struct F0Characteristics {
160    /// Mean F0 (Hz)
161    pub mean_f0: f32,
162
163    /// F0 range (Hz)
164    pub f0_range: (f32, f32),
165
166    /// F0 variability
167    pub f0_variability: f32,
168
169    /// F0 contour patterns
170    pub contour_patterns: Vec<F0ContourPattern>,
171
172    /// Pitch accent patterns
173    pub pitch_accent_patterns: Vec<PitchAccentPattern>,
174}
175
176/// F0 contour pattern
177#[derive(Debug, Clone, Serialize, Deserialize)]
178pub struct F0ContourPattern {
179    /// Pattern name
180    pub name: String,
181
182    /// Contour points (normalized time, normalized F0)
183    pub contour_points: Vec<(f32, f32)>,
184
185    /// Pattern frequency
186    pub frequency: f32,
187
188    /// Context conditions
189    pub context_conditions: Vec<String>,
190}
191
192/// Pitch accent pattern
193#[derive(Debug, Clone, Serialize, Deserialize)]
194pub struct PitchAccentPattern {
195    /// Accent type
196    pub accent_type: AccentType,
197
198    /// Accent strength
199    pub strength: f32,
200
201    /// Timing characteristics
202    pub timing: AccentTiming,
203
204    /// Frequency characteristics
205    pub frequency_characteristics: AccentFrequencyCharacteristics,
206}
207
208/// Accent type
209#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
210pub enum AccentType {
211    /// Rising accent
212    Rising,
213
214    /// Falling accent
215    Falling,
216
217    /// High accent
218    High,
219
220    /// Low accent
221    Low,
222
223    /// Complex accent
224    Complex,
225}
226
227/// Accent timing
228#[derive(Debug, Clone, Serialize, Deserialize)]
229pub struct AccentTiming {
230    /// Onset time (relative to syllable)
231    pub onset: f32,
232
233    /// Peak time (relative to syllable)
234    pub peak: f32,
235
236    /// Duration (relative to syllable)
237    pub duration: f32,
238}
239
240/// Accent frequency characteristics
241#[derive(Debug, Clone, Serialize, Deserialize)]
242pub struct AccentFrequencyCharacteristics {
243    /// Peak frequency (Hz)
244    pub peak_frequency: f32,
245
246    /// Frequency excursion (Hz)
247    pub frequency_excursion: f32,
248
249    /// Frequency slope (Hz/s)
250    pub frequency_slope: f32,
251}
252
253/// Rhythm characteristics
254#[derive(Debug, Clone, Serialize, Deserialize)]
255pub struct RhythmCharacteristics {
256    /// Speaking rate (syllables per second)
257    pub speaking_rate: f32,
258
259    /// Rate variability
260    pub rate_variability: f32,
261
262    /// Pause patterns
263    pub pause_patterns: Vec<PausePattern>,
264
265    /// Rhythmic patterns
266    pub rhythmic_patterns: Vec<RhythmicPattern>,
267
268    /// Tempo characteristics
269    pub tempo_characteristics: TempoCharacteristics,
270}
271
272/// Pause pattern
273#[derive(Debug, Clone, Serialize, Deserialize)]
274pub struct PausePattern {
275    /// Pause type
276    pub pause_type: PauseType,
277
278    /// Average duration (seconds)
279    pub average_duration: f32,
280
281    /// Duration variability
282    pub duration_variability: f32,
283
284    /// Frequency of occurrence
285    pub frequency: f32,
286
287    /// Context conditions
288    pub context_conditions: Vec<String>,
289}
290
291/// Pause type
292#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
293pub enum PauseType {
294    /// Breath pause
295    Breath,
296
297    /// Hesitation pause
298    Hesitation,
299
300    /// Syntactic pause
301    Syntactic,
302
303    /// Emphatic pause
304    Emphatic,
305
306    /// Silent pause
307    Silent,
308}
309
310/// Rhythmic pattern
311#[derive(Debug, Clone, Serialize, Deserialize)]
312pub struct RhythmicPattern {
313    /// Pattern name
314    pub name: String,
315
316    /// Beat pattern
317    pub beat_pattern: Vec<f32>,
318
319    /// Pattern strength
320    pub strength: f32,
321
322    /// Pattern regularity
323    pub regularity: f32,
324}
325
326/// Tempo characteristics
327#[derive(Debug, Clone, Serialize, Deserialize)]
328pub struct TempoCharacteristics {
329    /// Base tempo (BPM)
330    pub base_tempo: f32,
331
332    /// Tempo variations
333    pub tempo_variations: Vec<TempoVariation>,
334
335    /// Acceleration patterns
336    pub acceleration_patterns: Vec<AccelerationPattern>,
337
338    /// Rubato characteristics
339    pub rubato_characteristics: RubatoCharacteristics,
340}
341
342/// Tempo variation
343#[derive(Debug, Clone, Serialize, Deserialize)]
344pub struct TempoVariation {
345    /// Variation type
346    pub variation_type: TempoVariationType,
347
348    /// Variation amount (percentage)
349    pub amount: f32,
350
351    /// Duration (seconds)
352    pub duration: f32,
353
354    /// Context conditions
355    pub context_conditions: Vec<String>,
356}
357
358/// Tempo variation type
359#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
360pub enum TempoVariationType {
361    /// Gradual acceleration
362    Accelerando,
363
364    /// Gradual deceleration
365    Ritardando,
366
367    /// Sudden speed change
368    Sudden,
369
370    /// Cyclical variation
371    Cyclical,
372}
373
374/// Acceleration pattern
375#[derive(Debug, Clone, Serialize, Deserialize)]
376pub struct AccelerationPattern {
377    /// Pattern name
378    pub name: String,
379
380    /// Acceleration curve
381    pub curve: Vec<(f32, f32)>, // (time, acceleration)
382
383    /// Pattern frequency
384    pub frequency: f32,
385}
386
387/// Rubato characteristics
388#[derive(Debug, Clone, Serialize, Deserialize)]
389pub struct RubatoCharacteristics {
390    /// Rubato strength
391    pub strength: f32,
392
393    /// Rubato patterns
394    pub patterns: Vec<RubatoPattern>,
395
396    /// Musical context sensitivity
397    pub context_sensitivity: f32,
398}
399
400/// Rubato pattern
401#[derive(Debug, Clone, Serialize, Deserialize)]
402pub struct RubatoPattern {
403    /// Pattern name
404    pub name: String,
405
406    /// Timing adjustments
407    pub timing_adjustments: Vec<f32>,
408
409    /// Pattern scope
410    pub scope: RubatoScope,
411}
412
413/// Rubato scope
414#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
415pub enum RubatoScope {
416    /// Note-level rubato
417    Note,
418
419    /// Phrase-level rubato
420    Phrase,
421
422    /// Sentence-level rubato
423    Sentence,
424
425    /// Global rubato
426    Global,
427}
428
429/// Stress characteristics
430#[derive(Debug, Clone, Serialize, Deserialize)]
431pub struct StressCharacteristics {
432    /// Stress patterns
433    pub stress_patterns: Vec<StressPattern>,
434
435    /// Stress marking methods
436    pub stress_marking: Vec<StressMarkingMethod>,
437
438    /// Stress hierarchy
439    pub stress_hierarchy: StressHierarchy,
440}
441
442/// Stress pattern
443#[derive(Debug, Clone, Serialize, Deserialize)]
444pub struct StressPattern {
445    /// Pattern name
446    pub name: String,
447
448    /// Stress levels
449    pub stress_levels: Vec<StressLevel>,
450
451    /// Pattern regularity
452    pub regularity: f32,
453
454    /// Context dependency
455    pub context_dependency: f32,
456}
457
458/// Stress level
459#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
460pub enum StressLevel {
461    /// No stress
462    Unstressed,
463
464    /// Secondary stress
465    Secondary,
466
467    /// Primary stress
468    Primary,
469
470    /// Emphatic stress
471    Emphatic,
472}
473
474/// Stress marking method
475#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
476pub enum StressMarkingMethod {
477    /// Pitch-based stress
478    Pitch,
479
480    /// Duration-based stress
481    Duration,
482
483    /// Intensity-based stress
484    Intensity,
485
486    /// Combined marking
487    Combined,
488}
489
490/// Stress hierarchy
491#[derive(Debug, Clone, Serialize, Deserialize)]
492pub struct StressHierarchy {
493    /// Hierarchical levels
494    pub levels: Vec<StressHierarchyLevel>,
495
496    /// Interaction patterns
497    pub interaction_patterns: Vec<StressInteractionPattern>,
498}
499
500/// Stress hierarchy level
501#[derive(Debug, Clone, Serialize, Deserialize)]
502pub struct StressHierarchyLevel {
503    /// Level name
504    pub name: String,
505
506    /// Level importance
507    pub importance: f32,
508
509    /// Acoustic correlates
510    pub acoustic_correlates: Vec<AcousticCorrelate>,
511}
512
513/// Acoustic correlate
514#[derive(Debug, Clone, Serialize, Deserialize)]
515pub struct AcousticCorrelate {
516    /// Correlate type
517    pub correlate_type: AcousticCorrelateType,
518
519    /// Correlate strength
520    pub strength: f32,
521
522    /// Correlate direction
523    pub direction: CorrelateDirection,
524}
525
526/// Acoustic correlate type
527#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
528pub enum AcousticCorrelateType {
529    /// Fundamental frequency
530    F0,
531
532    /// Duration
533    Duration,
534
535    /// Intensity
536    Intensity,
537
538    /// Formant frequency
539    Formant,
540
541    /// Spectral tilt
542    SpectralTilt,
543}
544
545/// Correlate direction
546#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
547pub enum CorrelateDirection {
548    /// Positive correlation
549    Positive,
550
551    /// Negative correlation
552    Negative,
553
554    /// Non-linear correlation
555    NonLinear,
556}
557
558/// Stress interaction pattern
559#[derive(Debug, Clone, Serialize, Deserialize)]
560pub struct StressInteractionPattern {
561    /// Pattern name
562    pub name: String,
563
564    /// Interacting levels
565    pub levels: Vec<String>,
566
567    /// Interaction type
568    pub interaction_type: InteractionType,
569
570    /// Interaction strength
571    pub strength: f32,
572}
573
574/// Interaction type
575#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
576pub enum InteractionType {
577    /// Additive interaction
578    Additive,
579
580    /// Multiplicative interaction
581    Multiplicative,
582
583    /// Competitive interaction
584    Competitive,
585
586    /// Cooperative interaction
587    Cooperative,
588}
589
590/// Intonation pattern
591#[derive(Debug, Clone, Serialize, Deserialize)]
592pub struct IntonationPattern {
593    /// Pattern name
594    pub name: String,
595
596    /// Pattern type
597    pub pattern_type: IntonationPatternType,
598
599    /// F0 contour
600    pub f0_contour: Vec<(f32, f32)>, // (time, F0)
601
602    /// Pattern frequency
603    pub frequency: f32,
604
605    /// Context conditions
606    pub context_conditions: Vec<String>,
607
608    /// Communicative function
609    pub communicative_function: CommunicativeFunction,
610}
611
612/// Intonation pattern type
613#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
614pub enum IntonationPatternType {
615    /// Declarative pattern
616    Declarative,
617
618    /// Interrogative pattern
619    Interrogative,
620
621    /// Exclamatory pattern
622    Exclamatory,
623
624    /// Imperative pattern
625    Imperative,
626
627    /// Continuation pattern
628    Continuation,
629
630    /// Final pattern
631    Final,
632}
633
634/// Communicative function
635#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
636pub enum CommunicativeFunction {
637    /// Statement function
638    Statement,
639
640    /// Question function
641    Question,
642
643    /// Command function
644    Command,
645
646    /// Emphasis function
647    Emphasis,
648
649    /// Contrast function
650    Contrast,
651
652    /// Focus function
653    Focus,
654}
655
656/// Articulation characteristics
657#[derive(Debug, Clone, Serialize, Deserialize)]
658pub struct ArticulationCharacteristics {
659    /// Consonant articulation
660    pub consonant_articulation: ConsonantArticulation,
661
662    /// Vowel articulation
663    pub vowel_articulation: VowelArticulation,
664
665    /// Coarticulation patterns
666    pub coarticulation_patterns: Vec<CoarticulationPattern>,
667
668    /// Articulatory precision
669    pub articulatory_precision: ArticulatoryPrecision,
670}
671
672/// Consonant articulation
673#[derive(Debug, Clone, Serialize, Deserialize)]
674pub struct ConsonantArticulation {
675    /// Place of articulation preferences
676    pub place_preferences: HashMap<String, f32>,
677
678    /// Manner of articulation preferences
679    pub manner_preferences: HashMap<String, f32>,
680
681    /// Voicing characteristics
682    pub voicing_characteristics: VoicingCharacteristics,
683
684    /// Consonant cluster handling
685    pub cluster_handling: ConsonantClusterHandling,
686}
687
688/// Voicing characteristics
689#[derive(Debug, Clone, Serialize, Deserialize)]
690pub struct VoicingCharacteristics {
691    /// Voice onset time patterns
692    pub vot_patterns: HashMap<String, VOTPattern>,
693
694    /// Voicing assimilation patterns
695    pub assimilation_patterns: Vec<VoicingAssimilationPattern>,
696
697    /// Devoicing patterns
698    pub devoicing_patterns: Vec<DevoicingPattern>,
699}
700
701/// Voice onset time pattern
702#[derive(Debug, Clone, Serialize, Deserialize)]
703pub struct VOTPattern {
704    /// Mean VOT (ms)
705    pub mean_vot: f32,
706
707    /// VOT variability
708    pub variability: f32,
709
710    /// Context dependencies
711    pub context_dependencies: Vec<VOTContext>,
712}
713
714/// VOT context
715#[derive(Debug, Clone, Serialize, Deserialize)]
716pub struct VOTContext {
717    /// Context description
718    pub context: String,
719
720    /// VOT adjustment (ms)
721    pub adjustment: f32,
722}
723
724/// Voicing assimilation pattern
725#[derive(Debug, Clone, Serialize, Deserialize)]
726pub struct VoicingAssimilationPattern {
727    /// Pattern name
728    pub name: String,
729
730    /// Source voicing
731    pub source_voicing: bool,
732
733    /// Target voicing
734    pub target_voicing: bool,
735
736    /// Assimilation strength
737    pub strength: f32,
738
739    /// Context conditions
740    pub conditions: Vec<String>,
741}
742
743/// Devoicing pattern
744#[derive(Debug, Clone, Serialize, Deserialize)]
745pub struct DevoicingPattern {
746    /// Pattern name
747    pub name: String,
748
749    /// Affected phonemes
750    pub affected_phonemes: Vec<String>,
751
752    /// Devoicing strength
753    pub strength: f32,
754
755    /// Context conditions
756    pub conditions: Vec<String>,
757}
758
759/// Consonant cluster handling
760#[derive(Debug, Clone, Serialize, Deserialize)]
761pub struct ConsonantClusterHandling {
762    /// Cluster simplification patterns
763    pub simplification_patterns: Vec<ClusterSimplificationPattern>,
764
765    /// Epenthesis patterns
766    pub epenthesis_patterns: Vec<EpenthesisPattern>,
767
768    /// Deletion patterns
769    pub deletion_patterns: Vec<DeletionPattern>,
770}
771
772/// Cluster simplification pattern
773#[derive(Debug, Clone, Serialize, Deserialize)]
774pub struct ClusterSimplificationPattern {
775    /// Pattern name
776    pub name: String,
777
778    /// Input cluster
779    pub input_cluster: Vec<String>,
780
781    /// Output cluster
782    pub output_cluster: Vec<String>,
783
784    /// Simplification probability
785    pub probability: f32,
786
787    /// Context conditions
788    pub conditions: Vec<String>,
789}
790
791/// Epenthesis pattern
792#[derive(Debug, Clone, Serialize, Deserialize)]
793pub struct EpenthesisPattern {
794    /// Pattern name
795    pub name: String,
796
797    /// Epenthetic segment
798    pub epenthetic_segment: String,
799
800    /// Insertion position
801    pub position: InsertionPosition,
802
803    /// Insertion probability
804    pub probability: f32,
805
806    /// Context conditions
807    pub conditions: Vec<String>,
808}
809
810/// Insertion position
811#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
812pub enum InsertionPosition {
813    /// Before cluster
814    Before,
815
816    /// Within cluster
817    Within,
818
819    /// After cluster
820    After,
821}
822
823/// Deletion pattern
824#[derive(Debug, Clone, Serialize, Deserialize)]
825pub struct DeletionPattern {
826    /// Pattern name
827    pub name: String,
828
829    /// Deleted segment
830    pub deleted_segment: String,
831
832    /// Deletion position
833    pub position: DeletionPosition,
834
835    /// Deletion probability
836    pub probability: f32,
837
838    /// Context conditions
839    pub conditions: Vec<String>,
840}
841
842/// Deletion position
843#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
844pub enum DeletionPosition {
845    /// Initial position
846    Initial,
847
848    /// Medial position
849    Medial,
850
851    /// Final position
852    Final,
853}
854
855/// Vowel articulation
856#[derive(Debug, Clone, Serialize, Deserialize)]
857pub struct VowelArticulation {
858    /// Vowel space characteristics
859    pub vowel_space: VowelSpaceCharacteristics,
860
861    /// Vowel reduction patterns
862    pub reduction_patterns: Vec<VowelReductionPattern>,
863
864    /// Vowel harmony patterns
865    pub harmony_patterns: Vec<VowelHarmonyPattern>,
866
867    /// Diphthongization patterns
868    pub diphthongization_patterns: Vec<DiphthongizationPattern>,
869}
870
871/// Vowel space characteristics
872#[derive(Debug, Clone, Serialize, Deserialize)]
873pub struct VowelSpaceCharacteristics {
874    /// Formant space mapping
875    pub formant_space: HashMap<String, FormantValues>,
876
877    /// Vowel dispersion
878    pub dispersion: f32,
879
880    /// Vowel centralization tendency
881    pub centralization_tendency: f32,
882
883    /// Dynamic range
884    pub dynamic_range: f32,
885}
886
887/// Formant values
888#[derive(Debug, Clone, Serialize, Deserialize)]
889pub struct FormantValues {
890    /// F1 frequency (Hz)
891    pub f1: f32,
892
893    /// F2 frequency (Hz)
894    pub f2: f32,
895
896    /// F3 frequency (Hz)
897    pub f3: f32,
898
899    /// F4 frequency (Hz)
900    pub f4: Option<f32>,
901}
902
903/// Vowel reduction pattern
904#[derive(Debug, Clone, Serialize, Deserialize)]
905pub struct VowelReductionPattern {
906    /// Pattern name
907    pub name: String,
908
909    /// Source vowel
910    pub source_vowel: String,
911
912    /// Target vowel
913    pub target_vowel: String,
914
915    /// Reduction probability
916    pub probability: f32,
917
918    /// Context conditions
919    pub conditions: Vec<String>,
920}
921
922/// Vowel harmony pattern
923#[derive(Debug, Clone, Serialize, Deserialize)]
924pub struct VowelHarmonyPattern {
925    /// Pattern name
926    pub name: String,
927
928    /// Harmony type
929    pub harmony_type: VowelHarmonyType,
930
931    /// Feature spreading
932    pub feature_spreading: FeatureSpreading,
933
934    /// Harmony strength
935    pub strength: f32,
936}
937
938/// Vowel harmony type
939#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
940pub enum VowelHarmonyType {
941    /// Front-back harmony
942    FrontBack,
943
944    /// High-low harmony
945    HighLow,
946
947    /// Round-unround harmony
948    RoundUnround,
949
950    /// Advanced tongue root harmony
951    ATR,
952}
953
954/// Feature spreading
955#[derive(Debug, Clone, Serialize, Deserialize)]
956pub struct FeatureSpreading {
957    /// Spreading direction
958    pub direction: SpreadingDirection,
959
960    /// Spreading distance
961    pub distance: usize,
962
963    /// Blocking segments
964    pub blocking_segments: Vec<String>,
965}
966
967/// Spreading direction
968#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
969pub enum SpreadingDirection {
970    /// Left-to-right spreading
971    LeftToRight,
972
973    /// Right-to-left spreading
974    RightToLeft,
975
976    /// Bidirectional spreading
977    Bidirectional,
978}
979
980/// Diphthongization pattern
981#[derive(Debug, Clone, Serialize, Deserialize)]
982pub struct DiphthongizationPattern {
983    /// Pattern name
984    pub name: String,
985
986    /// Source monophthong
987    pub source_monophthong: String,
988
989    /// Target diphthong
990    pub target_diphthong: String,
991
992    /// Diphthongization probability
993    pub probability: f32,
994
995    /// Context conditions
996    pub conditions: Vec<String>,
997}
998
999/// Coarticulation pattern
1000#[derive(Debug, Clone, Serialize, Deserialize)]
1001pub struct CoarticulationPattern {
1002    /// Pattern name
1003    pub name: String,
1004
1005    /// Coarticulation type
1006    pub coarticulation_type: CoarticulationType,
1007
1008    /// Affected segments
1009    pub affected_segments: Vec<String>,
1010
1011    /// Coarticulation strength
1012    pub strength: f32,
1013
1014    /// Temporal extent
1015    pub temporal_extent: TemporalExtent,
1016}
1017
1018/// Coarticulation type
1019#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1020pub enum CoarticulationType {
1021    /// Anticipatory coarticulation
1022    Anticipatory,
1023
1024    /// Carryover coarticulation
1025    Carryover,
1026
1027    /// Bidirectional coarticulation
1028    Bidirectional,
1029}
1030
1031/// Temporal extent
1032#[derive(Debug, Clone, Serialize, Deserialize)]
1033pub struct TemporalExtent {
1034    /// Extent in milliseconds
1035    pub extent_ms: f32,
1036
1037    /// Extent in segments
1038    pub extent_segments: usize,
1039
1040    /// Extent variability
1041    pub variability: f32,
1042}
1043
1044/// Articulatory precision
1045#[derive(Debug, Clone, Serialize, Deserialize)]
1046pub struct ArticulatoryPrecision {
1047    /// Overall precision score
1048    pub overall_precision: f32,
1049
1050    /// Consonant precision
1051    pub consonant_precision: f32,
1052
1053    /// Vowel precision
1054    pub vowel_precision: f32,
1055
1056    /// Precision variability
1057    pub precision_variability: f32,
1058
1059    /// Context effects on precision
1060    pub context_effects: Vec<PrecisionContextEffect>,
1061}
1062
1063/// Precision context effect
1064#[derive(Debug, Clone, Serialize, Deserialize)]
1065pub struct PrecisionContextEffect {
1066    /// Context description
1067    pub context: String,
1068
1069    /// Precision adjustment
1070    pub adjustment: f32,
1071
1072    /// Effect strength
1073    pub strength: f32,
1074}
1075
1076/// Voice quality characteristics
1077#[derive(Debug, Clone, Serialize, Deserialize)]
1078pub struct VoiceQualityCharacteristics {
1079    /// Phonation type
1080    pub phonation_type: PhonationType,
1081
1082    /// Breathiness characteristics
1083    pub breathiness: BreathinessCharacteristics,
1084
1085    /// Roughness characteristics
1086    pub roughness: RoughnessCharacteristics,
1087
1088    /// Creakiness characteristics
1089    pub creakiness: CreakynessCharacteristics,
1090
1091    /// Tenseness characteristics
1092    pub tenseness: TensenessCharacteristics,
1093
1094    /// Resonance characteristics
1095    pub resonance: ResonanceCharacteristics,
1096}
1097
1098/// Phonation type
1099#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1100pub enum PhonationType {
1101    /// Modal phonation
1102    Modal,
1103
1104    /// Breathy phonation
1105    Breathy,
1106
1107    /// Creaky phonation
1108    Creaky,
1109
1110    /// Harsh phonation
1111    Harsh,
1112
1113    /// Falsetto phonation
1114    Falsetto,
1115
1116    /// Mixed phonation
1117    Mixed,
1118}
1119
1120/// Breathiness characteristics
1121#[derive(Debug, Clone, Serialize, Deserialize)]
1122pub struct BreathinessCharacteristics {
1123    /// Breathiness level (0.0 to 1.0)
1124    pub level: f32,
1125
1126    /// Breathiness variability
1127    pub variability: f32,
1128
1129    /// Context dependencies
1130    pub context_dependencies: Vec<BreathinessContext>,
1131
1132    /// Acoustic correlates
1133    pub acoustic_correlates: BreathinessAcousticCorrelates,
1134}
1135
1136/// Breathiness context
1137#[derive(Debug, Clone, Serialize, Deserialize)]
1138pub struct BreathinessContext {
1139    /// Context description
1140    pub context: String,
1141
1142    /// Breathiness adjustment
1143    pub adjustment: f32,
1144}
1145
1146/// Breathiness acoustic correlates
1147#[derive(Debug, Clone, Serialize, Deserialize)]
1148pub struct BreathinessAcousticCorrelates {
1149    /// Harmonics-to-noise ratio
1150    pub hnr: f32,
1151
1152    /// Spectral tilt
1153    pub spectral_tilt: f32,
1154
1155    /// First formant bandwidth
1156    pub f1_bandwidth: f32,
1157
1158    /// Aspiration noise level
1159    pub aspiration_noise: f32,
1160}
1161
1162/// Roughness characteristics
1163#[derive(Debug, Clone, Serialize, Deserialize)]
1164pub struct RoughnessCharacteristics {
1165    /// Roughness level (0.0 to 1.0)
1166    pub level: f32,
1167
1168    /// Roughness variability
1169    pub variability: f32,
1170
1171    /// Roughness type
1172    pub roughness_type: RoughnessType,
1173
1174    /// Acoustic correlates
1175    pub acoustic_correlates: RoughnessAcousticCorrelates,
1176}
1177
1178/// Roughness type
1179#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1180pub enum RoughnessType {
1181    /// Periodic roughness
1182    Periodic,
1183
1184    /// Aperiodic roughness
1185    Aperiodic,
1186
1187    /// Mixed roughness
1188    Mixed,
1189}
1190
1191/// Roughness acoustic correlates
1192#[derive(Debug, Clone, Serialize, Deserialize)]
1193pub struct RoughnessAcousticCorrelates {
1194    /// Jitter
1195    pub jitter: f32,
1196
1197    /// Shimmer
1198    pub shimmer: f32,
1199
1200    /// Noise-to-harmonics ratio
1201    pub nhr: f32,
1202
1203    /// Fundamental frequency irregularity
1204    pub f0_irregularity: f32,
1205}
1206
1207/// Creakiness characteristics
1208#[derive(Debug, Clone, Serialize, Deserialize)]
1209pub struct CreakynessCharacteristics {
1210    /// Creakiness level (0.0 to 1.0)
1211    pub level: f32,
1212
1213    /// Creakiness variability
1214    pub variability: f32,
1215
1216    /// Creak distribution
1217    pub distribution: CreakDistribution,
1218
1219    /// Acoustic correlates
1220    pub acoustic_correlates: CreakyAcousticCorrelates,
1221}
1222
1223/// Creak distribution
1224#[derive(Debug, Clone, Serialize, Deserialize)]
1225pub struct CreakDistribution {
1226    /// Phrase-initial creak
1227    pub phrase_initial: f32,
1228
1229    /// Phrase-final creak
1230    pub phrase_final: f32,
1231
1232    /// Stressed syllable creak
1233    pub stressed_syllable: f32,
1234
1235    /// Vowel-specific creak
1236    pub vowel_specific: HashMap<String, f32>,
1237}
1238
1239/// Creaky acoustic correlates
1240#[derive(Debug, Clone, Serialize, Deserialize)]
1241pub struct CreakyAcousticCorrelates {
1242    /// Fundamental frequency
1243    pub f0_characteristics: CreakyF0Characteristics,
1244
1245    /// Spectral characteristics
1246    pub spectral_characteristics: CreakySpectralCharacteristics,
1247
1248    /// Temporal characteristics
1249    pub temporal_characteristics: CreakyTemporalCharacteristics,
1250}
1251
1252/// Creaky F0 characteristics
1253#[derive(Debug, Clone, Serialize, Deserialize)]
1254pub struct CreakyF0Characteristics {
1255    /// Mean F0 in creak (Hz)
1256    pub mean_f0: f32,
1257
1258    /// F0 irregularity
1259    pub f0_irregularity: f32,
1260
1261    /// Subharmonics presence
1262    pub subharmonics: f32,
1263}
1264
1265/// Creaky spectral characteristics
1266#[derive(Debug, Clone, Serialize, Deserialize)]
1267pub struct CreakySpectralCharacteristics {
1268    /// Spectral tilt
1269    pub spectral_tilt: f32,
1270
1271    /// High-frequency energy
1272    pub high_frequency_energy: f32,
1273
1274    /// Formant damping
1275    pub formant_damping: f32,
1276}
1277
1278/// Creaky temporal characteristics
1279#[derive(Debug, Clone, Serialize, Deserialize)]
1280pub struct CreakyTemporalCharacteristics {
1281    /// Pulse irregularity
1282    pub pulse_irregularity: f32,
1283
1284    /// Inter-pulse intervals
1285    pub inter_pulse_intervals: Vec<f32>,
1286
1287    /// Creak duration patterns
1288    pub duration_patterns: Vec<f32>,
1289}
1290
1291/// Tenseness characteristics
1292#[derive(Debug, Clone, Serialize, Deserialize)]
1293pub struct TensenessCharacteristics {
1294    /// Tenseness level (0.0 to 1.0)
1295    pub level: f32,
1296
1297    /// Tenseness variability
1298    pub variability: f32,
1299
1300    /// Tenseness distribution
1301    pub distribution: TensenessDistribution,
1302
1303    /// Acoustic correlates
1304    pub acoustic_correlates: TensenessAcousticCorrelates,
1305}
1306
1307/// Tenseness distribution
1308#[derive(Debug, Clone, Serialize, Deserialize)]
1309pub struct TensenessDistribution {
1310    /// Context-dependent tenseness
1311    pub context_tenseness: HashMap<String, f32>,
1312
1313    /// Emotion-dependent tenseness
1314    pub emotion_tenseness: HashMap<String, f32>,
1315
1316    /// Stress-dependent tenseness
1317    pub stress_tenseness: HashMap<String, f32>,
1318}
1319
1320/// Tenseness acoustic correlates
1321#[derive(Debug, Clone, Serialize, Deserialize)]
1322pub struct TensenessAcousticCorrelates {
1323    /// Fundamental frequency elevation
1324    pub f0_elevation: f32,
1325
1326    /// Formant frequency shifts
1327    pub formant_shifts: HashMap<String, f32>,
1328
1329    /// Spectral energy distribution
1330    pub spectral_energy: f32,
1331
1332    /// Voice source characteristics
1333    pub voice_source: VoiceSourceCharacteristics,
1334}
1335
1336/// Voice source characteristics
1337#[derive(Debug, Clone, Serialize, Deserialize)]
1338pub struct VoiceSourceCharacteristics {
1339    /// Open quotient
1340    pub open_quotient: f32,
1341
1342    /// Closing quotient
1343    pub closing_quotient: f32,
1344
1345    /// Spectral tilt
1346    pub spectral_tilt: f32,
1347
1348    /// Glottal flow derivative
1349    pub flow_derivative: f32,
1350}
1351
1352/// Resonance characteristics
1353#[derive(Debug, Clone, Serialize, Deserialize)]
1354pub struct ResonanceCharacteristics {
1355    /// Vocal tract length
1356    pub vocal_tract_length: f32,
1357
1358    /// Formant frequencies
1359    pub formant_frequencies: HashMap<String, f32>,
1360
1361    /// Formant bandwidths
1362    pub formant_bandwidths: HashMap<String, f32>,
1363
1364    /// Resonance coupling
1365    pub resonance_coupling: ResonanceCoupling,
1366
1367    /// Nasality characteristics
1368    pub nasality: NasalityCharacteristics,
1369}
1370
1371/// Resonance coupling
1372#[derive(Debug, Clone, Serialize, Deserialize)]
1373pub struct ResonanceCoupling {
1374    /// Oral-nasal coupling
1375    pub oral_nasal_coupling: f32,
1376
1377    /// Pharyngeal coupling
1378    pub pharyngeal_coupling: f32,
1379
1380    /// Coupling variability
1381    pub coupling_variability: f32,
1382}
1383
1384/// Nasality characteristics
1385#[derive(Debug, Clone, Serialize, Deserialize)]
1386pub struct NasalityCharacteristics {
1387    /// Nasality level (0.0 to 1.0)
1388    pub level: f32,
1389
1390    /// Nasality variability
1391    pub variability: f32,
1392
1393    /// Nasality distribution
1394    pub distribution: NasalityDistribution,
1395
1396    /// Acoustic correlates
1397    pub acoustic_correlates: NasalityAcousticCorrelates,
1398}
1399
1400/// Nasality distribution
1401#[derive(Debug, Clone, Serialize, Deserialize)]
1402pub struct NasalityDistribution {
1403    /// Consonant nasality
1404    pub consonant_nasality: HashMap<String, f32>,
1405
1406    /// Vowel nasality
1407    pub vowel_nasality: HashMap<String, f32>,
1408
1409    /// Context effects
1410    pub context_effects: Vec<NasalityContextEffect>,
1411}
1412
1413/// Nasality context effect
1414#[derive(Debug, Clone, Serialize, Deserialize)]
1415pub struct NasalityContextEffect {
1416    /// Context description
1417    pub context: String,
1418
1419    /// Nasality adjustment
1420    pub adjustment: f32,
1421}
1422
1423/// Nasality acoustic correlates
1424#[derive(Debug, Clone, Serialize, Deserialize)]
1425pub struct NasalityAcousticCorrelates {
1426    /// Nasal formant frequencies
1427    pub nasal_formants: Vec<f32>,
1428
1429    /// Anti-formant frequencies
1430    pub anti_formants: Vec<f32>,
1431
1432    /// Nasal coupling bandwidth
1433    pub coupling_bandwidth: f32,
1434
1435    /// Spectral zeros
1436    pub spectral_zeros: Vec<f32>,
1437}
1438
1439/// Cultural characteristics
1440#[derive(Debug, Clone, Serialize, Deserialize)]
1441pub struct CulturalCharacteristics {
1442    /// Regional dialect features
1443    pub regional_features: Vec<RegionalFeature>,
1444
1445    /// Sociolinguistic markers
1446    pub sociolinguistic_markers: Vec<SociolinguisticMarker>,
1447
1448    /// Cultural speaking norms
1449    pub speaking_norms: SpeakingNorms,
1450
1451    /// Code-switching patterns
1452    pub code_switching: CodeSwitchingPatterns,
1453}
1454
1455/// Regional feature
1456#[derive(Debug, Clone, Serialize, Deserialize)]
1457pub struct RegionalFeature {
1458    /// Feature name
1459    pub name: String,
1460
1461    /// Feature type
1462    pub feature_type: RegionalFeatureType,
1463
1464    /// Feature strength
1465    pub strength: f32,
1466
1467    /// Regional distribution
1468    pub distribution: Vec<String>,
1469}
1470
1471/// Regional feature type
1472#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1473pub enum RegionalFeatureType {
1474    /// Phonological feature
1475    Phonological,
1476
1477    /// Lexical feature
1478    Lexical,
1479
1480    /// Prosodic feature
1481    Prosodic,
1482
1483    /// Pragmatic feature
1484    Pragmatic,
1485}
1486
1487/// Sociolinguistic marker
1488#[derive(Debug, Clone, Serialize, Deserialize)]
1489pub struct SociolinguisticMarker {
1490    /// Marker name
1491    pub name: String,
1492
1493    /// Social dimension
1494    pub social_dimension: SocialDimension,
1495
1496    /// Marker salience
1497    pub salience: f32,
1498
1499    /// Usage contexts
1500    pub contexts: Vec<String>,
1501}
1502
1503/// Social dimension
1504#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1505pub enum SocialDimension {
1506    /// Age-related variation
1507    Age,
1508
1509    /// Gender-related variation
1510    Gender,
1511
1512    /// Class-related variation
1513    Class,
1514
1515    /// Ethnicity-related variation
1516    Ethnicity,
1517
1518    /// Education-related variation
1519    Education,
1520
1521    /// Occupation-related variation
1522    Occupation,
1523}
1524
1525/// Speaking norms
1526#[derive(Debug, Clone, Serialize, Deserialize)]
1527pub struct SpeakingNorms {
1528    /// Turn-taking patterns
1529    pub turn_taking: TurnTakingPatterns,
1530
1531    /// Politeness strategies
1532    pub politeness_strategies: Vec<PolitenessStrategy>,
1533
1534    /// Discourse markers
1535    pub discourse_markers: Vec<DiscourseMarker>,
1536
1537    /// Cultural taboos
1538    pub cultural_taboos: Vec<CulturalTaboo>,
1539}
1540
1541/// Turn-taking patterns
1542#[derive(Debug, Clone, Serialize, Deserialize)]
1543pub struct TurnTakingPatterns {
1544    /// Overlap tolerance
1545    pub overlap_tolerance: f32,
1546
1547    /// Pause expectations
1548    pub pause_expectations: Vec<PauseExpectation>,
1549
1550    /// Interruption patterns
1551    pub interruption_patterns: Vec<InterruptionPattern>,
1552}
1553
1554/// Pause expectation
1555#[derive(Debug, Clone, Serialize, Deserialize)]
1556pub struct PauseExpectation {
1557    /// Context
1558    pub context: String,
1559
1560    /// Expected pause duration (ms)
1561    pub expected_duration: f32,
1562
1563    /// Tolerance range (ms)
1564    pub tolerance: f32,
1565}
1566
1567/// Interruption pattern
1568#[derive(Debug, Clone, Serialize, Deserialize)]
1569pub struct InterruptionPattern {
1570    /// Pattern name
1571    pub name: String,
1572
1573    /// Interruption type
1574    pub interruption_type: InterruptionType,
1575
1576    /// Acceptability
1577    pub acceptability: f32,
1578
1579    /// Context conditions
1580    pub conditions: Vec<String>,
1581}
1582
1583/// Interruption type
1584#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1585pub enum InterruptionType {
1586    /// Cooperative interruption
1587    Cooperative,
1588
1589    /// Competitive interruption
1590    Competitive,
1591
1592    /// Supportive interruption
1593    Supportive,
1594
1595    /// Corrective interruption
1596    Corrective,
1597}
1598
1599/// Politeness strategy
1600#[derive(Debug, Clone, Serialize, Deserialize)]
1601pub struct PolitenessStrategy {
1602    /// Strategy name
1603    pub name: String,
1604
1605    /// Politeness type
1606    pub politeness_type: PolitenessType,
1607
1608    /// Usage frequency
1609    pub frequency: f32,
1610
1611    /// Context appropriateness
1612    pub appropriateness: HashMap<String, f32>,
1613}
1614
1615/// Politeness type
1616#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1617pub enum PolitenessType {
1618    /// Positive politeness
1619    Positive,
1620
1621    /// Negative politeness
1622    Negative,
1623
1624    /// Bald on-record
1625    BaldOnRecord,
1626
1627    /// Off-record
1628    OffRecord,
1629}
1630
1631/// Discourse marker
1632#[derive(Debug, Clone, Serialize, Deserialize)]
1633pub struct DiscourseMarker {
1634    /// Marker text
1635    pub text: String,
1636
1637    /// Discourse function
1638    pub function: DiscourseFunction,
1639
1640    /// Usage frequency
1641    pub frequency: f32,
1642
1643    /// Prosodic characteristics
1644    pub prosody: DiscourseMarkerProsody,
1645}
1646
1647/// Discourse function
1648#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1649pub enum DiscourseFunction {
1650    /// Topic shift
1651    TopicShift,
1652
1653    /// Emphasis
1654    Emphasis,
1655
1656    /// Hesitation
1657    Hesitation,
1658
1659    /// Confirmation
1660    Confirmation,
1661
1662    /// Elaboration
1663    Elaboration,
1664
1665    /// Contrast
1666    Contrast,
1667}
1668
1669/// Discourse marker prosody
1670#[derive(Debug, Clone, Serialize, Deserialize)]
1671pub struct DiscourseMarkerProsody {
1672    /// Typical F0 pattern
1673    pub f0_pattern: Vec<f32>,
1674
1675    /// Duration characteristics
1676    pub duration: f32,
1677
1678    /// Intensity characteristics
1679    pub intensity: f32,
1680
1681    /// Pause patterns
1682    pub pause_patterns: Vec<f32>,
1683}
1684
1685/// Cultural taboo
1686#[derive(Debug, Clone, Serialize, Deserialize)]
1687pub struct CulturalTaboo {
1688    /// Taboo description
1689    pub description: String,
1690
1691    /// Taboo strength
1692    pub strength: f32,
1693
1694    /// Context specificity
1695    pub context_specificity: Vec<String>,
1696
1697    /// Violation consequences
1698    pub consequences: Vec<String>,
1699}
1700
1701/// Code-switching patterns
1702#[derive(Debug, Clone, Serialize, Deserialize)]
1703pub struct CodeSwitchingPatterns {
1704    /// Languages involved
1705    pub languages: Vec<String>,
1706
1707    /// Switching triggers
1708    pub triggers: Vec<SwitchingTrigger>,
1709
1710    /// Switching points
1711    pub switching_points: Vec<SwitchingPoint>,
1712
1713    /// Switching strategies
1714    pub strategies: Vec<SwitchingStrategy>,
1715}
1716
1717/// Switching trigger
1718#[derive(Debug, Clone, Serialize, Deserialize)]
1719pub struct SwitchingTrigger {
1720    /// Trigger type
1721    pub trigger_type: TriggerType,
1722
1723    /// Trigger strength
1724    pub strength: f32,
1725
1726    /// Context conditions
1727    pub conditions: Vec<String>,
1728}
1729
1730/// Trigger type
1731#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1732pub enum TriggerType {
1733    /// Topic change
1734    TopicChange,
1735
1736    /// Emotional state
1737    EmotionalState,
1738
1739    /// Audience change
1740    AudienceChange,
1741
1742    /// Emphasis
1743    Emphasis,
1744
1745    /// Quotation
1746    Quotation,
1747}
1748
1749/// Switching point
1750#[derive(Debug, Clone, Serialize, Deserialize)]
1751pub struct SwitchingPoint {
1752    /// Linguistic level
1753    pub level: LinguisticLevel,
1754
1755    /// Switching frequency
1756    pub frequency: f32,
1757
1758    /// Constraints
1759    pub constraints: Vec<SwitchingConstraint>,
1760}
1761
1762/// Linguistic level
1763#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1764pub enum LinguisticLevel {
1765    /// Phoneme level
1766    Phoneme,
1767
1768    /// Morpheme level
1769    Morpheme,
1770
1771    /// Word level
1772    Word,
1773
1774    /// Phrase level
1775    Phrase,
1776
1777    /// Clause level
1778    Clause,
1779
1780    /// Sentence level
1781    Sentence,
1782}
1783
1784/// Switching constraint
1785#[derive(Debug, Clone, Serialize, Deserialize)]
1786pub struct SwitchingConstraint {
1787    /// Constraint name
1788    pub name: String,
1789
1790    /// Constraint type
1791    pub constraint_type: ConstraintType,
1792
1793    /// Constraint strength
1794    pub strength: f32,
1795}
1796
1797/// Constraint type
1798#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1799pub enum ConstraintType {
1800    /// Syntactic constraint
1801    Syntactic,
1802
1803    /// Phonological constraint
1804    Phonological,
1805
1806    /// Semantic constraint
1807    Semantic,
1808
1809    /// Pragmatic constraint
1810    Pragmatic,
1811}
1812
1813/// Switching strategy
1814#[derive(Debug, Clone, Serialize, Deserialize)]
1815pub struct SwitchingStrategy {
1816    /// Strategy name
1817    pub name: String,
1818
1819    /// Strategy type
1820    pub strategy_type: StrategyType,
1821
1822    /// Usage frequency
1823    pub frequency: f32,
1824
1825    /// Effectiveness
1826    pub effectiveness: f32,
1827}
1828
1829/// Strategy type
1830#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
1831pub enum StrategyType {
1832    /// Insertion strategy
1833    Insertion,
1834
1835    /// Alternation strategy
1836    Alternation,
1837
1838    /// Congruent lexicalization
1839    CongruentLexicalization,
1840
1841    /// Flagged switching
1842    FlaggedSwitching,
1843}