How may Wiktionary's API be used to determine whether or not a word exists?
相关问题
- Google places autocomplete suggestion without coun
- Move character on map on clicked position
- Karate API Testing - Access variable value across
- How to verify laravel passport api token in node /
- Converting byte array output into Blob corrupts fi
相关文章
- 我用scrapy写了一个蛮简单的爬虫怎么封装成一个api啊
- 后端给前端的API接口是怎么用代码写的
- Convert C# Object to Json Object
- Android camera2 API get focus distance in AF mode
- Creating a dictionary for each word in a file and
- Getting all listing images from an Etsy shop
- Can a VBScript function return a dictionary?
- Is there an API to get statictics on Google Play d
You might want to try JWKTL out. I just found out about it ;)
http://en.wikipedia.org/wiki/Ubiquitous_Knowledge_Processing_Lab#Wiktionary_API
http://www.ukp.tu-darmstadt.de/software/jwktl/
Here's a start to parsing etymology and pronunciation data:
Update: Here is a gist with it more fleshed out.
To keep it really simple, extract the words from the dump like that:
As mentioned earlier, the problem with this approach is that Wiktionary provides the information about all the words of all the languages. So the approach to check if a page exists using Wikipedia API won't work because there're a lot of pages for non-English words. To overcome this, you need to parse each page to figure out if there's a section describing English word. Parsing wikitext isn't a trivial task, though in your case it's not that bad. To cover almost all the cases you need to just check if the wikitext contains
English
heading. Depending on the programming language you use, you can find some tools to build AST from wikitext. This will cover most of the cases, but not all of them because Wiktionary includes some common misspellings.As an alternative, you could try using Lingua Robot or something similar. Lingua Robot parses the Wiktionary content and provide it as a REST API. Non-empty response means that the word exists. Please note that, as opposed to Wiktionary, the API itself doesn't include any misspellings (at least at the moment of writing this answer). Please also note that the Wiktionary contains not only the words, but multi-word expressions.
If you are using Python, you can use WiktionaryParser by Suyash Behera.
You can install it by
Example usage:
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.