You are not logged in.

#1 2009-10-15 14:36:33

voice
Member
Registered: 2009-06-09
Posts: 8

Search for console dictionary program

Hello.

In Debian repositories we have stardict GUI and console version, and I was looking for console version in Arch and didn't found it. So we have no console version really?
Or can someone recommend me some console translation package?


Everything is file, and file is everything.

Offline

#2 2009-10-15 14:56:20

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: Search for console dictionary program


This silver ladybug at line 28...

Offline

#3 2009-10-15 17:44:35

voice
Member
Registered: 2009-06-09
Posts: 8

Re: Search for console dictionary program

I was looking only in pacman's repositories.
Thanks.


Everything is file, and file is everything.

Offline

#4 2009-10-15 21:11:32

quarkup
Member
From: Portugal
Registered: 2008-09-07
Posts: 497
Website

Re: Search for console dictionary program

http://www.archlinux.org/packages/?sort … =&limit=50

you got wtf (acronym dictionary)
dictd and other ones


If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is.
Simplicity is the ultimate sophistication.

Offline

#5 2009-10-15 21:17:32

Tomone
Member
Registered: 2009-09-29
Posts: 18

Re: Search for console dictionary program

dictd is the one I use in both Arch and Debian.

Offline

#6 2009-10-16 01:03:23

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: Search for console dictionary program

sdcv with rlwrap is great. Install rlwrap and put this in ~/.bashrc. Then you get history with the up and down arrows:

alias sdcv='rlwrap sdcv'

Offline

#7 2009-10-18 10:53:33

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: Search for console dictionary program

I use the sdvc with the wordnet dictionary but the formatting isn't so good.  So I created this script that checks for misspells, reformats, and highlights the word:

#!/bin/bash
# define - command line dictionary

# text color variables
bldred='\e[1;31m'     # red    - bold
bldwht='\e[1;37m'     # white  - bold
txtrst='\e[0m'        # text reset

sedbldwht='\c[[1;37m' # white  - bold
sedtxtrst='\c[[0m'    # text reset

# display usage if full argument isn't given
if [[ -z $1 ]]; then
  echo " define <word-to-lookup> - command line dictionary"
  exit
fi

# suggest possible words if not in dictionary, otherwise define
wordchecknum=$(echo "$1" | aspell -a | sed '1d' | wc -m)
wordcheckprnt=$(echo "$1" | aspell -a | sed '1d' | sed 's/^.*: //')

if [[ $wordchecknum -gt "3" ]]; then
  echo -e "${bldred}*${txtrst} ${bldwht}"$1"${txtrst} is not in the dictionary.  Possible alternatives:"
  echo -e "\n $wordcheckprnt\n"
  exit
fi

# common word choice menu negate
# doesn't work
#choice=$(sdcv $1 | grep "Your choice" &> /dev/null &)
#if [ -n $choice ]; then
#  echo " Too common a word"
#  exit
#fi

sdcv $1 | \
# lookup, delete extrenous first lines, delete last empty line
sed '1,3d' | sed '/^*$/d' | \
# Print more obvious word type
sed "h; :b; \$b ; N; /^${1}\n     n/ {h;x;s// ${sedbldwht}Noun${sedtxtrst}\n/; bb}; \$b ; P; D" | \
sed "h; :b; \$b ; N; /^${1}\n     v/ {h;x;s// ${sedbldwht}Verb${sedtxtrst}\n/; bb}; \$b ; P; D" | \
sed "h; :b; \$b ; N; /^${1}\n     adv/ {h;x;s// ${sedbldwht}Adverb${sedtxtrst}\n/; bb}; \$b ; P; D" | \
sed "h; :b; \$b ; N; /^${1}\n     adj/ {h;x;s// ${sedbldwht}Adjective${sedtxtrst}\n/; bb}; \$b ; P; D" | \
# Reformat to left (ok, there's gotta be a better way to do this)
sed 's/^     / /g' | \
sed 's/^      /    /g' | \
sed 's/^      /    /g' | \
sed 's/^     /    /g' | \
# Rename single entry
sed 's/^ : / 1: /g' | \
# Pretty colors
sed "s/${1}/${sedbldwht}${1}${sedtxtrst}/g"

And looks like this:

open-with-dia1.png

Haven't figure out a way to disable sdvc to print a list if the word is too common though.

Last edited by Gen2ly (2009-10-18 14:57:01)


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

Board footer

Powered by FluxBB