wikionary API - meaning of words

后端 未结 4 608
北恋
北恋 2021-02-02 03:41

I would like get meaning of selected word using wikionary API. Content retrieve data should be the same as is presented in \"Word of the day\", only the basic meaning without e

4条回答
  •  野的像风
    2021-02-02 04:12

    MediaWiki does have an API but it's low-level and has no support for anything specific to each wiki. For instance it has no encyclopedia support for Wikipedia and no dictionary support for Wiktionary. You can retrieve the raw wikitext markup of a page or a section using the API but you will have to parse it yourself.

    The first caveat is that each Wiktionary has evolved its own format but I assume you are only interested in the English Wiktionary. One cheap trick many tools use is to get the first line which begins with the '#' character. This will usually be the text of the definition of the first sense of the first homonym.

    Another caveat is that every Wiktionary uses many wiki templates so if you are looking at the raw text you will see plenty of these. The only way to reliably expand these templates is by calling the API with action=parse.

提交回复
热议问题