[Task] Suffix Array Bug resolved… And another Bug …found…

檢查的結果,發覺是在 word_freq.c 裡的程式沒寫好, diff 如下:

-    while (cursor < = e_cursor ) { // at least we won’t search over :-)
+    while (cursor < e_cursor ) { // at least we won’t search over :-)


本來呢,e_cursor 的定義是

e_cursor = &word_freq[wi];

也就是指到 word_freq 陣列的最後面,而我在做 suffix 時,要累計所有的頻率,所以需要 traverse 整個陣列,為了避免跑太遠,所以在遇到最後就會跳開,不過這裡的 e_cursor 和 EOF(1) 不一樣啦!唉,所以這個錯誤是自找的啦。錯誤都出現了,麻煩還會遠嗎? :(

另外,我也發現另一個 bug ,就是抽出來的詞好像不夠多,不夠正確,這樣好像連前一陣子的 CLQA(2) 也害到了,慘。
也就是說,出來的結果應該是:

爺,16
回來,8
爺爺,8
終於,8
爺爺您,6
終於回來,6
回來了,5
爺爺您終於回來,4
終於回來了,4
回來啦,3
爺爺您終於回來了,3
爺爺您回來,2
終於回來啦,2

而不是

爺爺,8
終於,7
爺爺您,6
爺爺您終於回來,4
爺爺您終於回來了,3
爺爺您回來,2
終於回來啦,2

這個終於也在颱風假時解決了。 :cool:
在下一次的 Task 裡會補上。
總之,快樂啦~~~

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • funp
  • Haohao
  • Hemidemi
  • Live
  • MisterWong
  • TwitThis
  • udn
  1. End Of File[back]
  2. 敝實驗室前陣子參加的 NLP 性質的比賽[back]
 

Leave a reply

Creative Commons Attribution-NonCommercial-ShareAlike 2.5 Taiwan
Creative Commons Attribution-NonCommercial-ShareAlike 2.5 Taiwan