Skip to main content

cambridge is a terminal version of Cambridge Dictionary.

Project description

Cambridge

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.

Screenshots

Look up Cambridge Dictionary

look up a word in Cambridge Dictionary

Look up Merriam-Webster Dictionary

look up a word in Merriam-Webster Dictionary

Why This

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.

Highlights

  1. camb <word/phrase> to look it up in Cambridge Dictionary by default
  2. -w flag to fetch Merriam-Webster Dictionary
  3. less than 2s taken to do all the work for the word, including fetching, parsing, printing, and writing cache
  4. less than 0.1s for the same word's later search
  5. only the first dictionary from Cambridge, avoiding confuses by multiple dictionaries
  6. a list of word/phrase suggestions will be given, if not found
  7. camb l to list words and phrases you've found before
  8. colorscheme well customized to dark, light, blue, grey, gruvbox terminal backgrounds

fzf

With fzf installed, camb l | fzf --preview 'camb {}' will get you a taste of the fzf magic:

  1. display the whole word list
  2. fuzzy find a word from the word list & preview its meaning instantly
  3. preview each word definition instantly as you scroll through the list
  4. alias cambl="camb l | fzf --preview 'camb {}'" can be added in your bashrc for convenience

list words

Install & Uninstall

pip install cambridge # install
pip uninstall cambridge && rm -rf $HOME/.cache/cambridge # uninstall and remove cache

Usages

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 "'" > # camb "a stone's throw" | camb a stone\'s throw
camb <phrase with "/" > # camb "have your/its moments" | camb have your\/its moments

camb <word/phrase> -d   # look up a word/phrase in 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 suggestions if not found

Command l

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 more words/phrases(separated by ", ") from the list

Command wod

For displaying 'Word of the Day' in the Merriam Webster Dictionary

General options

camb -h, --help         # show this help message and exit
camb -v, --version      # print the current version of the program

TO-DOS

  • input a new word/phrase when spelling suggestions are not satisfactory without restarting a new command line
  • check a particular expression against all cached sentence examples, if found, we can confidently use it like that in our speaking or writing
  • split and accumulate all sentences from a whole bulk of cache as independent Corpus, then we can use this Corpus outside this program
  • strengthen 'Word of the Day' functionality from Webster

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cambridge-3.8.2.tar.gz (710.7 kB view details)

Uploaded Source

Built Distribution

cambridge-3.8.2-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file cambridge-3.8.2.tar.gz.

File metadata

  • Download URL: cambridge-3.8.2.tar.gz
  • Upload date:
  • Size: 710.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for cambridge-3.8.2.tar.gz
Algorithm Hash digest
SHA256 f006426355457bcb90d2eb8d277b6f6d8f72dbf9ef5fd6ba33ec657e33e45c87
MD5 9a17e420c88d1f62e3ba7841a61728b1
BLAKE2b-256 5b453e94e9e10cf8538663f337a915397741455d1c28c0cca359e399f42732a3

See more details on using hashes here.

File details

Details for the file cambridge-3.8.2-py3-none-any.whl.

File metadata

  • Download URL: cambridge-3.8.2-py3-none-any.whl
  • Upload date:
  • Size: 38.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for cambridge-3.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5f106f49b40aa8cbe2c09c192a140ef8dc997acc85b5def31f29037c97ff6d89
MD5 40496c2918f518cc77808280d49f9d32
BLAKE2b-256 caaa9298f14df0077aefe7c2e12408a93ba12441e94e598dd80e8cfa5b696b52

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page