lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allison, Timothy B." <>
Subject RE: calculate term co-occurrence matrix
Date Mon, 20 Mar 2017 18:50:04 GMT
I have code as part of LUCENE-5318 that counts terms that cooccur within a window of where
your query terms appear.  This makes a really useful query term recommender, and the math
is dirt simple.

Doc1: quick brown fox jumps over the lazy dog
Doc2: quick green fox leaps over the lazy dog

Query: fox , window size before =2, window size after = 3

Quick: 2 (and 2 * idf(quick))
Over: 2
Brown: 1
Green: 1
Jumps: 1
Leaps: 1

The query can be anything that can be transformed into a SpanQuery.

If you want examples or help, just drop a line.


Also available on Maven: 

P.S. Thanks to David Smiley for pointing out this request to me. 

-----Original Message-----
From: komal [] 
Sent: Monday, March 20, 2017 2:32 AM
Subject: calculate term co-occurrence matrix

hi all,
i need term co-occurrence matrix code. if anyone have plz share it with me.

View this message in context:
Sent from the Lucene - Java Developer mailing list archive at

To unsubscribe, e-mail: For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message