Pinyin Rest Save

Rest API to convert Chinese characters to Pinyin and convert between Pinyin with tone marks and Pinyin with tone numbers.

Project README

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": ["wǒ ", ["de",  "dī",  "dí",  "dì"], " māo xǐhuan ", ["hē", "hè"], " 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": "gè",
             "definition": "classifier for people or objects in general"
           },
           "ke1": {
             "traditional": "顆",
             "simplified": "颗",
             "mandarin": "kē",
             "definition": "classifier for small spheres, pearls, corn grains, teeth, hearts, satellites etc"
           }
         }
       }
     }
   }

Contributing

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

Open Source Agenda is not affiliated with "Pinyin Rest" Project. README Source: pepebecker/pinyin-rest
Stars
31
Open Issues
4
Last Commit
4 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating