搜狗输入法词库格式:
\'ni\'kan\'xia 你看下
\'ni\'kan\'xia\'gai\'hou 你看下改后
\'ni\'kan\'xing\'ma 你看行吗
\'ni\'kan\'zen\'me\'yang 你看怎么样
\'ni\'kan\'zhe 你看着
\'ni\'kan\'zhe\'ban 你看着办
\'ni\'kan\'zhe\'jiu\'xing 你看着就行
\'ni\'kao\'bu\'kao 你考不考
\'ni\'kao\'de 你考得
\'ni\'kao\'wan 你考完
\'ni\'kao\'yan 你考研
\'ni\'kao\'yan\'ma 你考研吗
QQ拼音输入法词库格式:
nong\'hao\'le\'fa\'gei\'ni 弄好了发给你 1, nong\'hao\'le\'fa\'gei\'ni 1
nong\'huai\'le 弄坏了 1, nong\'huai\'le 1
nong\'hui\'lai\'le 弄回来了 1, nong\'hui\'lai\'le 1
nong\'lai 弄来 1, nong\'lai 1
nong\'le 弄了 1, nong\'le 1
nong\'le\'yi\'tian 弄了一天 1, nong\'le\'yi\'tian 1
nong\'le\'yi\'xia 弄了一下 1, nong\'le\'yi\'xia 1
nong\'mei 浓眉 1, nong\'mei 1
nong\'mi 浓密 1, nong\'mi 1
nong\'min 农民 1, nong\'min 1
nong\'ming\'bai 弄明白 1, nong\'ming\'bai 1
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAXLINE 100000 #define BUFLEN 10240 int main() { FILE *file,*fw; fw = fopen("b.txt","a");//以追加方式写入 char buf[BUFLEN]; int len=0,i=0,j; char *array[MAXLINE]; file=fopen("a.txt","r"); if(!file) return -1; while(fgets(buf,BUFLEN,file)) { len=strlen(buf); array[i]=(char*)malloc(len+1); if(!array[i]) break; strcpy(array[i++],buf); putchar(\'\n\'); } int first=0; fclose(file); i--; while(i>=0&&array[i]) { first=0; printf("%s\n",array[i]); for(j=0;array[i][j+1]!=\'\0\';j++) { if(first==0&&array[i][j]==\'\\'\') { first=1; } else { fprintf(fw,"%c",array[i][j]); } } first=0; fprintf(fw," 1, "); for(j=0;array[i][j+1]!=\'\0\';j++) { if(first==0&&array[i][j]==\'\\'\') { first=1; } else { if (array[i][j]==39||(array[i][j]>=97&&array[i][j]<=122)) { fprintf(fw,"%c",array[i][j]); } } } fprintf(fw," 1\n"); free(array[i--]); first=1; } }
本文出自 “阿凡达” 博客,请务必保留此出处http://shamrock.blog.51cto.com/2079212/702510