我目前正在尝试在Anuglar应用程序中实现speechToText。
我正在使用以下库:
- https://www.npmjs.com/package/watson-speech
- https://www.npmjs.com/package/watson-developer-cloud
如果我启动项目,我会收到以下错误:
ERROR in ./node_modules/watson-speech/speech-to-text/content-type.js
Module not found: Error: Can't resolve 'path' in 'C:Projektedemonode_moduleswatson-speechspeech-to-text'
ERROR in ./node_modules/microphone-stream/microphone-stream.js
Module not found: Error: Can't resolve 'stream' in 'C:Projektedemonode_modulesmicrophone-stream'
ERROR in ./node_modules/watson-speech/speech-to-text/recognize-microphone.js
Module not found: Error: Can't resolve 'stream' in 'C:Projektedemonode_moduleswatson-speechspeech-to-text'
ERROR in ./node_modules/watson-speech/speech-to-text/format-stream.js
Module not found: Error: Can't resolve 'stream' in 'C:Projektedemonode_moduleswatson-speechspeech-to-text'
ERROR in ./node_modules/watson-speech/speech-to-text/webaudio-l16-stream.js
Module not found: Error: Can't resolve 'stream' in 'C:Projektedemonode_moduleswatson-speechspeech-to-text'
ERROR in ./node_modules/watson-speech/speech-to-text/recognize-stream.js
Module not found: Error: Can't resolve 'stream' in 'C:Projektedemonode_moduleswatson-speechspeech-to-text'
ERROR in ./node_modules/watson-speech/speech-to-text/speaker-stream.js
Module not found: Error: Can't resolve 'stream' in 'C:Projektedemonode_moduleswatson-speechspeech-to-text'
ERROR in ./node_modules/watson-speech/speech-to-text/result-stream.js
Module not found: Error: Can't resolve 'stream' in 'C:Projektedemonode_moduleswatson-speechspeech-to-text'
ERROR in ./node_modules/watson-speech/speech-to-text/writable-element-stream.js
Module not found: Error: Can't resolve 'stream' in 'C:Projektedemonode_moduleswatson-speechspeech-to-text'
我的导入声明如下:
import * as recognizeMicrophone from 'watson-speech/speech-to-text/recognize-microphone';
import {WatsonService} from '../../../services/watson.service';
我正在通过节点获取令牌。JS后端,这是有效的(我想(,当我试图重新配置麦克风时,问题出现了:
recognizeMicrophone({
token: token,
format: true,
extractResults: true,
objectMode: true
});
我是否错过了一些依赖关系?
欢迎提出任何建议。
尝试使用import recognizeMicrophone from 'watson-speech/speech-to-text/recognize-microphone';
而不是import * as recognizeMicrophone from ....
。你也可以在这里看到语音sdk的用法示例。`