使用Dialog服务集成Watson NLC服务示例

时间:2016-07-05 19:22:16

标签: ibm-watson watson-dialog

From the Watson Dialog document,表示与NLC连接的配置设置。但是如果没有运行的示例应用程序,很难理解它是如何工作的。大多数示例可以使用Google搜索没有这样的设置。我试图找到一些使用“分类器”设置和'INTENT:{xxxxxx}'设置等指示设置的示例。如果有人可以提供帮助,那将是非常好的,非常感谢。

1 个答案:

答案 0 :(得分:0)

以下是使用demo NLC training data的示例。将该文本保存为CSV文件。

  1. 创建您的NLC服务。服务名称并不重要。

  2. 创建后,单击" Access Beta Toolkit"。您需要再次登录,并允许工具包访问NLC服务。

  3. 点击"上传培训数据"按钮。选择您之前保存的CSV文件。如果它有效,你会看到你的意图+问题。如果失败,最常见的问题是没有给它一个csv文件扩展名。

  4. 点击"创建分类器"。名字并不重要。

  5. 单击训练数据/分类器以查看是否已完成编译。完成可能需要一些时间。

  6. 分类器完成编译后,应显示分类器ID 值。示例:3d84bfx43-nlc-10356

  7. 将下面的文本复制到XML文件中。您在哪里看到CLASSIFIER_ID_GOES_HERE更改为您的分类器ID。

    <?xml version="1.0" encoding="UTF-8"?>
    <dialog xsi:noNamespaceSchemaLocation="WatsonDialogDocument_1.1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <flow>
            <folder label="Main">
                <output>
                    <prompt selectionType="RANDOM">
                        <item>Enter your weather related question.</item>
                    </prompt>
                    <getUserInput>
                        <search ref="folder_200143"/>
                        <default>
                            <output>
                                <prompt selectionType="RANDOM">
                                    <item>I couldn't determine what you are asking about.</item>
                                </prompt>
                            </output>
                        </default>
                    </getUserInput>
                </output>
            </folder>
            <folder label="Library">
                <folder label="NLC Intents" id="folder_200143">
                    <input isAutoLearnCandidate="false" isRelatedNodeCandidate="true">
                        <grammar>
                            <item>conditions</item>
                        </grammar>
                        <output>
                            <prompt selectionType="RANDOM">
                                <item>I believe you are asking about conditions. </item>
                            </prompt>
                        </output>
                    </input>
                    <input>
                        <grammar>
                            <item>temperature</item>
                        </grammar>
                        <output>
                            <prompt selectionType="RANDOM">
                                <item>I believe you are asking about temperture. </item>
                            </prompt>
                        </output>
                    </input>
                </folder>
            </folder>
            <folder label="Global"/>
            <folder label="Concepts"/>
        </flow>
        <constants>
            <var_folder name="Home"/>
        </constants>
        <variables>
            <var_folder name="Home">
                <var name="CLASSIFIER_CLASS_0" type="TEXT" description="auto-created"/>
                <var name="CLASSIFIER_CONF_0" type="TEXT" description="auto-created"/>
                <var name="CLASSIFIER_CLASS_1" type="TEXT" description="auto-created"/>
                <var name="CLASSIFIER_CONF_1" type="TEXT" description="auto-created"/>
            </var_folder>
        </variables>
        <settings>
            <setting name="AUTOLEARN" type="USER">false</setting>
            <setting name="LANGUAGE" type="USER">en-US</setting>
            <setting name="RESPONSETIME" type="USER">-2</setting>
            <setting name="MAXAUTOLEARNITEMS" type="USER">4</setting>
            <setting name="NUMAUTOSETRELATED" type="USER">0</setting>
            <setting name="TIMEZONEID" type="USER">Australia/Sydney</setting>
            <setting name="AUTOSETRELATEDNODEID" type="USER">0</setting>
            <setting name="INPUTMASKTYPE" type="USER">0</setting>
            <setting name="CONCEPTMATCHING" type="USER">0</setting>
            <setting name="DNR_NODE_ID">-15</setting>
            <setting name="MULTISENT">0</setting>
            <setting name="USE_CONCEPTS">3</setting>
            <setting name="ENTITIES_SCOPE">3</setting>
            <setting name="USER_LOGGING">2</setting>
            <setting name="USE_TRANSLATIONS">3</setting>
            <setting name="USE_STOP_WORDS">3</setting>
            <setting name="USE_SPELLING_CORRECTIONS">3</setting>
            <setting name="USE_AUTOMATIC_STOPWORDS_DETECTION">0</setting>
            <setting name="PLATFORM_VERSION">10.1</setting>
            <setting name="UI_COLOUR"></setting>
            <setting name="PARENT_ACCOUNT"></setting>
            <setting name="AL_NONE_LABEL">None of the above</setting>
            <setting name="CLS_SEARCH_MODE">0</setting>
            <setting name="CLS_MODEL">0</setting>
            <setting name="CLS_ENDPOINT"></setting>
            <setting name="CLS_USERNAME"></setting>
            <setting name="CLS_PASSWORD"></setting>
            <setting name="CLS_MODELNAME">CLASSIFIER_ID_GOES_HERE</setting>
            <setting name="CLS_ADVANCED_SETTINGS">false</setting>
            <setting name="CLS_MAXNBEST">3</setting>
            <setting name="CLS_USE_OFFTOPIC">false</setting>
            <setting name="DEFAULT_DNR_RETURN_POINT_CANDIDATE">-1</setting>
        </settings>
        <specialSettings>
            <specialSetting label="DNR Join Statement">
                <variations/>
            </specialSetting>
            <specialSetting label="AutoLearn Statement">
                <variations/>
            </specialSetting>
        </specialSettings>
    </dialog>
    
  8. 将该文件上传到对话服务并进行测试。