How to insert a Wiktionary for offline access in an Android application?

I am currently developing an Android application that is a dictionary in which I collect values ​​online using the Wiktionary API using this: [ http://en.wiktionary.org/w/api.php?action=query&prop=revisions&titles = overflow & rvprop = content & format = jsonfm

But I want to download the Wiktionary database offline and embed it in my Android app.

Here is the Wiktionary database download page:
1. Wiktionary
2. Wikimedia Downloads

According to my research, I found out that the stand-alone Wiktionary database is in XML and SQL. But these files are too large. Attaching these files would make the APK size huge.
So, is there any solution to implement it in my application?

+8
android wiktionary offlineapps
source share
2 answers

The developer [ English Dictionary - Offline ] claims that they use the Wiktionary. I'm still wondering where they got the Wiktionary dump file> 22 MB

I’m not paid enough to tell you this ... (joke). You need to extract vocabulary words from XML files, and as soon as you get only those , then the final content (text) will become smaller.

Alternatively ...

You can try this TSV file (courtesy of: semisignal.com ), which is a snapshot of the definitions in November 2012. This contains most of the words that your English end users will need. TSV 54 MB and is processed as a text file.

Try the definition: brushable - TSV below: (Compare with Wiktionary for Brushable ).

English brushable Adjective # Able to be [[brush]]
English brushable Adjective # Ability to control using [[cleaning]]


TIPS:. To reduce the file size, you can cut off the initial "English", since you already know all its English definitions. Each trim will save you 7 bytes (multiply by the general definitions).

  • Use String.replace in "English" (with this space) to clear it.

  • Also replace the "Adjective" "Verb" "Noun" with short codes, which the Application knows the meaning and displays the type entry in the User Interface. The code may be 1 , which means an adjective entry.

Your cropped text file might like below. Each double fullstop simply means “next section of input”, so basically entry . type . definition , where <xyz> is a link to another entry in the dictionary. 54 bytes of TSV record now become 35 bytes for one line.

 brushable..1..Able to be <brushed>. 

Save the final edited (reduced) text file. Paste this into your APK.

+2
source share

I suggest using online access to the API, so a small application can be downloaded and used, as well as add a button somewhere that loads the offline part. Also check the network connection, and if it is not wi-fi, warn the user that the mobile tariff plan is not used to download a 100-megabyte dictionary.

+3
source share

All Articles