Ndic Documentation¶
Ndic is Python package for NAVER English-Korean and Korean-English dictionaries.
Search of both English-Korean and Korean-English dictionaries is provided.
Ndic works by crawling the web http://endic.naver.com/. To crawl, it uses Requests and BeautifulSoup. Therefore, you should use it in Internet Environments.
Ndic supports Python Python 2.7 & 3.4–3.7 because Requests officially supports these versions.
Quickstart¶
The usage is very simple.
But, make sure that:
- Ndic is installed
- The user is connected to the Internet.
Let’s get started with some simple examples.
Search for Words¶
Begin by importing the Ndic module:
>>> import ndic
Entering an English word as the search
function argument will return the
corresponding Korean word(s).
>>> ndic.search('apple')
'사과'
Conversely, entering a Korean word as the search
function argument will return
the corresponding English word(s).
>>> ndic.search('안녕하세요')
'Hi!'
Multiple Definitions¶
If the word you search has multiple meanings, you can choose the meaning of the desired order.
Unless you set any xth value, you will get the first meaning of the word.
>>> ndic.search('말', 1) # 1st meaning
'(언어) word, language, speech, (literary) tongue'
>>> ndic.search('말', 2) # 2nd meaning
'(동물) horse'
Search for Nonexistent Words¶
Entering a nonexistent word as the search
function argument will return the
empty string.
>>> ndic.search("aslkjfwe")
''
>>> ndic.search("아댜리야")
''
Network Error¶
If your network connection is lost, you will get below error message.
>>> ndic.search('...')
NdicConnectionError: Network connection is lost. Please check the connection to the Internet.