SPRAAK
|
Data Structures | |
struct | SprCorSegOD |
struct | SprCorpusEntry |
struct | SprCorpusInfo |
struct | SprSegEntry |
A single segment. More... | |
struct | SprSegmentation |
A segmentation, i.e. a list of segments. More... | |
Macros | |
#define | spr_bss_round(x) |
returns the rounded value of x More... | |
Functions | |
int | spr_int_max (int a, int b) |
long | spr_long_max (long a, long b) |
ssize_t | spr_ssize_max (ssize_t a, ssize_t b) |
unsigned int | spr_uint_max (unsigned int a, unsigned int b) |
unsigned long | spr_ulong_max (unsigned long a, unsigned long b) |
size_t | spr_size_max (size_t a, size_t b) |
float | spr_float_max (float a, float b) |
double | spr_double_max (double a, double b) |
int | spr_int_min (int a, int b) |
long | spr_long_min (long a, long b) |
ssize_t | spr_ssize_min (ssize_t a, ssize_t b) |
unsigned int | spr_uint_min (unsigned int a, unsigned int b) |
unsigned long | spr_ulong_min (unsigned long a, unsigned long b) |
size_t | spr_size_min (size_t a, size_t b) |
float | spr_float_min (float a, float b) |
double | spr_double_min (double a, double b) |
void | spr_corpus_ctb_to_dtb (double btime, double etime, int totalnfr, double fshift, int *skip, int *nfr) |
Convert continuous time base to discrete time base. More... | |
void * | spr_corpus_close (SprCorpusInfo *info) |
SprCorpusInfo * | spr_corpus_open (const char *fname) |
SprCorpusEntry * | spr_corpus_entry_read (SprCorpusInfo *info) |
int | spr_corpus_range_adjust (SprCorpusInfo *info, const char *rangestr) |
void * | spr_seg_free (SprSegmentation *seg) |
SprSegEntry * | spr_seg_new_entry (SprSegmentation *seg, const char *phon) |
SprSegmentation * | spr_seg_alloc (const char *name, int nseg) |
int | spr_seg_write (SprStream *dest, const SprSegmentation *seg, int timebase, double fshift) |
SprSegmentation * | spr_seg_read (SprCorpusInfo *info) |
int | spr_seg_range_adjust (SprCorpusInfo *info, const char *rangestr) |
Variables | |
const char *const | spr_bss_str_tracktype [SPR_TRACKTYPE_NTRACKTYPE+1] |
const SprOptDesc | spr_cor_seg_od [] |
#define spr_bss_round | ( | x | ) |
returns the rounded value of x
anonymous enum |
file formats.
enum SPR_PARAMTYPE |
enum SPR_TRACKTYPE |
anonymous enum |
int spr_int_max | ( | int | a, |
int | b | ||
) |
long spr_long_max | ( | long | a, |
long | b | ||
) |
ssize_t spr_ssize_max | ( | ssize_t | a, |
ssize_t | b | ||
) |
unsigned int spr_uint_max | ( | unsigned int | a, |
unsigned int | b | ||
) |
unsigned long spr_ulong_max | ( | unsigned long | a, |
unsigned long | b | ||
) |
size_t spr_size_max | ( | size_t | a, |
size_t | b | ||
) |
float spr_float_max | ( | float | a, |
float | b | ||
) |
double spr_double_max | ( | double | a, |
double | b | ||
) |
int spr_int_min | ( | int | a, |
int | b | ||
) |
long spr_long_min | ( | long | a, |
long | b | ||
) |
ssize_t spr_ssize_min | ( | ssize_t | a, |
ssize_t | b | ||
) |
unsigned int spr_uint_min | ( | unsigned int | a, |
unsigned int | b | ||
) |
unsigned long spr_ulong_min | ( | unsigned long | a, |
unsigned long | b | ||
) |
size_t spr_size_min | ( | size_t | a, |
size_t | b | ||
) |
float spr_float_min | ( | float | a, |
float | b | ||
) |
double spr_double_min | ( | double | a, |
double | b | ||
) |
void spr_corpus_ctb_to_dtb | ( | double | btime, |
double | etime, | ||
int | totalnfr, | ||
double | fshift, | ||
int * | skip, | ||
int * | nfr | ||
) |
Convert continuous time base to discrete time base.
The begin and end times are converted to a number of frames to skip and a number of frames to process. During the conversion, the begin and end times are changed to fall on the nearest frame border.
Continuous timebase: |______|______|______|______|______|______| ^ ^ Discrete timebase: |______|______|______|______|______|______| ^ ^
btime | begin time |
etime | end time |
totalnfr | total number of frames in file |
fshift | frame shift |
skip | frames to skip |
nfr | frames to process |
void* spr_corpus_close | ( | SprCorpusInfo * | info | ) |
Close a corpus file and release the resources. Do not use the corpus struct after this function has been called. Does nothing if info equals NULL
.
info | a corpus struct describing an open corpus file |
SprCorpusInfo* spr_corpus_open | ( | const char * | fname | ) |
Open a corpus or segmentation file for reading. Allocate the resources for a SprCorpusInfo object, and reads and processes the corpus/segmentation file header.
fname | file name of a corpus or segmentation file to be opened for reading |
SprCorpusEntry* spr_corpus_entry_read | ( | SprCorpusInfo * | info | ) |
Read the next entry from an open corpus or segmentation file. Segmentation files are treaded as corpus files, and hence only a single segment (line) is read per call.
NULL
on error or if the EOF
is reached or if all entries available (as indicated in the header) are read. info | Corpus file to read from. |
int spr_corpus_range_adjust | ( | SprCorpusInfo * | info, |
const char * | rangestr | ||
) |
Adjust the stream read pointer and the number of entries in info according to the sub-range specified in rangestr. The sub-range specifier rangestr has the format
which indicates that only the entries in the range [<start>,<stop>[ must be handled, i.e. all entries X : <start> <= X < <stop>. Counting starts at 0.
void* spr_seg_free | ( | SprSegmentation * | seg | ) |
Free the given segmentation. Does nothing when seg is NULL
.
seg | Segmentation to free. |
SprSegEntry* spr_seg_new_entry | ( | SprSegmentation * | seg, |
const char * | phon | ||
) |
Add a new segment to the list of segments in the given segmentation seg. The new element is initialized to a zero-length segment starting at time 0. The symbol name phon may be NULL
.
seg | Segmentation that must be extended. |
phon | Symbol name (typically a phone) for the new segment. |
SprSegmentation* spr_seg_alloc | ( | const char * | name, |
int | nseg | ||
) |
Allocate and initialize a segmentation structure. The nseg segmentation elements are initialized to zero-length segments starting at time 0 with a NULL symbol name.
name | Name of the segmentation (e.g. file name). |
nseg | Number of segments to allocate. |
int spr_seg_write | ( | SprStream * | dest, |
const SprSegmentation * | seg, | ||
int | timebase, | ||
double | fshift | ||
) |
Write the segmentation seg to the stream dest in the desired format. Parameter timebase can be SPR_BSS_CONTINUOUS
or SPR_BSS_DISCRETE
. Parameter fshift is ignored when using a continuous timebase.
-1
on error. dest | Destination stream. |
seg | The segmentation to be serialized. |
timebase | Use discrete or continuous timebase. |
fshift | Frame shift for discrete timebase. |
SprSegmentation* spr_seg_read | ( | SprCorpusInfo * | info | ) |
Read the next segmentation from the stream info. All reads must be sequential. This function cannot be intermixed with any other operation on the same stream (e.g. seeking, or reading a corpus entry).
NULL
on error or if the EOF
is reached or if all entries available (as indicated in the header) are read. The flag info->err will be set if an error occurred. info | Segmentation file to read from. |
int spr_seg_range_adjust | ( | SprCorpusInfo * | info, |
const char * | rangestr | ||
) |
Identical to spr_corpus_range_adjust() but when reading segmentations (spr_seg_read()) instead of single (corpus) entries (spr_corpus_entry_read()).
const char* const spr_bss_str_tracktype[SPR_TRACKTYPE_NTRACKTYPE+1] |
const SprOptDesc spr_cor_seg_od[] |
Description of all program arguments related to working with data described by a corpus or segementation file.