0
我已經在watson對話框上工作了幾天,並且我可以在遵循幾個教程後使用.xml
文件創建一個對話框。使用json文件創建對話框
<?xml version="1.0" encoding="UTF-8"?>
<dialog xsi:noNamespaceSchemaLocation="WatsonDialogDocument_1.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<flow>
<folder label="Main">
<output>
<prompt selectionType="RANDOM">
<item>Hi, I'll show you the latest buzz around a topic of your choice. What topic are you interested in?</item>
</prompt>
<goto ref="getUserInput_2442994"/>
</output>
<output>
<prompt selectionType="RANDOM">
<item>Bye</item>
</prompt>
<getUserInput id="getUserInput_2442994">
<search ref="folder_2442998"/>
</getUserInput>
</output>
</folder>
<folder label="Library">
<folder label="Live Content" id="folder_2447777">
<output>
<prompt selectionType="RANDOM">
<item>Alright. Open this URL to see the tweets: http://insights-search.mybluemix.net/api/1/messages/search?q={Topic}%20AND%20posted%3A2015-07-01%20AND%20sentiment%3A{Sentiment}</item>
</prompt>
</output>
</folder>
<folder label="Live Content" id="folder_2442998">
<input>
<grammar>
<item>*</item>
</grammar>
<action varName="Topic" operator="SET_TO_USER_INPUT"/>
<output>
<prompt selectionType="SEQUENTIAL">
<item>Are you interested in positive or negative tweets?</item>
</prompt>
<getUserInput>
<input>
<grammar>
<item>positive</item>
</grammar>
<action varName="Sentiment" operator="SET_TO">positive</action>
<goto ref="folder_2447777"/>
</input>
<input>
<grammar>
<item>negative</item>
</grammar>
<action varName="Sentiment" operator="SET_TO">negative</action>
<goto ref="folder_2447777"/>
</input>
<input>
<grammar>
<item>*</item>
</grammar>
<action varName="Sentiment" operator="SET_TO">nothing</action>
<goto ref="folder_2442998"/>
</input>
</getUserInput>
</output>
</input>
</folder>
<folder label="Storage"/>
</folder>
<folder label="Global"/>
<folder label="Concepts">
<concept>
<grammar>
<item>positive</item>
<item>good</item>
</grammar>
</concept>
</folder>
</flow>
<entities>
</entities>
<constants>
</constants>
<variables>
<var_folder name="Home">
<var name="Topic" type="TEXT"/>
<var name="Sentiment" type="TEXT"/>
</var_folder>
</variables>
<settings>
</settings>
<specialSettings>
</specialSettings>
</dialog>
我使用了的NodeJS我的服務器,並希望切換到JSON
,而不是XML
。如API reference所述,
對話框模板文件。有效的擴展名爲.mct,用於加密 對話文件,.json和.xml。
我沒有找到任何對話框文件的文檔中的任何JSON結構。
有沒有人嘗試過,併成功地使用JSON而不是XML?怎麼樣?
Thanks German .. –