You run your SpanQuery, and get back the Spans. From there, you need to load the document (either by reanalyzing the tokens or by using Term Vectors) and then you just have to setup your window around the position match. Unfortunately, I don't think there is a better way in Lucene to get those terms in a window around a given position. You might be able to if you altered Lucene to support moving both forward and backwards over positions, but I am not sure how difficult this is to do w/o looking more into it (and it isn't high on my list at the moment.)

Also, I adhere to Hoss' philosophy on private email: 
http://people.apache.org/~hossman/#private_q

-Grant

On Nov 28, 2007, at 10:46 AM, bigdoginuk wrote:


Hi, thanks for the reply.

But can anyone give me some more hints? I have checked SpanQuery, but still
haven't found out a solution.

Thanks.


Grant Ingersoll-6 wrote:

Have a look at SpanQuery and it's derivatives.  You will need to do
some post-processing as well.

-Grant

On Nov 28, 2007, at 6:41 AM, bigdoginuk wrote:


Hi all,
I want to compute the co-occurence frequency between a word and a
phrase(
this phrase contains some words, and the words in it should be
successive
and in order). It's like an NEAR operation (like setting slop at 3...)

Does anyone know how to implement this?

Thanks in advance.

Rooney
--
View this message in context:
http://www.nabble.com/Compute-the-co-occurence-beteen-a-phrase-and-a-word-tf4887952.html#a13990651
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------
Grant Ingersoll
http://lucene.grantingersoll.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
View this message in context: 
http://www.nabble.com/Compute-the-co-occurence-beteen-a-phrase-and-a-word-tf4887952.html#a13995126
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------
Grant Ingersoll
http://lucene.grantingersoll.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to