Skip to main content

Pedia Cloud API

A third-party Python API for Pedia Cloud Dictionary

Install

pip install pedia-cloud

Usage

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
False
>>> 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("匯集了世界各地的新聞來源")
['匯集', '了', '世界', '各', '地', '的', '新聞來源']

Release files for pedia-cloud 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pedia-cloud 0.0.11
File Size Uploaded
pedia-cloud-0.0.11.tar.gz 5.3 kB Details

Release files / pedia-cloud-0.0.11.tar.gz

Download URL pedia-cloud-0.0.11.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
61a828b2c73c92da91a6af6e52d984c90168145fa4bf43a603b7c14389610ee1
BLAKE2b-256 checksum
How to use checksums
76bb12bdef7d1f278e4cfa903c34931d4cdf68e03d957a1272c4ebdc5f41fd1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.11 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page