You are not logged in.

#1 2010-11-10 14:36:44

Meskarune
Member
From: Helsinki, Finland
Registered: 2009-03-21
Posts: 361
Website

[Solved] CLI Japanese - English - Japanese Dictionary

I would really really like to have a cli dictionary that translates japanese to and from english. (hiragana, katakana, kanji and romaji would be great, but I'd be happy with just hiragana or romaji)

I found this: http://edictionary.sourceforge.net/

And I think there are commands that can look up the meaning of words online..... but I would like to have a dictionary that works offline as well. Any suggestions?

Last edited by Meskarune (2010-11-18 15:08:03)


Homepage  | Arch Linux Women | Arch Linux Classroom
Acer Aspire E5-575G-53VG:
Intel Dual-Core i5-6200U 2.3 GHz; Skylake rev3 | 8GB DDR4 ram | Intel HD Graphics 520 + NVIDIA GeForce 940MX
Qualcomm Atheros QCA9377 802.11ac | Realtek RTL8111/8168/8411 Gigabit Ethernet Controller

Offline

#2 2010-11-10 16:23:23

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [Solved] CLI Japanese - English - Japanese Dictionary

This page pointed me to Tagaina Jisho, which is in the AUR. http://en.wikibooks.org/wiki/Japanese/Software I can confirm that it comes with its own dictionary file, which looks like a giant 52 MB XML file. I think it has a Qt GUI, so it doesn't exactly match what you're looking for.

Unfortunately, I'm at work right now and can't look into it too much. sad

Offline

#3 2010-11-11 02:03:26

Meskarune
Member
From: Helsinki, Finland
Registered: 2009-03-21
Posts: 361
Website

Re: [Solved] CLI Japanese - English - Japanese Dictionary

stardict actually has a really decent cli dictionary. Its english or hiragana but has a local dictionary file and optional net look up. http://en.wikipedia.org/wiki/Sdcv


Homepage  | Arch Linux Women | Arch Linux Classroom
Acer Aspire E5-575G-53VG:
Intel Dual-Core i5-6200U 2.3 GHz; Skylake rev3 | 8GB DDR4 ram | Intel HD Graphics 520 + NVIDIA GeForce 940MX
Qualcomm Atheros QCA9377 802.11ac | Realtek RTL8111/8168/8411 Gigabit Ethernet Controller

Offline

#4 2010-11-11 21:20:49

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [Solved] CLI Japanese - English - Japanese Dictionary

Try this, mecab + edict2

Dependencies:
mecab
mecab-ipadic
kakasi-cvs

Get edict2 dictionaries with:

#! /bin/bash
for dictionary in edict2 radkfile kradfile kanjidic examples; do
curl -s ftp://ftp.monash.edu.au/pub/nihongo/$dictionary.gz | gunzip | iconv -f eucjp -t utf8 > $dictionary.utf
done

Auto lookup script:

#! /bin/bash
iconv -f utf8 -t eucjp | mecab | iconv -f eucjp -t utf8 | while IFS=$'\t,' read orig type relation u u u u stem kana1 kana2; do 

kana=$(echo "$kana1" | kakasi -i utf8 -o utf8 -KH)
[[ $type != 助詞 || $orig ==  て ]] && [[ $relation == 接続助詞 || $type == 助動詞 ]] && prepend="<Grammar Ending>" || prepend=""
[[ $stem == '*' || -z $stem ]] && stem=$orig

edic=$(grep "^$stem " edict2.utf)
if [[ -z $edic ]]; then
 ekfield=$(grep -E "(^|;)$stem[ ;(]" edict2.utf)
 particles=$(echo "$ekfield" | grep -vF '[')
 
 if [[ -z $particles ]]; then
  edic=$(echo "$ekfield" | grep "$stem.*\[")
  [[ -z $edic ]] && edic=$(grep "\[$stem[](]" edict2.utf)
 else
  edic=$particles
 fi
 [[ -z $edic ]] && edic=$(grep "\[$kana[](]" edict2.utf)
 [[ -z $edic ]] && edic=$(grep -E "(^|;)$stem[] (]" edict2.utf)
 [[ $type =~ 動詞 ]] && edic=$(echo "$edic" | grep -F $'(v\n(aux') #Filter verbs
fi

edic=$(echo "$edic" | sed 's|[^/]*/||;s|/[^/]*/$||;q')

echo -e "$orig \t $kana \t $prepend $edic"
done

I don't know how to look up verb endings. Mecab marks them so I added a note in $prepend. The edict part will probably be incorrect.

I made it filter for verbs and you can do this with everything Mecab marks, if you know how edict2 marks them too.

Example

「それで面白い趣向があるから是非いっしょに来いとおっしゃるので」と客は落ちついて云う。
「      「       
それで      それで       (conj) (uk) and/thereupon/because of that/(P)
面白い      おもしろい       (adj-i) interesting/amusing/(P)
趣向      しゅこう       (n) plan/idea/(P)
が      が       (prt) (1) indicates sentence subject (occasionally object)/(2) (See 我が家) indicates possessive (esp. in literary expressions)/(prt,conj) (3) but/however/still/and/(P)
ある      ある       (v5r-i,vi) (1) (uk) (See 居る) to be (usu. of inanimate objects)/to exist/to live/(2) to have/(3) to be located/(4) to be equipped with/(5) to happen/to come about/(P)
から      から       (prt) (1) from (e.g. time, place, numerical quantity)/since/(2) from (originator)/(3) because/(4) out of (constituent, part)/(5) through (e.g. window, vestibule)/(6) after/since (following te-form verb)/(P)
是非      ぜひ       (adv,n) (1) (uk) certainly/without fail/(2) right and wrong/pros and cons/(P)
いっしょ      いっしょ       (n-adv,n,adj-no) (1) (See 御一緒) together/(2) at the same time/(3) same/identical/(P)
に      に       (prt) indicates such things as location of person or thing, location of short-term action, etc./(P)
来い      こい       (vk,vi,aux-v) (1) to come (spatially or temporally)/to approach/to arrive/(2) (See 行って来る) to come back/to do ... and come back/(3) to come to be/to become/to get/to grow/to continue/(vk,vi) (4) to come from/to be caused by/to derive from/(5) (See と来たら) to come to (i.e. "when it comes to spinach ...")/(P)
と      と       (prt,conj) (1) if/when/(2) and/(3) with/(4) particle used for quoting (with speech, thoughts, etc.)/(n) (5) (abbr) (See と金) promoted pawn (shogi)/(P)
おっしゃる      おっしゃる       (v5aru,vt) (uk) (hon) to say/to speak/to tell/to talk/(P)
ので      ので       (prt) that being the case/because of .../the reason is ..../given that.../(P)
」      」       
と      と       (prt,conj) (1) if/when/(2) and/(3) with/(4) particle used for quoting (with speech, thoughts, etc.)/(n) (5) (abbr) (See と金) promoted pawn (shogi)/(P)
客      きゃく       (n) (1) guest/visitor/(2) customer/client/shopper/spectator/audience/tourist/sightseer/passenger/(P)
は      は       (prt) (1) (pronounced わ in modern Japanese) topic marker particle/(2) indicates contrast with another option (stated or unstated)/(3) adds emphasis/(P)
落ちつい      おちつい       (v5k) to calm down/to settle down/to be steady/to settle in/to take up one's residence/to harmonize with/to harmonise with/to match/to restore presence of mind/(P)
て      て      <Grammar Ending> (prt) (abbr for というのは and other similar combinations) casual quoting particle/(P)
云う      いう       (v5u) (1) to say/(2) to call (i.e. to give a name)/(P)
。      。       
EOS

Offline

#5 2010-11-15 05:38:09

Meskarune
Member
From: Helsinki, Finland
Registered: 2009-03-21
Posts: 361
Website

Re: [Solved] CLI Japanese - English - Japanese Dictionary

Procyon wrote:

Try this, mecab + edict2

Dependencies:
mecab
mecab-ipadic
kakasi-cvs

I love you so much right now. THANK YOU!!!! <3


Homepage  | Arch Linux Women | Arch Linux Classroom
Acer Aspire E5-575G-53VG:
Intel Dual-Core i5-6200U 2.3 GHz; Skylake rev3 | 8GB DDR4 ram | Intel HD Graphics 520 + NVIDIA GeForce 940MX
Qualcomm Atheros QCA9377 802.11ac | Realtek RTL8111/8168/8411 Gigabit Ethernet Controller

Offline

#6 2010-11-15 07:51:11

utsuwa
Member
Registered: 2010-11-05
Posts: 59

Re: [Solved] CLI Japanese - English - Japanese Dictionary

I am not sure if it will satisfy you, but Icecat (firefox, Icewasel) has add-on called rikaichan. It has its own dicitionary that you can download and it can work offline. It has lookupbar that helps me quite a lot. Type a word and it will translate it and give you many additional info (strokes, etc)

Offline

#7 2010-11-18 15:06:44

Meskarune
Member
From: Helsinki, Finland
Registered: 2009-03-21
Posts: 361
Website

Re: [Solved] CLI Japanese - English - Japanese Dictionary

So I ended up using a combination of Procyon's scripts and sdvc. I did an alias dict='sdvc' and the output looks like this:

 

[meskarune@panda ~]$ dict hello
Found 1 items, similar to hello.
-->jmdict-en-ja
-->hello

今日は
こんにちは

[meskarune@panda ~]$ dict すばらしい
Found 1 items, similar to すばらしい.
-->jmdict-ja-en
-->すばらしい

素晴らしい
wonderful
splendid
magnificent

I have used rikaichan before. But gecko based browsers kill my netbook, and I pretty much only use midori + elinks.


Homepage  | Arch Linux Women | Arch Linux Classroom
Acer Aspire E5-575G-53VG:
Intel Dual-Core i5-6200U 2.3 GHz; Skylake rev3 | 8GB DDR4 ram | Intel HD Graphics 520 + NVIDIA GeForce 940MX
Qualcomm Atheros QCA9377 802.11ac | Realtek RTL8111/8168/8411 Gigabit Ethernet Controller

Offline

#8 2010-11-18 15:07:31

Meskarune
Member
From: Helsinki, Finland
Registered: 2009-03-21
Posts: 361
Website

Re: [Solved] CLI Japanese - English - Japanese Dictionary

Thanks for all of your help!!!!


Homepage  | Arch Linux Women | Arch Linux Classroom
Acer Aspire E5-575G-53VG:
Intel Dual-Core i5-6200U 2.3 GHz; Skylake rev3 | 8GB DDR4 ram | Intel HD Graphics 520 + NVIDIA GeForce 940MX
Qualcomm Atheros QCA9377 802.11ac | Realtek RTL8111/8168/8411 Gigabit Ethernet Controller

Offline

Board footer

Powered by FluxBB