问题描述
我一直在寻找一种方式,通过查询某种类型的API来获取任何单词的发音。由于派上用场找到我试图用他们的API的话发音,但是怎么办我得到一个特定单词的发音?
I was looking for a way to get the pronunciation of any given word by querying an API of some sort. As Wiktionary comes in handy to find pronunciations of words I was trying to use their API, but how do I get the pronunciation of a specific word?
推荐答案
维基不具有其自己的API。链接到MediaWiki,维基上运行的软件确实有一个API,但它是完全不知道维基的结构和内容。
Wiktionary doesn't have an API of its own. MediaWiki, the software the Wiktionary runs on does have an API but it is completely unaware of the structure and content of Wiktionary.
你能做的最好是使用找到wiki页面你想要的话,再看看表的内容。如果目录中有您想要的语言和内的语言部分,有一个语音
部分,然后用另一个API调用来获取 wikitext的
这一节,你将不得不解析自己。很可能使用或不因为维基不同的词不同的模板也在不断发展。
The best you can do is use the MediaWiki API to find the wiki page for the word you want, then look at the table of contents. If the table of contents has a language section for the language you want and within that there is a Pronunciation
section, then use another API call to get the wikitext
of that section which you will have to parse yourself. It may well use or not different templates on different words since Wiktionary is constantly evolving.
有也被邮件列表和的。
这篇关于维基API的发音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!