整个课程和数据UI重新设计版本
This commit is contained in:
@@ -41,7 +41,8 @@ void main() {
|
||||
|
||||
final recognizer = sherpa_onnx.OfflineRecognizer(recognizerConfig);
|
||||
|
||||
const testWave = '/tmp/sherpa_test/sherpa-onnx-zipformer-small-en-2023-06-26/test_wavs/0.wav';
|
||||
const testWave =
|
||||
'/tmp/sherpa_test/sherpa-onnx-zipformer-small-en-2023-06-26/test_wavs/0.wav';
|
||||
if (File(testWave).existsSync()) {
|
||||
final wave = sherpa_onnx.readWave(testWave);
|
||||
expect(wave.samples.isNotEmpty, isTrue);
|
||||
@@ -57,19 +58,27 @@ void main() {
|
||||
recognizer.free();
|
||||
});
|
||||
|
||||
test('SherpaSttService singleton initializes and transcribes cleanly', () async {
|
||||
final ready = await SherpaSttService.instance.initialize(nativeLibDir: macosDir);
|
||||
expect(ready, isTrue);
|
||||
expect(SherpaSttService.instance.isReady, isTrue);
|
||||
test(
|
||||
'SherpaSttService singleton initializes and transcribes cleanly',
|
||||
() async {
|
||||
final ready = await SherpaSttService.instance.initialize(
|
||||
nativeLibDir: macosDir,
|
||||
);
|
||||
expect(ready, isTrue);
|
||||
expect(SherpaSttService.instance.isReady, isTrue);
|
||||
|
||||
const testWave = '/tmp/sherpa_test/sherpa-onnx-zipformer-small-en-2023-06-26/test_wavs/0.wav';
|
||||
if (File(testWave).existsSync()) {
|
||||
final transcribed = await SherpaSttService.instance.transcribeWav(testWave);
|
||||
expect(transcribed, isNotNull);
|
||||
print('SherpaSttService transcribed: $transcribed');
|
||||
expect(transcribed!.toLowerCase().contains('nightfall'), isTrue);
|
||||
// SenseVoice tags should be stripped
|
||||
expect(transcribed.contains('<|'), isFalse);
|
||||
}
|
||||
});
|
||||
const testWave =
|
||||
'/tmp/sherpa_test/sherpa-onnx-zipformer-small-en-2023-06-26/test_wavs/0.wav';
|
||||
if (File(testWave).existsSync()) {
|
||||
final transcribed = await SherpaSttService.instance.transcribeWav(
|
||||
testWave,
|
||||
);
|
||||
expect(transcribed, isNotNull);
|
||||
print('SherpaSttService transcribed: $transcribed');
|
||||
expect(transcribed!.toLowerCase().contains('nightfall'), isTrue);
|
||||
// SenseVoice tags should be stripped
|
||||
expect(transcribed.contains('<|'), isFalse);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user