2016-07-05 68 views

回答

0

以下是使用demo NLC training data的示例。將該文本保存爲CSV文件。

  1. 創建您的NLC服務。服務的名稱並不重要。

  2. 創建後,點擊「Access Beta工具包」。您將需要再次登錄,並允許工具包訪問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. 將該文件上傳到您的對話服務並對其進行測試。

+0

選項2將開始使用「對話」服務。因爲這使得構建起來容易很多。它也支持實體和意圖。 –

+0

非常好!選項1有效;你能否詳細說明選項2的「對話」服務? – nyker

+2

我強烈建議選項2.對話服務可以在bluemix上找到: https://console.ng.bluemix.net/catalog/services/conversation/ ,是我們發佈的一項新服務,它結合了NLC技術使用更精簡,更靈活的對話模型。由於這兩種技術相結合,使用起來更容易,並且爲對話而不是XML提供了易用的工具體驗。 請注意,目前它處於試驗階段,即將進入GA階段。但這意味着對話和實體文檔還沒有完全準備好,而且有些功能尚未提供。 – Mitch

相關問題