第一周周日DailyReporting——PM(李忠)
今天工作進展順利,各個人的任務(wù)都完成了預(yù)期效果:
(1)陳伯雄:search部分的框架更改已經(jīng)設(shè)計出來,之前的框架問題百出,不適合查詢,現(xiàn)在是優(yōu)化了框架;
(2)劉宇翔:找出了800多個match部分用的測試文檔;給我優(yōu)化后的代碼找出了一些bug和不足;
(3)張孝祖:上傳功能Upload部分已經(jīng)基本完成,能夠把文件上傳到服務(wù)器了,下面就是積分的處理了;
(4)潘學(xué):下載功能還有一些問題,積分功能差不多完成了;
(5)李忠:今天給劉宇翔的match進行了優(yōu)化,提高了容錯率,我加入了比較兩個字符串的編輯距離的方法,并將半角標點符號統(tǒng)一轉(zhuǎn)化為全角處理;
明天將繼續(xù)今天的工作,張孝祖和潘學(xué)明天就能完成了,剩下的就是search和match
?
我的設(shè)計的編輯距離的代碼和半角標點符號轉(zhuǎn)全角標點符號的代碼
//編寫一個求兩個字符串編輯距離的方法,提高容錯率
??????? static public int editDistance(string x , string y) {
??????????? //定義三個常量分別表示插入、刪除和修改一個字符所消耗的編輯次數(shù)
??????????? const int COSTINDEL = 1;
??????????? const int COSTININS = 1;
??????????? const int COSTINSUB = 1;
??????????? int xLength = x.Length, yLength = y.Length;
??????????? //二維數(shù)組distance用于存儲動態(tài)規(guī)劃過程中每一步的編輯距離
??????????? int row = xLength + 1, low = yLength + 1;
??????????? int[][] distance=new int[row][];
??????????? for (int i = 0; i < row; i++) {
??????????????? distance[i] = new int[low];
??????????? }
??????????? //初始化距離distance二維表的行和列
??????????? distance[0][0] = 0;
??????????? for (int i = 1; i < row; i++) {
??????????????? distance[i][0] = distance[i - 1][0] + COSTINDEL;
??????????? }
??????????? for (int j = 1; j < low; j++) {
??????????????? distance[0][j] = distance[0][j - 1] + COSTININS;
??????????? }
??????????? //利用動態(tài)規(guī)劃算法求x和y的編輯距離
??????????? for (int i = 1; i < row; i++) {
??????????????? for (int j = 1; j < low; j++) {
??????????????????? //分別用delDistance、insDistance和subDistance暫存要編輯到distance[i][j]的各種方式的編輯次數(shù)
??????????????????? int delDistance = distance[i - 1][j] + COSTINDEL;
??????????????????? int insDistance = distance[i][j - 1] + COSTININS;
??????????????????? int subDistance = distance[i - 1][j - 1] + (x[i - 1] == y[j - 1] ? 0 : COSTINSUB);
??????????????????? int temp;
??????????????????? distance[i][j] = subDistance < (temp = (delDistance < insDistance ? delDistance : insDistance)) ? subDistance : temp;??? //選擇一個編輯次數(shù)最少的值附給distance[i][j]
??????????????? }
??????????? }
??????????? return distance[xLength][yLength];???????????? //返回兩個數(shù)的編輯距離的
??????? }
?
?//將標點符號進行更改的從半角轉(zhuǎn)化為全角的方法
??????? static string half_to_whole(string s) {
??????????? int sLength=s.Length;
??????????? char[] c=s.ToCharArray();
??????????? for (int i = 0; i < sLength; i++) {
??????????????? byte[] b = System.Text.Encoding.Unicode.GetBytes(c,i,1);
??????????????? if (b.Length == 2) {
??????????????????? if (b[1] == 0 && !(c[i] >= 'a' && c[i] <= 'z' || c[i] >= 'A' && c[i] <= 'Z' || c[i] >= '0' && c[i] <= '9'))
??????????????????? {
??????????????????????? b[0] = (byte)(b[0] - 32);
??????????????????????? b[1] = 255;
??????????????????????? c[i] = System.Text.Encoding.Unicode.GetChars(b)[0]; ?
??????????????????? }
??????????????? }
??????????? }
??????????? string news = new string(c);
??????????? return news;
??????? }
轉(zhuǎn)載于:https://www.cnblogs.com/DOOM-scse/archive/2012/11/04/2754421.html
總結(jié)
以上是生活随笔為你收集整理的第一周周日DailyReporting——PM(李忠)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 救护伤员
- 下一篇: 修改 Workshop 中 text b