节点JS的 Aristech STT - 客户端
这是Aristech STT-Server的节点JS客户端执行.
安装
npm install @aristech-org/stt-client
使用量
import { SttClient } from '@aristech-org/stt-client'
const client = new SttClient({
apiKey: process.env['ARISTECH_STT_API_KEY'], // This is the default and can be omitted
})
const results = await client.recognizeFile('path/to/audio/file.wav')
console.log(results.map(r => r.chunks[0].alternatives[0].text).join('\n'))
报告有好几个例子 实例 目录 :
- 识别.ts:与上例大致相同.
- 流出中.ts:演示如何在接收临时结果的同时将音频流到服务器.
- 型号.ts: 演示如何从服务器获取可用的模型.
- nlp 函数数: 演示如何列出已配置的 NLP- Servers 和对应函数 .
- nlp 处理器:通过使用STT-Server作为代理来演示如何在文本上进行NLP处理.
- 账户.ts: 演示如何从服务器获取账户信息.
运行示例时使用 npx tsx。例如:
npx tsx examples/streaming.ts
API 密钥
如果您没有获得 API 密钥而是一个符号, 秘密和主机, 您可以和我们一起生成 API 密钥 API 密钥生成器。 。 。 .
或者您仍然可以手动提供连接选项 .
import { SttClient } from '@aristech-org/stt-client'
const client = new SttClient({
host: 'stt.example.com:443',
auth: {
token: 'your-token',
secret: 'your-secret'
}
})
构建
要重建原始文件中生成的打字符文件, 运行 :
npm run generate
要建立图书馆,运行:
npm run build