不使用 SSML 向 Alexa 添加暂停

Add pause to Alexa without using SSML

有没有办法在不使用 SSML 的情况下在 Amazon Alexa 中添加暂停(最好是 1 秒)? 也许我可以用 Outputspeech.Text我只是不知道。

在下面,我说的是 "Here are works of art by {artist name}" 但是艺术作品的名称和开头混合在一起 - 尽管有句号 - 所以我最终得到 "Here are the works of art by 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;

更新

好的。结束了看起来像这样的 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;
    }

没有 SSML,无法在 Alexa 中引入暂停。您将需要构建 ssml 字符串,然后 return 使用暂停或节奏字符串将其返回给 Alexa。