summaryrefslogtreecommitdiff
path: root/sorsyl/lib/syllable.mli
diff options
context:
space:
mode:
Diffstat (limited to 'sorsyl/lib/syllable.mli')
-rw-r--r--sorsyl/lib/syllable.mli54
1 files changed, 54 insertions, 0 deletions
diff --git a/sorsyl/lib/syllable.mli b/sorsyl/lib/syllable.mli
new file mode 100644
index 0000000..e16364f
--- /dev/null
+++ b/sorsyl/lib/syllable.mli
@@ -0,0 +1,54 @@
+(** Module for representing syllables and their components *)
+
+(** Type representing a syllable with its phonological components *)
+type t = {
+ onset : string; (** Initial consonants *)
+ medial : string; (** Medial consonants (between onset and nucleus) *)
+ nucleus : string; (** Vowel core of the syllable *)
+ coda : string; (** Final consonants *)
+ tone : string; (** Tonal information *)
+ spelling : string; (** Orthographic representation *)
+ start_idx : int; (** Start position in the word *)
+ end_idx : int; (** End position in the word *)
+ stressed : bool; (** Whether this syllable is stressed *)
+}
+
+(** Empty syllable constant *)
+val empty : t
+
+(** Create a syllable with specified components *)
+val create :
+ ?onset:string ->
+ ?medial:string ->
+ ?nucleus:string ->
+ ?coda:string ->
+ ?tone:string ->
+ ?spelling:string ->
+ ?start_idx:int ->
+ ?end_idx:int ->
+ ?stressed:bool ->
+ unit -> t
+
+(** Get the complete syllable string *)
+val all : t -> string
+
+(** Get the rhyme (medial + nucleus + coda) *)
+val rhyme : t -> string
+
+(** Check if the nucleus contains length marker *)
+val is_long : t -> bool
+
+(** Finalize a syllable - determine if it's stressed based on position relative to stress marker *)
+val finalize : t -> end_idx:int -> stress_idx:int -> t
+
+(** Pretty print a syllable with Unicode box drawing *)
+val pretty_print : t -> string
+
+(** Convert to string representation *)
+val to_string : t -> string
+
+(** Append operations *)
+val append_onset : t -> string -> t
+val append_nucleus : t -> string -> t
+val append_coda : t -> string -> t
+val append_tone : t -> string -> t \ No newline at end of file