基礎需求
html
進階需求
java
PSP | Personal Software Process Stages | 預估耗時(分鐘) | 實際耗時(分鐘) |
Planning | 計劃 | ||
• Estimate | • 估計這個任務須要多少時間 | 15 | 15 |
Development | 開發 | ||
• Analysis | • 需求分析 (包括學習新技術) | 30 | 120 |
• Design Spec | • 生成設計文檔 | 30 | 15 |
• Design Review | • 設計複審 | 30 | 15 |
• Coding Standard | • 代碼規範 (爲目前的開發制定合適的規範) | 30 | 30 |
• Design | • 具體設計 | 60 | 80 |
• Coding | • 具體編碼 | 240 | 210 |
• Code Review | • 代碼複審 | 30 | 15 |
• Test | • 測試(自我測試,修改代碼,提交修改) | 60 | 90 |
Reporting | 報告 | ||
• Test Repor | • 測試報告 | 30 | 80 |
• Size Measurement | • 計算工做量 | 30 | 30 |
• Postmortem & Process Improvement Plan | • 過後總結, 並提出過程改進計劃 | 30 | 45 |
合計 | 585 | 745 |
關鍵函數流程圖
python
算法的關鍵以及關鍵實現部分流程圖
git
性能分析圖
github
/** * 統計有效行數 * @param text * @return */ public int LineCount(String text){ int lines=0; boolean flag = false; for(int i=0;i<text.length();i++){ if(text.charAt(i)>' '){ flag=true; } else if(text.charAt(i)=='\n'){ if(flag) { lines++; flag=false; } } } if(flag) lines++; return lines; }
/** * 詞頻統計 * @param text * @return */ public int WordCount(String text){ int cpmount = 0; //所有字母轉小寫 String textLow = text.toLowerCase(); //正則表達式,過濾非字母數字字符 String regex = "[^0-9a-zA-Z]"; //過濾文本 textLow = textLow.replaceAll(regex, " "); //分割文本成單詞 StringTokenizer words = new StringTokenizer(textLow); try { while (words.hasMoreTokens()) { String word = words.nextToken(); //判斷單詞前4個是否爲字母 if (word.length() >= 4 && Character.isLetter(word.charAt(0)) && Character.isLetter(word.charAt(1)) && Character.isLetter(word.charAt(2)) && Character.isLetter(word.charAt(3))) { cpmount++; if (!wordCount.containsKey(word)) { wordCount.put(word, new Integer(1)); } else { int count = wordCount.get(word) + 1; wordCount.put(word, count); } } } }catch (Exception e){ //錯誤 } return cpmount; }
/** * 統計單詞數 * @param text * @param wei ,當wei=1 權重爲10 wei=0 權重爲1 * @return 單詞數量 */ public int CountWord(String text,int wei){ int ant=0; text = text.toLowerCase(); //分隔符集合 String regex = "[^0-9a-zA-Z]"; text = text.replaceAll(regex, " "); //分割文本成單詞 StringTokenizer words = new StringTokenizer(text); try { while (words.hasMoreTokens()) { String word = words.nextToken(); if (word.length() >= 4 && Character.isLetter(word.charAt(0)) && Character.isLetter(word.charAt(1)) && Character.isLetter(word.charAt(2)) && Character.isLetter(word.charAt(3))) { //判斷單詞前4個是否爲字母 ant++; if (!wordCount.containsKey(word)) { wordCount.put(word, new Integer(wei==1 ? 10:1)); } else { int count = wordCount.get(word) + (wei==1 ? 10:1); wordCount.put(word, count); } } } }catch (Exception e){ //錯誤 } return ant; }
/** * 統計詞組 * @param text * @param cwords 詞組的單詞數 * @param wei ,當wei=1 權重爲10 wei=0 權重爲1 */ public void CountPhrase(String text,int cwords,int wei){ text = text.toLowerCase(); text = text.replaceAll("\n",""); StringBuilder mid=new StringBuilder();//分隔符 StringBuilder wword=new StringBuilder();//單詞拼接 Queue<String> que1=new LinkedList<String>();//用於存儲詞組單詞 Queue<String> que2=new LinkedList<String>();//用於存儲分隔符 String feng=",./;'[] \\<>?:\"{}|`~!@#$%^&*()_+-=";//分隔符集合 StringTokenizer words = new StringTokenizer(text,feng,true); //分割文本成單詞。 try { while (words.hasMoreTokens()) { String word =words.nextToken(); if (word.length() >= 4 && Character.isLetter(word.charAt(0)) && Character.isLetter(word.charAt(1)) && Character.isLetter(word.charAt(2)) && Character.isLetter(word.charAt(3))) { //判斷單詞前4個是否爲字母 que2.offer(mid.toString()); mid.delete(0,mid.length()); que1.offer(word); if(que1.size()>=cwords){//達到詞組單詞數量 int cnt=0; wword.delete(0,wword.length()); for(String w:que1){ wword.append(w); cnt++; if(que2.size()>cnt) { String tmp=((LinkedList<String>) que2).get(cnt);//取出中間的分隔符 wword.append(tmp);//拼接 } } //最後生成正確的wword 詞組 // 進行統計操做 if(!phraseCount.containsKey(wword.toString())) { phraseCount.put(wword.toString(),new Integer( wei==1 ? 10:1 )); } else{ int count=phraseCount.get(wword.toString()) + (wei==1 ? 10:1); phraseCount.put(wword.toString(),count); } que1.remove(); que2.remove(); } } else if(word.length()!=1){//不符合條件 將其前面的都刪除 que1.clear(); que2.clear(); }else if(word.length()==1 && !(Character.isLetter(word.charAt(0)))){//判斷是否爲分隔符 mid.append(word); } } }catch (Exception e){ //出錯 } }
/** * 詞頻排序 * @return list */ public List<HashMap.Entry<String, Integer>> sortList(){ List<HashMap.Entry<String, Integer>> list = new ArrayList<>(); for(Map.Entry<String, Integer> entry : phraseCount.entrySet()){ list.add(entry); } Comparator<Map.Entry<String, Integer>> comp = new Comparator<Map.Entry<String, Integer>>(){ @Override public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) { if(o1.getValue().equals(o2.getValue())) return o1.getKey().compareTo(o2.getKey()); //值相同 按鍵返回字典序 return o2.getValue()-o1.getValue(); } //逆序(從大到小)排列,正序爲「return o1.getValue()-o2.getValue" }; list.sort(comp); return list; } }
x = np.array(['neural networks','this paper','object detection','convolutional neural','generative adversarial','show that','neural network','pose estimation','semantic segmentation','large-scale']) y = np.array([479,470,453,366,340,340,305,298,280,240]) plt.bar(x,y,0.7,alpha=0.5,color='r') plt.xticks(rotation=90,fontsize=12) plt.show()