cambridge
is a terminal version of Cambridge Dictionary, with its data from https://dictionary.cambridge.org
By default, it is English to English translation. For English to Chinese, add '-c' or '--chinese' option.
Supports looking up the Merriam-Webster Dictionary, with -w
or --webster
option. Webster has no foreign language translation in itself.
I'm a terminal person tired of pulling out a GUI app or browser, inputting words in the search bar, hitting the search button and then waiting for the result to render with a bunch of unnecessary static files coming along. Not only is the time taken long, but also switching apps back and forth can be annoying. So I wrote this console application with features to my satisfaction.
camb <word/phrase>
to look it up in Cambridge Dictionary by default-w
flag to fetch Merriam-Webster Dictionary- less than 2s taken to do all the work for the word, including fetching, parsing, printing, and writing cache
- less than 0.1s for the same word's later search
- only the first dictionary from Cambridge, avoiding confuses by multiple dictionaries
- a list of word/phrase suggestions will be given, if not found
camb l
to list words and phrases you've found before- color customized to black, white, blue, grey terminal backgrounds
With fzf installed, camb l | fzf --preview 'camb {}'
will get you a taste of the fzf
magic:
- display the whole word list
- fuzzy find a word from the word list & preview its meaning instantly
- preview each word definition instantly as you scroll through the list
alias cambl="camb l | fzf --preview 'camb {}'"
can be added in your bashrc for convenience
pip install cambridge # install
pip uninstall cambridge && rm -rf $HOME/.cache/cambridge # uninstall and remove cache
Command s (hidden)
For looking up a dictionary. Flags can be put before or after <word/phrase>
.
camb <word/phrase> # look up a word/phrase in Cambridge Dictionary
camb <word/phrase> -w # look up a word/phrase in Merriam-Webster Dictionary
camb <word/phrase> -c # look up a word/phrase in Cambridge with Chinese translation
camb <phrase with apostrophe "'"> # camb "a stone's throw" | camb a stone\'s throw
camb <phrase with slash "\"> # camb "have your/its moments" | camb have your\/its moments
camb <word/phrase> -v # look up a word/phrase in verbose/debug mode
camb <word/phrase> -f # look up a word/phrase afresh without using cache
camb <word/phrase> -n # look up a word/phrase without showing spelling suggestions if not found
For listing and deletinng items in the cache.
camb l # list words/phrases found before in alphabetical order
camb l -t # list words/phrases found before in reverse chronological order
camb l -r # list 20 words/phrases from the word list randomly
camb l -d # delete one or multiple words/phrases(separated by ", ") from the list
camb -h, --help # show this help message and exit
camb -v, --version # print the current version of the program