How to retrieve Wiktionary word content?

前端 未结 9 1633
花落未央
花落未央 2020-11-28 18:27

How may Wiktionary\'s API be used to determine whether or not a word exists?

9条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 18:41

    There are a few caveats in just checking that Wiktionary has a page with the name you are looking for:

    Caveat #1: All Wiktionaries including the English Wiktionary actually have the goal of including every word in every language, so if you simply use above API call you will know that the word you are asking about is a word in at least one language, but not necessarily English: http://en.wiktionary.org/w/api.php?action=query&titles=dicare

    Caveat #2: Perhaps a redirect exists from one word to another word. It might be from an alternative spelling, but it might be from an error of some kind. The API call above will not differentiate between a redirect and an article: http://en.wiktionary.org/w/api.php?action=query&titles=profilemetry

    Caveat #3: Some Wiktionaries including the English Wiktionary include "common misspellings": http://en.wiktionary.org/w/api.php?action=query&titles=fourty

    Caveat #4: Some Wiktionaries allow stub entries which have little or no information about the term. This used to be common on several Wiktionaries but not the English Wiktionary. But it seems to have now spread also to the English Wiktionary: https://en.wiktionary.org/wiki/%E6%99%B6%E7%90%83 (permalink for when the stub is filled so you can still see what a stub looks like: https://en.wiktionary.org/w/index.php?title=%E6%99%B6%E7%90%83&oldid=39757161)

    If these are not included in what you want, you will have to load and parse the wikitext itself, which is not a trivial task.

提交回复
热议问题