mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-26 04:59:59 +00:00
Create a basic tokenizer API using a structure that mirrors the TtsTokenizer interface in the tts-dev-studio project.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <espeak-ng/espeak_ng.h>
|
||||
|
||||
#include "encoding.h"
|
||||
#include "tokenizer.h"
|
||||
#include "speech.h"
|
||||
#include "phoneme.h"
|
||||
#include "synthesize.h"
|
||||
@@ -153,6 +154,30 @@ test_fullwidth()
|
||||
assert(clause_type_from_codepoint(0xFF1F) == (CLAUSE_QUESTION | CLAUSE_OPTIONAL_SPACE_AFTER));
|
||||
}
|
||||
|
||||
void
|
||||
test_unbound_tokenizer()
|
||||
{
|
||||
printf("testing unbound tokenizer\n");
|
||||
|
||||
espeak_ng_TOKENIZER *tokenizer = create_tokenizer();
|
||||
assert(tokenizer != NULL);
|
||||
|
||||
assert(tokenizer_get_token_text(tokenizer) != NULL);
|
||||
assert(*tokenizer_get_token_text(tokenizer) == '\0');
|
||||
|
||||
assert(tokenizer_read_next_token(tokenizer) == ESPEAKNG_TOKEN_END_OF_BUFFER);
|
||||
assert(tokenizer_get_token_text(tokenizer) != NULL);
|
||||
assert(*tokenizer_get_token_text(tokenizer) == '\0');
|
||||
|
||||
assert(tokenizer_reset(tokenizer, NULL) == 0);
|
||||
|
||||
assert(tokenizer_read_next_token(tokenizer) == ESPEAKNG_TOKEN_END_OF_BUFFER);
|
||||
assert(tokenizer_get_token_text(tokenizer) != NULL);
|
||||
assert(*tokenizer_get_token_text(tokenizer) == '\0');
|
||||
|
||||
destroy_tokenizer(tokenizer);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -168,6 +193,8 @@ main(int argc, char **argv)
|
||||
test_ideographic();
|
||||
test_fullwidth();
|
||||
|
||||
test_unbound_tokenizer();
|
||||
|
||||
printf("done\n");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user