sql - Query to calculate term frequency * inverse document frequency -
i have 2 tables in oracle database:
df (term, doccount)
tf (abstractid, term, freq)
one document frequency(df) having terms , documentcount , table term frequency called tf havind documentid, terms, frequency. want calculate tf*idf tf = number of times term appears in article (frequency column table tf) , idf = log (132225)-log(doccount)+1
i want store result in table (tfidf) having documentid, terms , calculated tf*idf
any ideas?
you need join tf
, df
tables , insert destination tfidf
table. try this:
insert tfidf (documentid, terms, tf_idf) select abstractid, df.term, (log(10, 132225)-log(10, doccount)+1)*(tf.freq) tf, df tf.term = df.term;
Comments
Post a Comment