πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Book a DemoInstallSign in
Socket

krdict.js

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

krdict.js

A node.js module to interact with krdict, the Korean Learners' Dictionary

1.5.0
latest
Source
npm
Version published
Weekly downloads
5
-72.22%
Maintainers
1
Weekly downloads
Β 
Created
Source

krdict.js

A node.js module to interact with krdict, the Korean Learners' Dictionary, through its API. To use this module you'll need an API key from krdict.

To install the module from npm run:

npm install krdict.js

An example of a basic query with only the required parameters:

const krdict = require('krdict.js');

krDict.setKey(API_KEY);

krdict.dictionarySearch({
    query: 'λ‚˜λ¬΄',
}).then((response) => {
    console.log(JSON.stringify(response.data));
});

Which would ouput something like this:

{
  "channel": {
    ...
    "item": [
      {
        "word": [ "λ‚˜λ¬΄" ],
        "vocabularyGrade": [ "μ΄ˆκΈ‰" ],
        "partOfSpeech": [ "λͺ…사" ],
        ...
        "meaning": [
          {
            "meaningOrder": [ "1" ],
            "definition": [ "λ‹¨λ‹¨ν•œ 쀄기에 가지와 잎이 달린, μ—¬λŸ¬ ν•΄ λ™μ•ˆ μžλΌλŠ” 식물." ]
          },
          ...
        ]
      },
      ...
    ]
  }
}

Additional parameters can be passed in

const krdict = require('krdict.js');

krdict.setKey(API_KEY);

krdict.dictionarySearch({
    query: 'λ‚˜λ¬΄',
    sortMethod: 'alphabetical',
    shouldTranslate: true,
    translationLanguage: 'english'
}).then((response) => {
    console.log(JSON.stringify(response.requestParameters));
    console.log(JSON.stringify(response.data));
});

which are mapped to the parameter names and values expected by the krdict API:

{
  "key": "xyz",
  "q": "λ‚˜λ¬΄",
  "sort": "dict",
  "translated": "y",
  "trans_lang": 1
}
{
  "channel": {
    ...
    "item": [
        {
            "word": [ "λ‚˜λ¬΄" ],
            "vocabularyGrade": [ "μ΄ˆκΈ‰" ],
            "partOfSpeech": [ "λͺ…사" ],
            ...
            "meaning": [
                {
                    "meaningOrder": [ "1" ],
                    "definition": [ "λ‹¨λ‹¨ν•œ 쀄기에 가지와 잎이 달린, μ—¬λŸ¬ ν•΄ λ™μ•ˆ μžλΌλŠ” 식물." ],
                    "translation": [{
                        "language": [ "μ˜μ–΄" ],
                        "word": [ "tree" ],
                        "definition": [ "A plant with a hard stem, branches and leaves." ]
                    }]
                },
                ...
            ]
        },
        ...
    ]
  }
}

You can view a complete list of accepted parameters and their values on the wiki page

Keywords

Korean

FAQs

Package last updated on 06 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts