2017-03-08 56 views
0

有沒有辦法在不使用SSML的情況下在亞馬遜Alexa 中添加暫停(最好是1秒)?也許有一個技巧,我可以用Outputspeech.Text做,而我只是不知道它。在不使用SSML的情況下爲Alexa添加暫停

下面我要說的是「這裏是{藝術家的名字}的藝術作品」,但藝術作品的名稱和開始混合在一起 - 儘管時間長短 - 所以我最終得到了諸如「這裏有Pablo Picasso Harlequin的作品......「

我使用C#和我自己的https端點,而不是AWS Lambda。

有什麼建議嗎?否則,我會將它添加爲SSML。謝謝。

 var output = new StringBuilder(); 
     var outputCard = new StringBuilder(); 

     string m_location; 
     string m_current_location; 

     string m_artist = dt_artist.Rows[0]["DisplayName"].ToString(); 

     output.Append("here are works of art for " + m_artist + ". "); 
     outputCard.Append("Here are works of art for " + m_artist + ".\n\n"); 

     foreach (DataRow dr in dt_artist_objs.Rows) 
     { 
      m_current_location = dr["CurrentLocation"].ToString(); 

      if (m_current_location == " ") 
      { 
       m_location = "The location is not available."; 
      } 
      else 
      { 
       m_location = "It is located on the " + m_current_location; 
      } 

      output.Append(dr["Title"].ToString() + " is a " + dr["Classification"].ToString() + ". The medium is " + dr["Medium"].ToString() + ". " + m_location); 
      outputCard.Append(dr["Title"].ToString() + ", " + dr["Dated"].ToString() + " is a " + dr["Classification"].ToString() + ". The medium is " + dr["Medium"].ToString() + ". " + dr["Creditline"].ToString() + ". " + m_location + ".\n"); // It is located on the " + dr["CurrentLocation"].ToString()); 

     } 

     sql_conn_data.Close(); 

     response.Response.OutputSpeech.Text = output.ToString(); 
     response.Response.Card.Title = "Art"; 
     response.Response.Card.Type = "Standard"; 
     response.Response.Card.Text = outputCard.ToString(); 
     response.Response.ShouldEndSession = true; 

     return response; 

UPDATE

確定。結束了持續的SSML路線,看起來像這樣:

 var output = new StringBuilder(); 
     var outputCard = new StringBuilder(); 

     string m_location; 
     string m_current_location; 
     string m_location_card; 

     string m_artist = dt_artist.Rows[0]["DisplayName"].ToString(); 

     output.Append("<speak>"); 
     output.Append("here are works of art for " + m_artist + ". <break time='1s'/> "); 
     outputCard.Append("Here are works of art for " + m_artist + ".\n\n"); 

     foreach (DataRow dr in dt_artist_objs.Rows) 
     { 
      m_current_location = dr["CurrentLocation"].ToString(); 

      if (m_current_location == " ") 
      { 
       m_location = "The location is not available. <break time='1s' />"; 
       m_location_card = "The location is not available. "; 
      } 
      else 
      { 
       m_location = "It is located on the " + m_current_location + "<break time = '1s' />"; 
       m_location_card = "It is located on the " + m_current_location; 
      } 

      output.Append(dr["Title"].ToString() + " is a " + dr["Classification"].ToString() + ". The medium is " + dr["Medium"].ToString() + ". " + m_location); 
      outputCard.Append(dr["Title"].ToString() + ", " + dr["Dated"].ToString() + " is a " + dr["Classification"].ToString() + ". The medium is " + dr["Medium"].ToString() + ". " + dr["Creditline"].ToString() + ". " + m_location_card + ". \n"); 

     } 

     output.Append("</speak>"); 

     sql_conn_data.Close(); 

     response.Response.OutputSpeech.Ssml = output.ToString(); 
     response.Response.OutputSpeech.Type = "SSML"; 
     response.Response.Card.Title = "Art"; 
     response.Response.Card.Type = "Standard"; 
     response.Response.Card.Text = outputCard.ToString(); 
     response.Response.ShouldEndSession = true; 

     return response; 
    } 

回答

0

沒有介紹在Alexa的暫停沒有SSML的方式。您將需要構建ssml字符串並使用暫停或節奏字符串將其返回給Alexa。

相關問題