The functions module contains various utility functions, mostly for string processing, IGT element detection (redup. forms, clitic forms, etc), and tipa latex clean-up functions.
These functions moved here from Leipzig reader. They are mostly used to process IGT.
Prints a warning to stdout if number of source items does not match number of gloss items.
| Parameters: |
|
|---|---|
| Returns: | pass or fail |
| Return type: | boolean |
Returns an randomly generated id, e.g., from ‘blah’, generate ‘blah2345’.
| Parameter: | string (string) – the prefix |
|---|---|
| Returns: | a random id string |
| Return type: | string |
Custom splitter when string is mixed with the following delimiters ‘-‘, ‘=’, and ‘~’, as is common within words of IGT lines. White space and ‘.’ are not considered delimiters.
| Parameter: | s (string) – A string containing IGT delimiters |
|---|---|
| Returns: | list of items to which the delimiters apply |
| Return type: | list |
Returns an arrary (list of lists) of items within a line of IGT. (Does not assign a linguistics category to any of the items).
| Parameter: | line (string) – A string containing a line of IG |
|---|---|
| Returns: | list of items/words in the line of IGT |
| Return type: | list |
Normalize the string, getting rid of extra spaces, tabs, etc.
| Parameter: | line (string) – A typical line of IGT |
|---|---|
| Returns: | A normalized line |
| Return type: | string |
Return a list of clitics for words containing =’s as delimiters. Strategy is to locate the stem based on relative length.
| Parameter: | word (string) – A word with =’s delimiters |
|---|---|
| Returns: | A list of clitic forms |
| Return type: | list |
Return a list of reduplicated morphemes for words containing ~’s as delimiters.
| Parameter: | word (string) – A word with ~’s delimiters |
|---|---|
| Returns: | The reduplicated form |
| Return type: | string |
Return a list of infix forms, those surrounded by <...>’s.
| Parameter: | word (string) – A word with infixes delimited by <...>’s |
|---|---|
| Returns: | list of infix forms |
| Return type: | list |
Recursive function: Returns a string by concatenating all elements of a list. Inserts a space between material from each list element, and removes any delimiters, e.g., ‘-‘. For example, [[‘abc’],[‘c’],[‘d-‘,’e’]] returns ‘abc c de’
| Parameters: |
|
|---|---|
| Returns: | concatenated string of all list contents |
| Return type: | string |