PostgreSQL汉字转拼音首字母,最近有个需求要做搜索优化,要求提取汉字首字母识别输入,图方便直接数据库用函数批量转换了,整理了网上的两个方法函数备忘,非原创。
https://blog.qdac.cc/?p=1281
https://developer.aliyun.com/article/228252
题外话,Java方案可以引入pinyin4j直接使用蛮方便,hutool也封装了拼音解决方案,通过SPI机制引入具体实现,maven坐标如下:
https://pinyin4j.sourceforge.net/
<dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>5.8.15</version>
</dependency><!--汉字转拼音方案实现-->
<dependency><groupId>com.belerweb</groupId><artifactId>pinyin4j</artifactId><version>2.5.1</version>
</dependency>
演示效果
SELECT pinyin_first_cap('hello WORLD,你好,世界,@饕餮1996');HELLOWORLDNHSJTT1996SELECT pinyin_first_char('hello WORLD,你好,世界,@饕餮1996');HELLO WORLD,NH,SJ,@饕餮1996
方案1(字符集全,推荐)
CREATE OR REPLACE FUNCTION "public"."bytea_to_int"("data" bytea)RETURNS "pg_catalog"."int4" AS $BODY$
declarenLen int;i int;v int = 0;t int = 0;
beginnLen = length(data);for i in 0..nLen-1 loopt = get_byte(data,i);t = t * power(256,(nLen-1-i));v = v + t;end loop;return v;
end;
$BODY$LANGUAGE plpgsql VOLATILECOST 100
CREATE OR REPLACE FUNCTION "public"."pinyin_first_cap"("v_str" varchar)RETURNS "pg_catalog"."varchar" AS $BODY$
DECLAREpos INT4;hzlen INT4;hz VARCHAR (10);hzbm INT4;hzpy VARCHAR (10);py VARCHAR (4000);hasspace INT4;-- 相比pinyin_first_char()字符集要全,推荐使用-- hz 汉字;-- 下方不是乱码,是汉字编码首拼音对照表,不要删改任何字符,每个编码区3500个字符。hzpybm_0 CONSTANT VARCHAR (3500) = ' KSXMMCSDQLYBJJJGCZBJFYYSJHYHCHZGJHHDSNKKTMOCXYPSNQSECCZGQLLYJMS YSSGYQYDYXJYYDLDWJJWBBFJEXTHGBCCCRFCQWYFCWDZPYDDWYXJAJPDFTCYCQXXCXNNXXZQBPZSYZHMZBQBZ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HTBWJYBJJBXJJTJTEEKHWSLZKLPSFAZPQQBDLQJJTYYQLYZKDKSQJ YYJZLDQCGJQYZJSYCMRAQTHTEJMFCTYHY PKMHYCWJDCFHYYXWSHCTXRLJGJSHCCYYYJLTKTTYTMXGTCJTZAYYOCZLYLBSZYW JYTSJYHBYSHFJLYGJXXTMZYYLTXXYPZLX ';hzpybm_9 CONSTANT VARCHAR (3500) = ' YJZYZYYPNHMYMDYYLBLHLSYYGQLLSCXLXHZWKQGYSHQYWLJYYHZMSLJLJXCJJYY CPCPZJMYLCJLNJJJLXXJMLZJQLYCMHCFM MFPQQMFXLMCFQMMMZNFHJGTTHKHCHYDXTMQDYMYYDYYYDZDCYMDYDLFMYCQCWZZ MABTBCMDZGDFYCGCYTTNFWBDTZQSSSTJJ HJYTSXLYWWHXEXWZNNQZJZJJCCCHYYXBZXZCYJTLLCQXYNJYCYYCYNZZQYYYEWY CZDCJYHYLPGPYLLGKDLDGQBCHJXY ';BEGINhzlen = COALESCE(LENGTH (v_str), 0);hasspace = 0;FOR pos IN 1 .. hzlenLOOPhz = SUBSTR (v_str, pos, 1);hzbm = bytea_to_int(convert_to(hz,'gbk'));IF hzbm BETWEEN 0 AND 127THENhz = UPPER(hz); --大写, 并只允许 0-9 和 A-Z 字符IF (hz >= '0' AND hz <= '9') OR (hz >='A' AND hz <= 'Z') THENpy = CONCAT(py, hz);END IF;ELSEBEGINhzbm = hzbm - 32767;--少减1, 因为下面使用字符串定位, 起始基址为1CASEWHEN hzbm < 0THENhzpy = '';WHEN hzbm < 3500THENhzpy = SUBSTR (hzpybm_0, hzbm, 1);WHEN hzbm < 7000THENhzpy = SUBSTR (hzpybm_1, hzbm - 3500, 1);WHEN hzbm < 10500THENhzpy = SUBSTR (hzpybm_2, hzbm - 7000, 1);WHEN hzbm < 14000THENhzpy = SUBSTR (hzpybm_3, hzbm - 10500, 1);WHEN hzbm < 17500THENhzpy = SUBSTR (hzpybm_4, hzbm - 14000, 1);WHEN hzbm < 21000THENhzpy = SUBSTR (hzpybm_5, hzbm - 17500, 1);WHEN hzbm < 24500THENhzpy = SUBSTR (hzpybm_6, hzbm - 21000, 1);WHEN hzbm < 28000THENhzpy = SUBSTR (hzpybm_7, hzbm - 24500, 1);WHEN hzbm < 31500THENhzpy = SUBSTR (hzpybm_8, hzbm - 28000, 1);WHEN hzbm < 35000THENhzpy = SUBSTR (hzpybm_9, hzbm - 31500, 1);ELSEhzpy = '';END CASE;IF hzpy <> ' ' THENpy = CONCAT(py, hzpy);END IF;END;END IF;END LOOP;RETURN py;
END;
$BODY$LANGUAGE plpgsql IMMUTABLECOST 100
方案2(部分转换不了,不推荐)
CREATE OR REPLACE FUNCTION "public"."pinyin_first_char"("s" varchar)RETURNS "pg_catalog"."varchar" AS $BODY$
declareretval character varying;c character varying;l integer;b bytea; w integer;-- 【汉字转为首字母大写】-- 推荐使用【pinyin_first_cap】
-- 小写字母会被转为大写,中文转为拼音首字母大写,其他原样输出(GB18030字符集有限,少部分字无法转换原样输出,该函数还有待改进)
-- SELECT pinyin_first_char('hello WORLD,你好,世界')
-- HELLO WORLD,NH,SJbegin
l=length(s);
retval='';
while l>0 loopc=left(s,1);b=convert_to(c,'GB18030')::bytea;if get_byte(b,0)<127 thenretval=retval || upper(c);elsif length(b)=2 thenbeginw=get_byte(b,0)*256+get_byte(b,1);--汉字GBK编码按拼音排序,按字符数来查找if w between 45217 and 45252 then --"A";45217;45252;35retval=retval || 'A';elsif w between 45253 and 45760 then --"B";45253;45760;507retval=retval || 'B';elsif w between 45761 and 46317 then --"C";45761;46317;556retval=retval || 'C';elsif w between 46318 and 46825 then --"D";46318;46825;507retval=retval || 'D';elsif w between 46826 and 47009 then--"E";46826;47009;183retval=retval || 'E';elsif w between 47010 and 47296 then--"F";47010;47296;286retval=retval || 'F';elsif w between 47297 and 47613 then --"G";47297;47613;316retval=retval || 'G';elsif w between 47614 and 48118 then --"H";47614;48118;504retval=retval || 'H';elsif w between 48119 and 49061 then --"J";48119;49061;942retval=retval || 'J';elsif w between 49062 and 49323 then--"K";49062;49323;261retval=retval || 'K';elsif w between 49324 and 49895 then --"L";49324;49895;571retval=retval || 'L';elsif w between 49896 and 50370 then --"M";49896;50370;474retval=retval || 'M';elsif w between 50371 and 50613 then --"N";50371;50613;242retval=retval || 'N';elsif w between 50614 and 50621 then --"O";50614;50621;7retval=retval || 'O';elsif w between 50622 and 50905 then--"P";50622;50905;283retval=retval || 'P';elsif w between 50906 and 51386 then --"Q";50906;51386;480retval=retval || 'Q';elsif w between 51387 and 51445 then--"R";51387;51445;58retval=retval || 'R';elsif w between 51446 and 52216 then --"S";51446;52217;retval=retval || 'S';elsif w between 52218 and 52697 then --"T";52218;52697;479retval=retval || 'T';elsif w between 52698 and 52979 then--"W";52698;52979;281retval=retval || 'W';elsif w between 52980 and 53688 then --"X";52980;53688;retval=retval || 'X';elsif w between 53689 and 54480 then --"Y";53689;54480;791retval=retval || 'Y';elsif w between 54481 and 55289 then --"Z";54481;55289;808retval=retval || 'Z';else retval=retval || c;end if;end;end if;s=substring(s,2,l-1);l=l-1;
end loop;
return retval;
end;
$BODY$LANGUAGE plpgsql IMMUTABLECOST 100