我们希望安居客的搜索引擎能够更好的做到同音字的容错,采用拼音容错是一个不错的方法。因此,需要一个将汉字转换为拼音的组件。同时,汉字转拼音组件还可以有多个用途,例如以拼音的首字母来检索小区名、人名等。
这样我们需要一个通用的将汉字转换为拼音的服务。
基本功能就是中文拉丁化,输入一段中文文本,输出转变为汉语拼音的文本。
要求原文中的全角标点符号、空格等应该转为对应的半脚符号。原汉字与英文间如果没有空格分隔,转换为拼音后应该加入空格分隔。
:w !sudo tee %
| int validate(int *pieces) { | |
| int sc[] = {0,0,0,0,0,0,0,0,0}; | |
| int sr[] = {0,0,0,0,0,0,0,0,0}; | |
| int sb[] = {0,0,0,0,0,0,0,0,0}; | |
| int n; | |
| for (n = 0; n < 81; n++) { | |
| int x = pieces[n]; | |
| if (x == 0) continue; | |
| if (x < 1 || x > 9) return 0; |
| /* | |
| put this script in the path like | |
| assumed /tmp (cwd) | |
| /tmp/dir1/dir2/path.go | |
| /tmp/dir3 symlinked to /tmp/dir1/dir2 | |
| and run with | |
| gorun ../tmp/dir3/path.go | |
| or build path.go and run with ../tmp/dir3/path |
| # bash_completion | |
| complete -o bashdefault -o default -o nospace -c ve |
| zone "twitter.com" IN { | |
| type forward; | |
| forward only; | |
| forwarders { | |
| 74.207.241.5; | |
| 74.207.242.5; | |
| }; | |
| }; |
still running from source
$ git clone git://github.com/ansible/ansible.git
$ cd ./ansible
$ virtualenv .virtualenv
$ source .virtualenv/bin/activate
$ pip install paramiko PyYAML jinja2
| // | |
| // $ gcc -std=c99 glowpz.c -o glowpz | |
| // | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| const uint32_t ORIGIN = 0x0CCCC; // 0 1100 1100 1100 1100 | |
| const uint32_t TARGET = 0x05A5A; // 0 0101 1010 0101 1010 |