Skip to content

Latest commit

 

History

History
125 lines (107 loc) · 3.61 KB

README.md

File metadata and controls

125 lines (107 loc) · 3.61 KB

Pinyin REST

dependency status dev dependency status MIT-licensed chat on gitter

Install

npm install pinyin-rest

GET /pinyin/...

Examples

GET: https://api.pinyin.pepe.asia/pinyin/我的猫喜欢喝牛奶
=> {
     "text": "wǒ de māo xǐhuan hē niúnǎi",
     "data": ["", ["de",  "",  "",  ""], " māo xǐhuan ", ["", ""], " niúnǎi"]
   }
GET: https://api.pinyin.pepe.asia/pinyin/wo3 xi3huan1 he1 cha2
=> {
     "text": "wǒ xǐhuān hē chá",
     "data": "wǒ xǐhuān hē chá"
   }
GET: https://api.pinyin.pepe.asia/pinyin/woxihuanhecha?split=true
=> {
     "text": "wo xi huan he cha",
     "data": ["wo", "xi", "huan", "he", "cha"]
   }

GET /definition/...

Example

GET: https://api.pinyin.pepe.asia/definition/的
=> {
     "de5": [
       "of",
       "~'s (possessive particle)",
       "(used after an attribute)",
       "(used to form a nominal expression)",
       "(used at the end of a declarative sentence for emphasis)"
     ],
     "di1": [
       "see 的士[di1 shi4]"
     ],
     "di2": [
       "really and truly"
     ],
     "di4": [
       "aim",
       "clear"
     ]
   }

GET /hanzi/...

Example

GET: https://api.pinyin.pepe.asia/hanzi/苹果
=> {
     "traditional": "蘋果",
     "simplified": "苹果",
     "data": {
       "ping2 guo3": {
         "mandarin": "píng guǒ",
         "definitions": [
           "apple"
         ],
         "classifiers": {
           "ge4": {
             "traditional": "",
             "simplified": "",
             "mandarin": "",
             "definition": "classifier for people or objects in general"
           },
           "ke1": {
             "traditional": "",
             "simplified": "",
             "mandarin": "",
             "definition": "classifier for small spheres, pearls, corn grains, teeth, hearts, satellites etc"
           }
         }
       }
     }
   }

Related

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.