forked from Blendman974/faceclaw
iOS porting: Work around missing punctuation between segments in multi-segment Siri voice input
This commit is contained in:
1 parent
319d3dc44b
commit
16764359bd
2 files changed
+51
-2
No files matched your search
@@ -24,5 +24,32 @@ int main(void) { @autoreleasepool {
|
||||
check([t updateText:@"Ice cream is good." start:0.5 duration:2 settled:YES final:NO], @"Ice cream is good.");
|
||||
check([t updateText:@"Next sentence" start:4 duration:1 settled:NO final:NO], @"Ice cream is good. Next sentence");
|
||||
check([t updateText:@"Next sentence." start:4 duration:1 settled:YES final:NO], @"Ice cream is good. Next sentence.");
|
||||
t = [FaceclawSpeechTranscript new];
|
||||
check([t updateText:@"First sentence" start:0 duration:1 settled:YES final:NO], @"First sentence");
|
||||
check([t updateText:@"Second" start:0 duration:0 settled:NO final:NO], @"First sentence. Second");
|
||||
check([t updateText:@"Second sentence" start:2 duration:1 settled:YES final:NO], @"First sentence. Second sentence");
|
||||
check([t updateText:@"Third" start:0 duration:0 settled:NO final:NO], @"First sentence. Second sentence. Third");
|
||||
check([t updateText:@"Third" start:4 duration:1 settled:YES final:NO], @"First sentence. Second sentence. Third");
|
||||
// A cumulative final without punctuation must not erase inferred joins.
|
||||
check([t updateText:@"First sentence Second sentence Third" start:0 duration:5 settled:YES final:YES], @"First sentence. Second sentence. Third");
|
||||
// Lowercase continuation: a pause alone does not introduce a period.
|
||||
t = [FaceclawSpeechTranscript new];
|
||||
check([t updateText:@"We should" start:0 duration:1 settled:YES final:NO], @"We should");
|
||||
check([t updateText:@"keep going" start:2 duration:1 settled:YES final:NO], @"We should keep going");
|
||||
// Existing punctuation (including non-ASCII) always wins.
|
||||
for (NSString *punctuation in @[@".", @"?", @"!", @",", @":", @";", @"—", @"…", @"。", @"!"]) {
|
||||
t = [FaceclawSpeechTranscript new];
|
||||
NSString *first = [@"First" stringByAppendingString:punctuation];
|
||||
[t updateText:first start:0 duration:1 settled:YES final:NO];
|
||||
check([t updateText:@"Next" start:2 duration:1 settled:YES final:NO], [first stringByAppendingString:@" Next"]);
|
||||
}
|
||||
t = [FaceclawSpeechTranscript new];
|
||||
[t updateText:@"He said “yes”" start:0 duration:1 settled:YES final:NO];
|
||||
check([t updateText:@"“Then go”" start:2 duration:1 settled:YES final:NO], @"He said “yes.” “Then go”");
|
||||
// A revised lowercase start removes the inferred period; raw text survives.
|
||||
t = [FaceclawSpeechTranscript new];
|
||||
[t updateText:@"Keep" start:0 duration:1 settled:YES final:NO];
|
||||
check([t updateText:@"Going" start:2 duration:1 settled:NO final:NO], @"Keep. Going");
|
||||
check([t updateText:@"going" start:2 duration:1 settled:YES final:NO], @"Keep going");
|
||||
puts("PASS: utterance accumulation, live revisions, repeated words, duplicate/cumulative results and empty final callbacks");
|
||||
} return 0; }
|
||||
Reference in new issue
Block a user