paip.输入法编程--词频调整原则--发音长度优先

时间:2021-02-18 20:15:17
paip.输入法编程--词频调整原则--发音长度优先


作者Attilax ,  EMAIL:1466519819@qq.com 
来源:attilax的专栏
地址:http://blog.csdn.net/attilax




准备打个 "提升" ,编码是 "tishen   sp"..


江打的个"tishen" ,出来个"听审,提升"...


听审的编码是"tinshen kb"...发音是 tinshen


按发音还是按编码, 听审都到个"提升"的前头了...


要不个"提升"提的个前头了...应该是按发音长度优先排序才对..


增加一个列len_fain.  fault=0  ,not null


 update  gaopinzi  set len_fain=LENGTH(py)  where  LENGTH(py)>0




[SQL]  update  gaopinzi  set len_fain=LENGTH(py)  where  LENGTH(py)>0


受影响的行: 266638
时间: 38.609s






增加in up 触发器
-------------------------


CREATE TRIGGER `swe_len_fain4insert` BEFORE INSERT ON `gaopinzi` FOR EACH ROW begin
 update  gaopinzi  set len_fain=LENGTH(py)  where id=new.id;
#insert  logx(idop,eventx,timex,demo,hezi,pyold,pynew)values( old.id,'update rec',now(),'',old.hezi,old.atian,new.atian);
end;


CREATE TRIGGER `swe_len_fain4up` BEFORE UPDATE ON `gaopinzi` FOR EACH ROW begin
  set    new.len_fain=LENGTH(new.py)  ;
#insert  logx(idop,eventx,timex,demo,hezi,pyold,pynew)values( old.id,'update rec',now(),'',old.hezi,old.atian,new.atian);
end;


修改导出sql
------------
SELECT SQL_NO_CACHE *,
py,
hezi,
id,


IF (
gudin = 1,
CONCAT(ATIAN, '#固'),
ATIAN
) AS nyefa
, lan_ord  lanOrd,lang
FROM
gaopinzi   
 force index(i_export)
WHERE LENGTH(atian) >0 
and ( del=0 or del is null)
  
ORDER BY 
lanOrd, atipydiff,len_fain,py,atian,
gudinfejwe ,
ord,
iD