Last active
December 22, 2015 02:59
-
-
Save me97esn/6407124 to your computer and use it in GitHub Desktop.
Script to create a swedish dictionary to be used with the iSwipe app to iphone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /Users/emilsandin/.rbenv/versions/2.0.0-preview1/bin/ruby | |
require 'plist' | |
require 'net/http' | |
a_ascii = "a".ord | |
url = "http://runeberg.org/words/ss100.txt" | |
content = Net::HTTP.get_response(URI.parse(url)).body | |
grouped_by_start_and_end_letters = content.encode("UTF-8", "ISO-8859-15").each_line.group_by {|s| | |
s.downcase! | |
"#{s[0,1]}#{s[s.length-2,s.length-1]}" | |
} | |
grouped_by_start_and_end_letters.each{|k,v| | |
File.open("/tmp/#{k[0].ord- a_ascii}-#{k[1].ord - a_ascii}.plist", 'w:UTF-8') { |file| | |
file.write( | |
v.collect{|word| | |
word.gsub(/\n/, '') | |
}.to_plist ) | |
} | |
} |
Hi,
Any chance to update the script to create dictionary files for the latest version (0.5.1) ?
Cheers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This creates a number of plist files under /tmp.
These files should be stored on your iPhone under /private/var/swype/English.
Note that even though they are in swedish, the folder name 'English' should be used. It seems that iSwipe only looks at that folder.
Remember to back up the existing files under /private/var/swype/English if you want to roll back.
Have fun!