QnA Bot框架 - 如何做“á”等口音

时间:2017-11-15 14:40:59

标签: botframework skype-for-business qnamaker

在我的qna制造商知识库中,我有这个:

问题: 你好

答案: 你好maría

但我在机器人上得到了这个答案:Hello mar&#237a。我尝试了很多东西,没有结果。

感谢。

2 个答案:

答案 0 :(得分:0)

您可以使用以下代码从QNA获取您的回复并将其传递给代码。

static void Main()
   {
      string unicodeString = "This string contains the unicode character Pi (\u03a0)";

      // Create two different encodings.
      Encoding ascii = Encoding.ASCII;
      Encoding unicode = Encoding.Unicode;

      // Convert the string into a byte array.
      byte[] unicodeBytes = unicode.GetBytes(unicodeString);

      // Perform the conversion from one encoding to the other.
      byte[] asciiBytes = Encoding.Convert(unicode, ascii, unicodeBytes);

      // Convert the new byte[] into a char[] and then into a string.
      char[] asciiChars = new char[ascii.GetCharCount(asciiBytes, 0, asciiBytes.Length)];
      ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0);
      string asciiString = new string(asciiChars);

      // Display the strings created before and after the conversion.
      Console.WriteLine("Original string: {0}", unicodeString);
      Console.WriteLine("Ascii converted string: {0}", asciiString);
   }

如果您需要更多帮助,请告诉我

答案 1 :(得分:0)

我在这里创建了一个示例: https://github.com/FranciscoPonceGomez/FranciscoQnAccents

它适用于所有渠道。你不应该有口音问题。

知识库: enter image description here

你可以在这里试试: https://franciscoqnaccents.azurewebsites.net/

如果代码中有任何内容对您没有意义,请告诉我。

此致 旧金山