You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Michael Ryan <mr...@moreover.com> on 2014/07/11 16:20:17 UTC
Finding words not followed by other words
I'm trying to solve the following problem...
I have 3 documents that contain the following contents:
1: "George Washington Carver blah blah blah."
2: "George Washington blah blah blah."
3: "George Washington Carver blah blah blah. George Washington blah blah blah."
I want to create a query that matches documents 2 and 3, but not 1. That is, I want to find documents that mention "George Washington". It's okay if they also mention "George Washington Carver", but I don't want documents that only mention "George Washington Carver". So simply doing something like this does not solve it:
"George Washington" NOT "George Washington Carver"
Is there a Query type that does this out of the box? I've looked at the various types of span queries, but none of them seem to do this. I think it should be theoretically possible given the position data that Lucene stores...
-Michael
RE: Finding words not followed by other words
Posted by "Allison, Timothy B." <ta...@mitre.org>.
And if you're looking for a parser, take a look at LUCENE-5205.
["george washington" carver]!~5,5
Find "George Washington" but not if carver appears 5 words before or 5 words after.
-----Original Message-----
From: Michael Ryan [mailto:mryan@moreover.com]
Sent: Monday, July 14, 2014 9:58 PM
To: java-user@lucene.apache.org
Subject: RE: Finding words not followed by other words
Thanks, Koji! This solves it. I had forgotten all about SpanNotQuery.
-Michael
-----Original Message-----
From: Koji Sekiguchi [mailto:koji@r.email.ne.jp]
Sent: Saturday, July 12, 2014 10:45 AM
To: java-user@lucene.apache.org
Subject: Re: Finding words not followed by other words
Hi Michael,
I haven't executed this yet, but can you try this:
SpanNotQuery(SpanNearQuery("George Washington"), SpanNearQuery("George Washington Carver"))
Koji
--
http://soleami.com/blog/comparing-document-classification-functions-of-lucene-and-mahout.html
(2014/07/11 23:20), Michael Ryan wrote:
> I'm trying to solve the following problem...
>
> I have 3 documents that contain the following contents:
> 1: "George Washington Carver blah blah blah."
> 2: "George Washington blah blah blah."
> 3: "George Washington Carver blah blah blah. George Washington blah blah blah."
>
> I want to create a query that matches documents 2 and 3, but not 1. That is, I want to find documents that mention "George Washington". It's okay if they also mention "George Washington Carver", but I don't want documents that only mention "George Washington Carver". So simply doing something like this does not solve it:
> "George Washington" NOT "George Washington Carver"
>
> Is there a Query type that does this out of the box? I've looked at the various types of span queries, but none of them seem to do this. I think it should be theoretically possible given the position data that Lucene stores...
>
> -Michael
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
RE: Finding words not followed by other words
Posted by Michael Ryan <mr...@moreover.com>.
Thanks, Koji! This solves it. I had forgotten all about SpanNotQuery.
-Michael
-----Original Message-----
From: Koji Sekiguchi [mailto:koji@r.email.ne.jp]
Sent: Saturday, July 12, 2014 10:45 AM
To: java-user@lucene.apache.org
Subject: Re: Finding words not followed by other words
Hi Michael,
I haven't executed this yet, but can you try this:
SpanNotQuery(SpanNearQuery("George Washington"), SpanNearQuery("George Washington Carver"))
Koji
--
http://soleami.com/blog/comparing-document-classification-functions-of-lucene-and-mahout.html
(2014/07/11 23:20), Michael Ryan wrote:
> I'm trying to solve the following problem...
>
> I have 3 documents that contain the following contents:
> 1: "George Washington Carver blah blah blah."
> 2: "George Washington blah blah blah."
> 3: "George Washington Carver blah blah blah. George Washington blah blah blah."
>
> I want to create a query that matches documents 2 and 3, but not 1. That is, I want to find documents that mention "George Washington". It's okay if they also mention "George Washington Carver", but I don't want documents that only mention "George Washington Carver". So simply doing something like this does not solve it:
> "George Washington" NOT "George Washington Carver"
>
> Is there a Query type that does this out of the box? I've looked at the various types of span queries, but none of them seem to do this. I think it should be theoretically possible given the position data that Lucene stores...
>
> -Michael
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: Finding words not followed by other words
Posted by Koji Sekiguchi <ko...@r.email.ne.jp>.
Hi Michael,
I haven't executed this yet, but can you try this:
SpanNotQuery(SpanNearQuery("George Washington"), SpanNearQuery("George Washington Carver"))
Koji
--
http://soleami.com/blog/comparing-document-classification-functions-of-lucene-and-mahout.html
(2014/07/11 23:20), Michael Ryan wrote:
> I'm trying to solve the following problem...
>
> I have 3 documents that contain the following contents:
> 1: "George Washington Carver blah blah blah."
> 2: "George Washington blah blah blah."
> 3: "George Washington Carver blah blah blah. George Washington blah blah blah."
>
> I want to create a query that matches documents 2 and 3, but not 1. That is, I want to find documents that mention "George Washington". It's okay if they also mention "George Washington Carver", but I don't want documents that only mention "George Washington Carver". So simply doing something like this does not solve it:
> "George Washington" NOT "George Washington Carver"
>
> Is there a Query type that does this out of the box? I've looked at the various types of span queries, but none of them seem to do this. I think it should be theoretically possible given the position data that Lucene stores...
>
> -Michael
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org