class
WordMage::WordAnalyzer
- WordMage::WordAnalyzer
- Reference
- Object
Overview
Analyzes individual words to extract phonological patterns and structure.
WordAnalyzer takes romanized words and uses a romanization map to reverse-engineer the phonemic structure, detecting syllables, clusters, hiatus sequences, and calculating complexity scores.
Example
romanization = RomanizationMap.new({
"th" => "θ", "dr" => "dr", "a" => "ɑ", "e" => "ɛ", "o" => "ɔ"
})
analyzer = WordAnalyzer.new(romanization)
analysis = analyzer.analyze("thadrae")
puts analysis.syllable_count # 2
puts analysis.clusters # ["θ", "dr"]
Defined in:
word_analyzer.crConstructors
-
.new(romanization_map : RomanizationMap)
Creates a new WordAnalyzer.
Instance Method Summary
-
#analyze(word : String) : WordAnalysis
Analyzes a romanized word to extract phonological structure.
Constructor Detail
def self.new(romanization_map : RomanizationMap)
#
Creates a new WordAnalyzer.
Parameters
romanization_map
: RomanizationMap for converting romanized text to phonemes
Instance Method Detail
def analyze(word : String) : WordAnalysis
#
Analyzes a romanized word to extract phonological structure.
Parameters
word
: The romanized word to analyze
Returns
WordAnalysis containing detailed structural information
Example
analysis = analyzer.analyze("nazagon")
puts analysis.syllable_count # 3
puts analysis.consonant_count # 4
puts analysis.vowel_count # 3