Pebble: Collins Dictionary API / Browserify

A post I did a short while ago (this post to be exact) showed some work I was doing with regards to language learning on a Pebble smart watch. Since then I applied for an API access for Collins Dictionary API – they accepted my intended usage for it and supplied me with a key. It’s not an automatic process by the looks of it, they seem to vet any applications… odd, but I guess they must have suffered some abuse of it at some time?

Either way, I’m now grabbing real word definition data from Collins and displaying it on the Pebble. Neat-o.

One thing that was a bit of a pain was the fact that the Pebble JS SDK seemingly doesn’t have a way of parsing XML. The Collins API responds with some simple JSON objects with the useful bit of the response being in XML or HTML… I don’t really understand the thinking behind that, but as that’s the situation so be it.

Pebble JS only supports one JS file too, so I’m using Browserify to let me in turn use xml2js for XML parsing. In fact, not only do I parse the XML I actually just convert it into JSON right from the off and then deal with it that way.

I’m currently displaying:

  • German Word
  • German Word in Plural form
  • Type of word (Noun, Verb etc)
  • Translation
  • Gender
  • An example of the word being used in a sentence/phrase

I still need to:

  • Deal with non-standard characters (letters with umlauts or an eszett etc)
  • Provide some sort of common German words list on the JS side of the system (it’s currently just got a few words I’ve put in a list that it selects from – I was thinking the top 500-1000 German words would be a good target to aim for)
  • Do a general spit and polish
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s