class
WordMage::Analyzer
- WordMage::Analyzer
- Reference
- Object
Overview
Analyzes sets of words to extract aggregate phonological patterns.
Analyzer processes multiple words to identify statistical patterns in phoneme usage, syllable structure, complexity, and other linguistic features. The results can be used to configure generators to produce words with similar characteristics.
Example
romanization = RomanizationMap.new({
"th" => "θ", "dr" => "dr", "a" => "ɑ", "e" => "ɛ", "o" => "ɔ"
})
analyzer = Analyzer.new(romanization)
words = ["nazagon", "thadrae", "drayeki", "ora", "varanaya"]
analysis = analyzer.analyze(words)
puts analysis.average_complexity # 6.2
puts analysis.recommended_budget # 6
Defined in:
analyzer.crConstructors
-
.new(romanization_map : RomanizationMap)
Creates a new Analyzer.
Instance Method Summary
-
#analyze(words : Array(String)) : Analysis
Analyzes a set of words to extract aggregate patterns.
Constructor Detail
def self.new(romanization_map : RomanizationMap)
#
Creates a new Analyzer.
Parameters
romanization_map
: RomanizationMap for converting romanized text to phonemes
Instance Method Detail
Analyzes a set of words to extract aggregate patterns.
Parameters
words
: Array of romanized words to analyze
Returns
Analysis containing aggregate statistics and recommendations
Example
analysis = analyzer.analyze(["nazagon", "thadrae", "drayeki"])
puts analysis.phoneme_frequencies["a"] # 0.25
puts analysis.recommended_templates # ["CV", "CVC", "CCV"]