qinwf / jiebaR

Chinese text segmentation with R. R语言中文分词 (文档已更新 🎉 :https://qinwenfeng.com/jiebaR/ )
Other
344 stars 109 forks source link

[Bug report] 关键词提取模式,`segment(code,jiebar)` 方式报错。 #32

Closed BruceZhaoR closed 8 years ago

BruceZhaoR commented 8 years ago

Reproducible example:

library(jiebaR)
#关键词提取
kseg = worker(type = "keywords")

> segment("我爱北京天安门",kseg)
Error: "segment" %in% class(jiebar) is not TRUE
> kseg["我爱北京天安门"]
  8.9954   4.6674 
"天安门"   "北京" 
> kseg <= "我爱北京天安门"
  8.9954   4.6674 
"天安门"   "北京" 

Test Mix Segment mode

> mseg = worker()
> segment("我爱北京天安门",mseg)
[1] "我"     "爱"     "北京"   "天安门"
> mseg["我爱北京天安门"]
[1] "我"     "爱"     "北京"   "天安门"
> mseg <= "我爱北京天安门"
[1] "我"     "爱"     "北京"   "天安门"

My Env

> devtools::session_info()
Session info ------------------------------------------------------------
 setting  value                         
 version  R version 3.2.4 (2016-03-10)  
 system   x86_64, mingw32               
 ui       RStudio (0.99.879)            
 language (EN)                          
 collate  Chinese (Simplified)_China.936
 tz       Asia/Shanghai                 
 date     2016-03-21                    

Packages -----------------------------------------------------------------
 package        * version date       source        
  ...
 jiebaR         * 0.8     2016-01-30 CRAN (R 3.2.3)
 jiebaRD        * 0.1     2015-01-04 CRAN (R 3.2.3)
 memoise          1.0.0   2016-01-29 CRAN (R 3.2.3)
 microbenchmark * 1.4-2.1 2015-11-25 CRAN (R 3.2.3)
 Rcpp             0.12.3  2016-01-10 CRAN (R 3.2.3)
  ...
qinwf commented 8 years ago

segment 是对分词的,keywords(code, jiebar) 是对关键词的

BruceZhaoR commented 8 years ago

了解了,怪我没有仔细看说明文档。感觉这个 <= 是通用的。:blush: