Skip to main content

A third-party Python API for Pedia Cloud Dictionary

Project description

Pedia Cloud API

A third-party Python API for Pedia Cloud Dictionary


pip install pedia-cloud


Get all words and its meaning

>>> from pedia_cloud import PediaDictionary
>>> PediaDictionary.get_all("早")
[, ㄗㄠˇ, meanings count: 11]
>>> PediaDictionary.get_all("好")
[, ㄏㄠˇ, meanings count: 14, , ㄏㄠˋ, meanings count: 3]
>>> PediaDictionary.get_all("早")[0].meanings
[{'type': '[名]', 'def': '天剛亮的時候...'}, ...]

Get all possible part-of-speech

>>> from pedia_cloud import PediaDictionary
>>> PediaDictionary.get_all_poss("好")
Counter({'副': 7, '形': 3, '動': 3, '歎': 2, '名': 2})

A word

>>> from pedia_cloud import PediaDictionary
>>> word = PediaDictionary.get_one("好")
>>> word
, ㄏㄠˇ, meanings count: 14
>>> word.text
>>> word.zuyin
>>> word.annotations
['美、善,理想的。', '友愛的。', ...]
>>> word.meanings
[{'type': '[形]', 'def': '美、善,...
>>> word.filter_by_pos(["副"])
[{'type': '[副]', 'def': '很、非常。表示程度深...

>>> word = PediaDictionary.get_one("囫")
>>> word.has_meaning
>>> word.annotations
>>> word.meanings
[{'def': '參見「囫圇」條。'}]
>>> word.meta
{'bopomofo': 'ㄏㄨˊ', 'pinyin': 'hú', 'definitions': [{'def': '參見「囫圇」條。'}]}

A meaning

>>> meaning = word.meanings[0]
>>> meaning
{'type': '[形]', 'def': '美、善 ...
>>> meaning.pos
>>> meaning.full
>>> meaning.annotation

Dictionary based idiom segmentation

I implement it by using pedia-cloud dictionary.
This will be slow for long sentence due to api call.

>>> from pedia_cloud import PediaDictionary
>>> PediaDictionary.segment("一鳴驚人")
['一', '鳴', '驚人']
>>> PediaDictionary.segment("匯集了世界各地的新聞來源")
['匯集', '了', '世界', '各', '地', '的', '新聞來源']

Project details

Download files

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

Source Distribution

pedia-cloud-0.0.11.tar.gz (5.3 kB view hashes)

Uploaded source

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