-
Notifications
You must be signed in to change notification settings - Fork 3
Function Guide
key:
{file_path} = path to the file you're loading.
{phone} = any phoneme
{phone_type} = a phoneme specification, ex: 'vowel', 'consonant', 'stop', 'affricate', etc.
{factor} = amount to do something by.
labbu is currently in development, but here is a rundown of what you can do with each function!
Initializes the module. You can give it the argument "lang" when initializing to load a custom phonetic dictionary. To do so, you'd define lang with a path to a phoneme text file, which can be written like so:
AP stop
SP stop
aa vowel
b stop
ch affricate
f fricative
You can define your phoneme with any one keyword, which can be used in other functions to check if the previous/next phoneme is a specific type, etc.
Loads the lab into the labbu object. You can save the lab as a list instead by assigning this function to a list object.
Loads the lab from a Praat TextGrid. There's no difference from loading it this way in terms of using labbu.
Exports the current lab to ".lab" file at the path you specify.
Unloads the lab, not necessary but you never know if you'll need it.
Prints a list to the command line of the loaded phonetic dictionary.
Prints to the command line every index that contains a phoneme not listed in the language dictionary.
Checks if the index given is the first or last in the label (mainly to prevent index errors)
Returns an int of the length of the lab file.
Changes the phone at the given index "i" to any phone (does not check the dictionary... might add that.)
Merges the label at index "i" with the next, and replaces it with "{phone}".
If the phoneme is palatal (ky, gy, ry, etc), it will split it into to ([ky] -> [k y]) and places [y] a set amount into the vowel. This was mostly to convert datasets with palatal vowels to be used in multi-singer models without palatal vowels. (Example: JPN -> ENG) The default value is 355000, which I found to be a good middle ground after looking at labels I manually depalatilized and took an average amount.
Returns an int of the length of a value at index "i"
Splits a label completely in half, and changes the phoneme in the first label to {phone1} and the second to {phone2}.
Replaces all instances of {phone1} in the lab with {phone2}
Returns true if the phoneme given is the type given. This references the default dictionary of phonemes, but has exceptions for plosives, palatal, and silence currently. If it runs into an error, it will return "False" by default to avoid any stoppages.
Returns the current label at index "i"
Returns the label before index "i" (except if "i" is the first label)
Returns the label after index "i" (except if "i" is the last label)
Cleans the phoneme at index "i". This will clean the string of any numbers/tone-indicators and will turn uppercase letters to lowercase.
Cleans all phonemes in the lab.
Running this function ensures that there are no overlapping phonemes.
Returns the mean length of every instance of {phone} in the lab as an int.
Will adjust the end of lab "i" by amount given in {factor}. This will also ensure the start of the next label is changed, but currently does not prevent overlapping (that's on the list 😭)
Checks if the phoneme at index "i" is between 2 vowels.
Currently, replaces "pau" with "SP" and "br" with "AP".
Does the opposite of the last one.
Ensures any "sp" or "ap" labels are capitalized.
This is all of the currently working functions in labbu, but I'm still adding more!