Wiktionary API for pronunciation?

I was looking for a way to pronounce the pronunciation of any given word by requesting some kind of API. Since Wiktionary comes in handy to find the pronunciation of words that I tried to use their API, but how can I get the pronunciation of a specific word

+6
api php mediawiki-api mediawiki wiktionary
source share
3 answers

Wiktionary does not have its own API. MediaWiki, the software Wiktionary runs on, has an API, but is completely unaware of the structure and contents of the Wiktionary.

The best you can do is use the MediaWiki API to find the wiki page for the word you want, and then look at the table of contents. If the table of contents has a language section for the language you need and there is a Pronunciation section inside it, then use another call API to get the wikitext this section, which you will have to analyze yourself. It can use or not different patterns for different words, since Wiktionary is constantly evolving.

There are also Wiktionary mailing lists for the MediaWiki API .

+3
source share

You can build a wiktionary dbpedia to send a SPARQL query, for example their next SPARQL endpoint :

 PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX wt:<http://wiktionary.dbpedia.org/terms/> SELECT DISTINCT ?spell ?pronounce WHERE { ?spell rdfs:label "work"@en ; wt:hasLangUsage ?use . ?use dc:language wt:English ; wt:hasPronunciation ?pronounce . } 

In this case, β€œwork” is the word for which you want to find spelling.

EDIT:

A similar dbnary project, which is more active and provides more reliable results. You can use the SPARQL endpoint with the following query:

 SELECT DISTINCT ?pronun WHERE { ?form lemon:writtenRep "work"@en ; lexinfo:pronunciation ?pronun . } 
+4
source share

Here is what I did for a similar situation.

  • Visit Scraper Links with PHP . It will teach you how to clear links using PHP. Please do not copy or paste, but try to study it.
  • Now that we have our links, we need to separate the audio (* .ogg) from the regular links. We need to use the pathinfo function in PHP. The official documentation for pathinfo should be a good start.
  • Create XML from the result.
  • Deliver content using Ajax or any other preferred method.

Or you can try "http://api.forvo.com/demo". It looks promising.

I will not give you the full answer! Because it will not be fun anymore. I hope this helps.

+1
source share

All Articles