lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamal Najib <kamal.na...@mytum.de>
Subject Re: Re: [ no subject ]
Date Fri, 01 May 2009 09:06:29 GMT
Thanks Anshum Gupta for the reply,
"As per my knowledge, you'd have to index one of the docs  and then run a
query (second doc) to get the similarity score."

which docs do you mean?  do you mean i have to create a doc for each Vector, do you mean somthing
like this:
Vector1 =<"term1","term2","term3"> --->doc1.add("id",new Field ("term1"+"term2"+"term3",Field.Store.YES,Field.Index.TOKENIZED));
Vector2 =<"term4","term5","term6"> --->doc1.add("id",new Field ("term4"+"term5"+"term6",Field.Store.YES,Field.Index.TOKENIZED));
or 
Vector1 =<"term1","term2","term3"> --->
doc1.add("id",new Field("term1",Field.Store.YES,Field.Index.TOKENIZED));
doc1.add("id",new Field("term2",Field.Store.YES,Field.Index.TOKENIZED));
doc1.add("id",new Field("term3",Field.Store.YES,Field.Index.TOKENIZED));

Vector2 =<"term4","term5","term6"> --->
doc1.add("id",new Field ("term4",Field.Store.YES,Field.Index.TOKENIZED));
doc1.add("id",new Field ("term5",Field.Store.YES,Field.Index.TOKENIZED));
doc1.add("id",new Field ("term6",Field.Store.YES,Field.Index.TOKENIZED));

and then get the similarity score between the two docs?
please help.
thanks in advance.
Kamal

Original Message:

As per my knowledge, you'd have to index one of the docs  and then run a
<br />query (second doc) to get the similarity score.
<br />Also, the default similarity would take into account more factors than the
<br />regular VSM hence, you'd even have to look into it.
<br />You may write code that on the fly creates a volatile index, runs a query,
<br />returns the similarity and clears the index (which would happen implicitly
<br />in case of a ramdir approach.
<br />
<br />--
<br />Anshum Gupta
<br />Naukri Labs!
<br />http://ai-cafe.blogspot.com
<br />
<br />The facts expressed here belong to everybody, the opinions to me. The
<br />distinction is yours to draw............
<br />
<br />
<br />On Thu, Apr 30, 2009 at 8:58 PM, Kamal Najib  wrote:
<br />
<br />> Hi,
<br />> A am new in Lucene and I want to get the similarity between two vectors of
<br />> strings,is there a method, who do that?
<br />> for example assume the vectors:
<br />> Vector1 :<"term1","term2","term3">
<br />> Vector2:<"term4","term5","term5">
<br />> is there a method to get the similarity between them in lucene,or is there
<br />> any other way to do it?
<br />> for esample: getTheSymilarity(Vector1,Vector2).
<br />> Thanks in advance.
<br />> kamal.
<br />>
<br />> --
<br />>
<br />>
<br />>
<br />> ---------------------------------------------------------------------
<br />> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
<br />> For additional commands, e-mail: java-user-help@lucene.apache.org
<br />>
<br />

-- 


Mime
View raw message