Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:22:00+00:00 2026-06-05T15:22:00+00:00

I have found Okapi Similarity measure can be used to calculated document similarity from

  • 0

I have found Okapi Similarity measure can be used to calculated document similarity from here http://www2002.org/CDROM/refereed/643/node6.html and from this paper http://singhal.info/ieee2001.pdf

I want to calculate similarity between documents of a document collection using Okapi similarity scheme with Lucene

e.g. I have 10 documents (doc #A,#B, #C, #D etc.) in my document collection. I ll pick a document as query document. Say doc #A.
Then for each term=1..n , of query document I ll calculate the

idfOfQueryTerm = log (totalNumIndexedDocs - docFreq + 0.5)/(docFreq + 0.5)

then I ll take the sum of (idfOfQueryTerm) from 1 to n; idfOfQueryDoc= sum of (idfOfQueryTerm)
Then for each 10 documents(Including query doc), I l calculate total term frequency of document by this equation, based on the query terms of the query document that was selected first.

tfOfDocument={2.2 * termFrq }/ { 1.2 * ( 0.25 + 0.75 * docLength / this.avgDocLength ) + termFrq }

So I ll end up with 10-tfOfDocument values, one for each document and one idfOfQueryDoc value.

Then I can calculate the similarity between query document and other documents using these two methods.

1) Similarity between query doc and doc #B= idfOfQueryDoc* tfOfDocument #B

2) Similarity between query doc and doc #B= idfOfQueryDoc* tfOfDocument #B* tfOfDocument#queryDoc

I want to know, whether my understanding of Okapi Similarity measure is correct?

Which method of above two will be optimal for calculating the doc similarity?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:22:01+00:00Added an answer on June 5, 2026 at 3:22 pm

    Based on the first link, the similarity between the query document and another document is:

    sim(query, doc) = sum(t in terms(query), freq(t, query) * w(t, doc))
    

    where (from the second link, slightly modified as I think the formula in the link is incorrect)

    w(t, doc) = idf(t) * (k+1)*freq(t, doc) / (k*(1-b + b*ls(doc)) + freq(t, doc))
    ls(doc) = len(doc)/avgdoclen
    

    and idf(t) is your idfOfQueryTerm, freq(t, doc) is the frequency of term t in document doc.

    Choosing b=0.25 and k = 1.2 you get

    w(t, doc) = idf(t) * 2.2*freq(t, doc) / (1.2*(0.25+0.75*ls(doc)) + freq(t, doc))
    

    Note: the two links give slightly different equations, although the differene is mostly in weighing, not the fundamentals

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found this link: http://www.jfree.org/forum/viewtopic.php?f=3&t=6314 Its back in 2007 where they agree that
I have found this code http://djangosnippets.org/snippets/2283/ but I think it doesn't work with manytomanyfields
I have found this code sample to make a query in ebay from here
I have found many great answers to this from a year ago (when it
I have found similar questions here but none of them are answered. So please
I have found several articles mentioning that using UCM Web Forms you can easily
I have found a lot of sites that can store my data but I
I have found some topics on templates and methods. But I can't figure out
I have found examples here: Android - Intent that open widget context menu and
I have found that writing PHP code within classes can become rather long: $this->parser->parse_syntax($this->get_language_path($this->language),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.