malsami library

Malsami Dart - A Grapheme-to-Phoneme (G2P) engine for Flutter

This is a Dart implementation of the Malsami G2P engine, focusing on English. It converts text into phonetic representations that can be used for text-to-speech synthesis.

Classes

EnglishG2P
English G2P (Grapheme-to-Phoneme) engine
Lexicon
Lexicon class for English G2P
MToken
Token class for Malsami G2P engine
TokenContext
Token context class for tracking contextual information during processing
Underscore
Underscore class for token metadata

Extensions

StringExtension on String
Extension to add capitalize method to String

Constants

addSymbols → const Map<String, String>
Additional symbols and their word representations
consonants → const Set<String>
Consonants
currencies → const Map<String, List<String>>
Currency symbols and their word representations
diphthongs → const Set<String>
gbVocab → const Set<String>
British English phoneme set
ordinals → const Set<String>
Ordinal suffixes
primaryStress → const String
Stress marks
puncts → const Set<String>
Punctuation characters
punctTagPhonemes → const Map<String, String>
Punctuation tag phonemes mapping
punctTags → const Set<String>
Punctuation tags
secondaryStress → const String
stresses → const List<String>
subtokenJunks → const Set<String>
Subtoken junk characters
symbols → const Map<String, String>
Common symbols and their word representations
usVocab → const Set<String>
American English phoneme set
vowels → const Set<String>
Vowels

Properties

digitRegex RegExp
Regular expression for digits
final
linkRegex RegExp
Regular expression for links in markdown format
final
nonQuotePuncts Set<String>
Non-quote punctuation characters
final

Functions

applyStress(String ps, double? stress) String
Apply stress to a phoneme sequence
containsAnyVowel(String text) bool
Check if a string contains any vowel
isDigit(String text) bool
Check if a string consists only of digits
mergeTokens(List<MToken> tokens, [String? unk]) MToken
Merge a list of tokens into a single token
restress(String ps) String
Reposition stress marks to be before vowels
stressWeight(String ps) int
Calculate the stress weight of a phoneme sequence