You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Mayya Sharipova (JIRA)" <ji...@apache.org> on 2018/01/29 23:34:00 UTC
[jira] [Comment Edited] (LUCENE-3475) ShingleFilter should handle
positionIncrement of zero, e.g. synonyms
[ https://issues.apache.org/jira/browse/LUCENE-3475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16344192#comment-16344192 ]
Mayya Sharipova edited comment on LUCENE-3475 at 1/29/18 11:33 PM:
-------------------------------------------------------------------
[~jpountz] Hi Adrien! I wonder what would be the best approach to handle positionIncrement=0?
I was thinking that in *ShingleFilter:getNextToken* we can do something like this:
{code:java}
if (input.incrementToken()) {
while (posIncrAtt.getPositionIncrement() == 0) { // we may have multiple synonyms
if (input.incrementToken()) { // go to next token
....
// store synonyms tokens and following tokens somewhere and create a new input TokenStream from them?
{code}
I guess I am wondering if we have any other reference code that recreates a tokenStream from synonym tokens?
was (Author: mayyas):
[~jpountz] Hi Adrien! I wonder what would be the best approach to handle positionIncrement=0?
I was thinking that in *ShingleFilter:getNextToken* we can do something like this:
{code:java}
if (input.incrementToken()) {
while (posIncrAtt.getPositionIncrement() == 0) { // we may have multiple synonyms
if (input.incrementToken()) { // go to next token
....
// store synonyms tokens and following tokens somewhere and create a new input TokenStream from them?
{code}
I guess I am wondering if we have any other sample code that already doing that, and which I can reference?
> ShingleFilter should handle positionIncrement of zero, e.g. synonyms
> --------------------------------------------------------------------
>
> Key: LUCENE-3475
> URL: https://issues.apache.org/jira/browse/LUCENE-3475
> Project: Lucene - Core
> Issue Type: New Feature
> Components: modules/analysis
> Affects Versions: 3.4
> Reporter: Cameron
> Priority: Minor
> Labels: newdev
>
> ShingleFilter is creating shingles for a single term that has been expanded by synonyms when it shouldn't. The position increment is 0.
> As an example, I have an Analyzer with a SynonymFilter followed by a ShingleFilter. Assuming car and auto are synonyms, the SynonymFilter produces two tokens and position 1: car, auto. The ShingleFilter is then producing 3 tokens, when there should only be two: car, car auto, auto. This behavior seems incorrect.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org