How do I access the "See Also" Field in the Wiktionary API?

160 views Asked by At

Many of the Wiktionary pages for Chinese Characters (Hanzi) include links at the top of the page to other similar-looking characters. I'd like to use the Wiktionary API to send a single character in the query and receive a list of similar characters as the response. Unfortunately, I can't seem to find any query that includes the "See Also" field. Is this kind of query possible?

1

There are 1 answers

1
leo On BEST ANSWER

The “see also” field is just a line of wiki code in the page source, and there is no way for the API to know that it's different from any other piece of text on the page.

If you are happy with using only the English version of Wiktionary, you can fetch the wikicode: index.php?title=太&action=raw, and then parse the result for the template also. In this case, the line you are looking for is {{also|大|犬}}.

To check if the template is used on the page at all, query the API for titles=太&prop=templates&tltemplates=Template:also

Similar templates are avilable in more language editions of Wiktionary, in case you want to use other sources than the English one. The current list is:

  • br:Patrom:gwelet
  • ca:Plantilla:vegeu
  • cs:Šablona:Viz
  • de:Vorlage:Siehe auch
  • el:Πρότυπο:δείτε
  • es:Plantilla:desambiguación
  • eu:Txantiloi:Esanahi desberdina
  • fi:Malline:katso
  • fr:Modèle:voir
  • gl:Modelo:homo
  • id:Templat:lihat
  • is:Snið:sjá einnig
  • it:Template:Vedi
  • ja:テンプレート:see
  • no:Mal:se også
  • oc:Modèl:veire
  • pl:Szablon:podobne
  • pt:Predefinição:ver também
  • ru:Шаблон:Cf
  • sk:Šablóna:See
  • sv:Mall:se även

It has been suggested that the WikiData project be expanded to cover Wiktionary. If and when that happens, you might be able to query theWikiData API for that kind of stuff!