lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-2906) Filter to process output of ICUTokenizer and create overlapping bigrams for CJK
Date Thu, 29 Dec 2011 10:03:31 GMT


Uwe Schindler commented on LUCENE-2906:

Hi Robert,

I had no time to review before, there is one small thing that should maybe fixed. Currently
this finter relies on the fact that TypeAttribute strings are interned, as it compares by

String type = typeAtt.type();
if (type == doHan || type == doHiragana || type == doKatakana || type == doHangul) {

This is documented nowhere that Strings in TypeAttribute need to be interned. We should maybe
replace that check by a simple equals(). It seems that you already wanted to do that, as you
added a sentinel value Object NO = new Object(). With the above check this sentinel value
is useless, a simple null would be enough. But when using equals() this sentinel makes sense.
The check is not costly. String.equals() already does an identity check for early exit, if
the sentinel is used it will also quickly return false (if String.equals(sentinel) is used,
it will return false on instanceof Check, if you call sentinel.equals(String) it will even
be faster).

So I would change this check to:

String type = typeAtt.type();
if (doHan.equals(type) || doHiragana.equals(type) || doKatakana.equals(type) || doHangul.equals(type))

(this is the fastest check, if the doXXX is the sentinel, it's default Object.equals() will
return false. If its a string, String.equals() will return true on identity very quick, but
if it's not interned it will be slower. So we loose nothing but dont require useless interned
> Filter to process output of ICUTokenizer and create overlapping bigrams for CJK 
> --------------------------------------------------------------------------------
>                 Key: LUCENE-2906
>                 URL:
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: modules/analysis
>            Reporter: Tom Burton-West
>            Assignee: Robert Muir
>            Priority: Minor
>             Fix For: 3.6, 4.0
>         Attachments: LUCENE-2906.patch, LUCENE-2906.patch, LUCENE-2906.patch, LUCENE-2906.patch
> The ICUTokenizer produces unigrams for CJK. We would like to use the ICUTokenizer but
have overlapping bigrams created for CJK as in the CJK Analyzer.  This filter would take the
output of the ICUtokenizer, read the ScriptAttribute and for selected scripts (Han, Kana),
would produce overlapping bigrams.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


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

View raw message