npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tobopomo.js

v2.0.0

Published

An api for mapping romanji to bopomo script and convert bopomo script to Chinese characters.

Downloads

11

Readme

#tobopomo.js

將輸入的字串轉成對應的注音回傳;亦可將注音轉換成漢字

Mapping the input string to bopomo script and then turn bopomo script into chinese characters.

###Installation

####Install Globally

sudo npm install -g tobopomo.js

####Install Locally

In your package.json

...
"dependencies" : {
  "tobopomo.js":"*",
},
...

In your code

require("tobopomo.js")

###Usage

This plugin provide two functions for you to trasform romaji to bopomo script or translate bopomo script to Chinese characters. There are two methods to using this plugin.

1.Normal function call.

tobopomo("su3cl3a8 "); // [ 'ㄋㄧˇ', 'ㄏㄠˇ', 'ㄇㄚ' ] 

tokanji("ㄋ一ˇㄏㄠˇㄇㄚ "); // [ [ '你好嗎', '妳好嗎' ] ] 

tokanji("ㄍㄨˇ"); // [ [ '股', '古', '谷', '鼓', '骨' ] ]  #default output 5 of characters

tokanji("ㄍㄨˇ" , 3); // [ [ '股', '古', '谷' ] ] #if you want to change the output number just simply pass the number as second parameter. 

2.You can call the methods by using strings itself.

"su3cl3a8 ".tobopomo(); // [ 'ㄋㄧˇ', 'ㄏㄠˇ', 'ㄇㄚ' ] 

"ㄋ一ˇㄏㄠˇㄇㄚ".tokanji(); // [ [ '你好嗎', '妳好嗎' ] ]

"ㄍㄨˇ".tokanji(); // [ [ '股', '古', '谷', '鼓', '骨' ] ] 

"ㄍㄨˇ".tokanji(3); // [ [ '股', '古', '谷'] ]  #pass the limit number as parameter into tokanji method in string mode.

###Command Line Tool

You can also use the command line tool for simple text search.

options:
  -b : transfrom into Bopomo script
  -k : transfrom into Chinese characters
  -l : limit the output characters number

The example command

$tobopomo -b su3cl3a8  #[ 'ㄋㄧˇ', 'ㄏㄠˇ', 'ㄇㄚ' ]
$tobopomo -k ㄨㄛˇ #[ '我', '捰', '婐', '婑' ]
$tobopomo -b su3cl3a8 -k #[ [ '你好嗎', '妳好嗎' ] ]
$tobopomo -b ji3 -k -l 2 #[ [ '我', '捰' ] ]

###TODO

  • [x] 使用 crystal 加速資料分類
  • [x] String method 實作
  • [x] 切字功能
  • [x] 切詞功能
  • [x] 字重排比
  • [x] 限制輸出數量
  • [ ] 不同語言實作
  • [x] 建立成 node module

##Credit

Thanks for chewing team and libchewing's help. Without them this project wouldn't be successed.

##LICENSE This project is licensed under LGPL License. For furthor detail please checkout LICENSE.md or connect with me dylandy.chang at gmail.com.