使用Thuctc進行中文文字分類應用

2021-08-16 19:11:13 字數 1027 閱讀 1861

public

static

void

createmodel(int kind, string bootpath)

public

void

runclasstrainandtest(int kind, double train_per, double test_per, int symbol)

將儲存好的模型拿出來進行**,看看結果如何:

public

static

void

onlyclass(int kind, int date, string bootpath)

public

void

runloadclassmodelanduse(int kind, int date, int resultnum)

}string sql = " insert into btb_map (id, article_class_id, article_id, type, class_sort) values (0,"+classifier.getcategoryname(result[k].label)+","+rs.getstring("id")+", 2, 0)";

c.getresult(sql);

}}while(rs.next());

}} catch (sqlexception e)

system.out.println("模型**完成!");

}

看起來是不是很簡單,比較大的改動就是對於結果的取捨,因為涉及到乙個文件是否為多分類,所以進行了乙個小小的判斷。在應用過程中發現thuctc對於分類的問題效果比較好,誤差在能夠接受的範圍內,準確度能達到百分之八十多。對於存在多分類的文件的預判效果也很好,算是乙個驚喜吧。

在此,我並沒有對原始碼進行過多的剖析,是因為我覺得其他大大們的文章已經很好的解釋了這些。如果有需要,小夥伴們也可以去看看。位址為:鼓掌撒花~

如果有什麼不明白的地方或者有什麼需要討論的,歡迎來找我交流,共勉哦~

中文文字分句

關於文字分句這點,說簡單也簡單,說複雜也複雜。一般的自然語言處理任務中對這點要求並不嚴格,一般按照句末標點切分即可。也有一些專門從事文字相關專案的行業,可能就會有較高的要求,想100 分句正確是要考慮許多語言本身語法的,這裡算是寫個中等水平的。以 背影 中的一段話為例 我心裡暗笑他的迂 他們只認得錢...

python實現中文文字分句

對於英文文字分句比較簡單,只要根據終結符 劃分就好,中文文字分句看似很簡單,但是實現時會遇到很多麻煩,尤其是處理社交 資料時,會遇到文字格式不規範等問題。下面 針對一段一段的短文本組成了文件分句 import re def cut sent infile,outfile cutlineflag 本文...

NLP 中文文字分類 詳細

實現如下customprocessor class customprocessor dataprocessor def get train examples self,data dir return self.create examples self.read tsv os.path.join da...