Batch translating list of words?

Index » Learning resources

  • 1
 
vebaev Member
From: Bulgaria, Plovdiv Registered: 2013-09-09 Posts: 77

Hi,
Do you know a method for translating a list of words, for example if I have 300 vocab words, i tried google translator but it is quite buggy?

Last edited by vebaev (2013 December 25, 1:19 pm)

howtwosavealif3 Member
From: USA Registered: 2008-02-09 Posts: 889 Website

http://www.csse.monash.edu.au/~jwb/cgi- … dic.cgi?9T
THIS SITE.  i remember using it when i first srated learning japanese.

Last edited by howtwosavealif3 (2013 December 25, 1:41 pm)

vebaev Member
From: Bulgaria, Plovdiv Registered: 2013-09-09 Posts: 77

Great, thanks
It does not give the reading, but anyway it is something better than nothing smile

Advertising (register and sign in to hide this)
JapanesePod101 Sponsor
 
howtwosavealif3 Member
From: USA Registered: 2008-02-09 Posts: 889 Website

it does. look closely. i remember copy pasting song lyrics, websites etc.

cb4960 Member
From: Los Angeles Registered: 2007-06-22 Posts: 917

Epwing2Anki might be what you are looking for.

lauri_ranta Member
Registered: 2012-03-31 Posts: 139 Website

If you use OS X or Linux, you can add one word per line in ~/Desktop/words.txt and run a command like this in a terminal:

curl ringtail.its.monash.edu.au/pub/nihongo/edict.gz|gzip -d|iconv -f euc-jp -t utf-8 >~/Desktop/edict;for word in $(<~/Desktop/words.txt);do grep "^$word " ~/Desktop/edict;done

jmignot Member
From: France Registered: 2006-03-03 Posts: 205

lauri_ranta wrote:

If you use OS X or Linux, you can add one word per line in ~/Desktop/words.txt and run a command like this in a terminal:

curl ringtail.its.monash.edu.au/pub/nihongo/edict.gz|gzip -d|iconv -f euc-jp -t utf-8 >~/Desktop/edict;for word in $(<~/Desktop/words.txt);do grep "^$word " ~/Desktop/edict;done

I tried but it returned an error in OSX:

curl ringtail.its.monash.edu.au/pub/nihongo/edict.gz|gzip -d|iconv -f euc-jp -t utf-8 >~/Desktop/edict;for word in $(<~/Desktop/words.txt);do grep "^$word " ~/Desktop/edict;done
Illegal variable name.

Is there a typo in this command (copy-pasted from your post)?

Last edited by jmignot (2013 December 29, 2:32 am)

gaiaslastlaugh 代理管理者
From: Seattle Registered: 2012-05-17 Posts: 525 Website

If you have an iPhone, Midori does a decent job of this.

lauri_ranta Member
Registered: 2012-03-31 Posts: 139 Website

jmignot wrote:

I tried but it returned an error in OSX

The command worked for me when I copied and pasted it from the post. If your shell is csh, try using bash instead. csh can be the default shell if you have a really old version of OS X or if you have upgraded from an old version of OS X.

Here's a Ruby script that should also work out of the box in (relatively new versions of) OS X:

edict = {}
IO.read("JMdict_e").scan(/<entry>.*?<\/entry>/m).each { |entry|
  keb = entry[/(?<=<keb>).*(?=<\/keb>)/] || next
  reb = entry[/(?<=<reb>).*(?=<\/reb>)/]
  next if edict[keb]
  gloss = entry[/(?<=<gloss>).*(?=<\/gloss>)/]
  gloss = gloss.sub(/^(\([^)]+\) )*/, "").sub(/ \([^)]+\)$/, "")
  edict[keb] = [reb, gloss]
}
IO.read("words.txt").split.each { |word|
  reb, gloss = edict[word] || next
  puts word + "\t" + reb + "\t" + gloss
}

You can run the script by for example saving it as jmdict.rb in the home folder, putting http://ringtail.its.monash.edu.au/pub/nihongo/JMdict_e and words.txt in the home folder, and then running "ruby jmdict.rb" in Terminal.

Reply #10 - January 08, 6:46 am
vebaev Member
From: Bulgaria, Plovdiv Registered: 2013-09-09 Posts: 77

lauri_ranta wrote:

If you use OS X or Linux, you can add one word per line in ~/Desktop/words.txt and run a command like this in a terminal:

curl ringtail.its.monash.edu.au/pub/nihongo/edict.gz|gzip -d|iconv -f euc-jp -t utf-8 >~/Desktop/edict;for word in $(<~/Desktop/words.txt);do grep "^$word " ~/Desktop/edict;done

Thanks that worked for me like a charm!

Reply #11 - January 24, 2:46 pm
jmignot Member
From: France Registered: 2006-03-03 Posts: 205

lauri_ranta wrote:

jmignot wrote:

I tried but it returned an error in OSX

The command worked for me when I copied and pasted it from the post. If your shell is csh, try using bash instead. csh can be the default shell if you have a really old version of OS X or if you have upgraded from an old version of OS X.

This was the right answer.
I am still using csh (or tsch) on my Mac.
Switched to bash and problem was solved!

Thanks.

  • 1