hunspell pakckage中添加词汇的方法是什么

时间:2019-07-15 09:57:16

标签: r dictionary hunspell

我有一个我想用反拼写法纠正的单词列表 但是用这些词来说,可能是hunspell不知道的某些特定词,他必须不正确(该列表未定义,并且太长,无法手动添加)

我可以使用哪种方法来解决?

我已经尝试找到并升级字典

这是单词列表:

where (case WHEN LineQuantity IS NULL THEN 0 ELSE LineQuantity - PreAllocationDespatch END )  != LineQuantity 

所以真的是不好的拼写,例如转移或吸收,但其他都是特殊的单词或字谜 这是代码:

    keywords<-c("Millimeter",            "OMT",                   "Chooz",                
   "DCTPC", "JEM"                   "EUSO"                 
    "EUSO", "EUSO"                  "PDM"                  
   "FPGA",  "Chooz"                 "Cepheids"             
   "Circumstellar","Tokamak"               "ASIC"                 
   "TiSAFT", "CoRoT"                 "Unes"                 
   "Radioastronomy" ,"Coronagraphy",          "Fiber",                
  "Ultrastable" ,"Puslsar"               "Magnetohydrodynamic",  
   "KSZ", "Gaussianity",           "Raman",                
   "Gravimetry", "Casimir"               "transfert"            
   "TES", "MEMS",                  "CMB",                  
   "CMB" ,"TES"                   "Blazar"               
   "modeling","DFB"                   "linewidth"            
   "Asteroseismology","ExPRES",                "NDA",                  
   "rephasing", "Nulling",               "Gyroscop",             
   "Atmopsheric","fibers",                "Spectroscopie",        
   "d'absorption","Calculs",               "Aluminum",             
  "Transneptunian","Planetology",           "Ultrastable",          

1 个答案:

答案 0 :(得分:0)

dictionary()add_words参数一起使用-

library("hunspell")
keywords<-c("Millimeter", "OMT","Chooz")
words <- c("OMT", "wiskey")
correct_pkg <- hunspell_check(words)
correct_custom <- hunspell_check(words, dict = dictionary("en_US", add_words=keywords))
correct_pkg
correct_custom

输出

> correct_pkg
[1] FALSE FALSE

> correct_custom
[1]  TRUE FALSE

请注意,在第二种情况下,"OMT"是如何被接受为单词的。