GithubHelp home page GithubHelp logo

google_dict's Introduction

Dictionary project

It parses json output either from sdcv and a 3rd party Google dictionary API dictionary.dev and append the searched word to a file.

Toy project to learn Golang. I mainly use sdcv for cli dictionary tool. But if I couldn't find a word, then I tend to open a browser, go to Google, type dictionary, and type in the word, which is a very annoying process. This simple Go program does that in my terminal with two words.

I don't like relying on 3rd party API but I'm going to just use it until I find some other solutions.

I use a bash script to wrap sdcv and parse_dict and save the word I searched in a file so that I can memorize more words.

Program structure

  1. Parse json from sdcv

If --google flag is given,

  1. Use Google dicdtionary 3rd party API
  2. Get request
  3. Parse json response
  4. Display it pretty

Installation

  1. Install sdcv

  2. Download dictionaries

    Go to https://web.archive.org/web/20200702000038/http://download.huzheng.org/ and download dictionaries to use.

  3. Place the dictionaries in a folder and set $STARDICT_DATA_DIR

Usage

# sdcv
sdcv --non-interactive --utf8-output --color --json-output "$word" \
    | COLUMNS="${$(tput cols):-72}" parse_dict

# google dict
curl --silent "https://api.dictionaryapi.dev/api/v2/entries/${LANG:-en_US}/$word}" \
    | COLUMNS=$COLUMNS parse_dict -google

TODO

  • Let user configure the history file path through a flag
  • Multiple words found e.g.) try "unpair" to sdcv
  • No word found

google_dict's People

Contributors

sbinnee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.