跟tmcn比了一下,效率跟效果都差不多,那只能说明dapeng最开始写的包真不咋滴
library(tmcn)
#> # tmcn Version: 0.2-13
library(pinyin)
pinyin::py("我喜欢旅游 abcasdfasdfa")
#> 我喜欢旅游 abcasdfasdfa
#> "_wo_xi_huan_lv_you abcasdfasdfa"
tmcn::toPinyin("我喜欢旅游 abcasdfasdfa")
#> [1] "woxihuanlvyou abcasdfasdfa"
microbenchmark::microbenchmark(list = list(
pinyin = pinyin::py("我喜欢旅游 abcasdfasdfa"),
tmcn = tmcn::toPinyin("我喜欢旅游 abcasdfasdfa")
), unit="ns", times = 100)
#> Unit: nanoseconds
#> expr min lq mean median uq max neval cld
#> pinyin 10 14 17.31 15 16 162 100 a
#> tmcn 11 13 18.97 14 15 470 100 a
<sup>Created on 2019-10-21 by the reprex package (v0.3.0)</sup>