2014-04-05 85 views
0

我在我的Oracle數據庫2個表:查詢來計算術語頻率*逆文檔頻率

  1. DF (term, doccount)
  2. TF (abstractid, term, freq)

一個用於文檔頻率(DF),其具有條款和documentCount和術語頻率的另一個表格稱爲TF havind the documentID,terms,Frequency。 我想計算TF * IDF其中TF =期刊出現在文章中的次數(來自表TF的頻率列)和IDF = log(132225)-log(docCount)+1

我想存儲我的結果在表格中(TFIDF)有documentID,術語和計算的TF * IDF

任何想法?

回答

0

您需要加入您的TFDF表,然後插入目的地TFIDF表。 試試這個:

insert into TFIDF (documentID, terms, tf_idf) 
select abstractID, df.term, (log(10, 132225)-log(10, doccount)+1)*(tf.freq) 
from tf, df 
where tf.term = df.term; 
+0

謝謝Aditya – Nour