diff options
Diffstat (limited to 'sorsyl/lib/sonority.mli')
-rw-r--r-- | sorsyl/lib/sonority.mli | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sorsyl/lib/sonority.mli b/sorsyl/lib/sonority.mli new file mode 100644 index 0000000..3e9166e --- /dev/null +++ b/sorsyl/lib/sonority.mli @@ -0,0 +1,47 @@ +(** Sonority module for determining the sonority of phonetic segments. + + This module provides functionality to determine the sonority of IPA + (International Phonetic Alphabet) segments on a scale of 1 to 9, where: + - 9: Low vowels (most sonorous) + - 8: High vowels + - 7: Glides/approximants + - 6: Liquids + - 5: Nasals + - 4: Voiced fricatives + - 3: Voiceless fricatives + - 2: Voiced stops + - 1: Voiceless stops (least sonorous) + + Example usage: + {[ + (* Initialize the module with the data directory *) + Sonority.init "./data";; + + (* Get sonority values for IPA segments *) + Sonority.sonority "a";; + + (* Returns 9 - low vowel *) + Sonority.sonority "p";; + + (* Returns 1 - voiceless stop *) + Sonority.sonority "l" (* Returns 6 - liquid *) + ]} *) + +val init : string -> unit +(** Initialize the sonority module with the data directory. This must be called + before using other functions. + @param data_dir The directory containing the ipa_all.csv file + @raise Sys_error if the CSV file cannot be found or read *) + +val sonority : string -> int +(** Get the sonority value (1-9) for an IPA character. + @param ipa The IPA character/segment to analyze + @return The sonority value between 1 and 9 + @raise Failure if the IPA segment is not recognized *) + +val sonority_from_features : Feature.segment -> int +(** Get the sonority value from a feature specification. This is useful when you + already have the phonological features of a segment and don't need to look + it up by IPA symbol. + @param segment The list of feature specifications + @return The sonority value between 1 and 9 *) |