Python 3.x 如何将Microsoft Dynamic Dictionary与translator API结合使用

Python 3.x 如何将Microsoft Dynamic Dictionary与translator API结合使用,python-3.x,microsoft-translator,Python 3.x,Microsoft Translator,如何使用Microsoft Translator文本API的功能,并将json作为输入?相关文件非常不清楚 我在Microsoft的gitHub页面上关注这一点。将指令与python结合在一起,并使用以下输入 text = "Instant dictionary: word <mstrans:dictionary translation=\"wordomatic\">word or phrase</mstrans:dictionary> is a dictionary e

如何使用Microsoft Translator文本API的功能,并将json作为输入?相关文件非常不清楚


我在Microsoft的gitHub页面上关注这一点。

将指令与python结合在一起,并使用以下输入

text = "Instant dictionary: word <mstrans:dictionary translation=\"wordomatic\">word or phrase</mstrans:dictionary> is a dictionary entry."
这就回答了这个问题

然而,不知何故,标记词之前的所有内容都没有翻译

此外,翻译
text=“Instant dictionary:word”
会返回:
{“翻译”:[{“文本”:“即时字典:单词”,“收件人”:“de”}]}

而翻译
text=“即时字典单词”
返回:
{“翻译”:[{“文本”:“即时Wörterbuchwort”,“to”:“de”}]}

这就引出了一个问题:这些单词和字符如何改变API返回的内容

[
    {
        "translations": [
            {
                "text": "Instant Dictionary Word wordomatic ist ein Wörterbucheintrag.",
                "to": "de"
            }
        ]
    }
]