Socket
Socket
Sign inDemoInstall

krdict.js

Package Overview
Dependencies
5
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

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


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 06 Sep 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc