【问题标题】:How to make bot understand that I'm talking hindi in webchat speech如何让机器人明白我在网络聊天中说的是印地语
【发布时间】:2020-07-30 15:08:11
【问题描述】:

我正在尝试构建一个印地语(hi-IN)语音聊天机器人..该机器人在网络聊天中以英语工作,但任何人都可以帮助我如何让机器人了解我说的是印地语,然后它会被转换使用认知语音服务转换成印地语文本

 <script>
        (async function () {
            const res = await fetch('https://directline.botframework.com/v3/directline/tokens/generate', {
                method: 'POST',
                headers: new Headers({
                    'Authorization': 'Bearer 5********'
                })
            });
            const { token } = await res.json();

            const store = window.WebChat.createStore(
                {},
                ({ dispatch }) => next => action => {
                    if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
                        dispatch({
                            type: 'WEB_CHAT/SEND_EVENT',
                            payload: {
                                name: 'webchat/join',
                                value: { username: "UserName" }
                            }
                        });
                    }
                    return next(action);
                }
            );

            window.WebChat.renderWebChat({
                directLine: window.WebChat.createDirectLine({ token }),
                webSpeechPonyfillFactory: window.WebChat.createBrowserWebSpeechPonyfillFactory(),
                styleOptions: {
                    hideUploadButton: true,
                    bubbleBackground: '#cccccc',
                    bubbleBorder: 'solid 1px #E6E6E6'
                },
                store
            }, document.getElementById('webchat'));

            document.querySelector('#webchat > *').focus();
        })().catch(err => console.error(err));</script>
    ```

【问题讨论】:

  • 您的问题解决了吗?
  • @ranusharao 是的

标签: c# botframework speech-recognition direct-line-botframework web-chat


【解决方案1】:

我不太确定我是否正确理解了您的问题,但您是否尝试过类似这样的简单操作:

...
const chatLocale = window.navigator.language;
...
window.WebChat.renderWebChat({
    directLine: directline,
    locale: chatLocale,
    store,
    styleOptions: {
...

您可能还想在您的网络聊天/加入活动中传递chatLocale

【讨论】:

    猜你喜欢
    • 2017-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多