You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "David Goldfarb (JIRA)" <ji...@apache.org> on 2014/01/27 19:09:38 UTC

[jira] [Updated] (LUCENE-4072) CharFilter that Unicode-normalizes input

     [ https://issues.apache.org/jira/browse/LUCENE-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Goldfarb updated LUCENE-4072:
-----------------------------------

    Attachment: 4072.patch

Attaching a new patch - testCuriousString still fails. 

You're right about readInputToBuffer. I think we also have to stop only on normalization boundaries. I see two options:
use normalizer.hasBoundaryAfter(tmpBuffer\[len-1\]) (straightforward)
or
use normalizer.hasBoundaryBefore(tmpBuffer\[len-1\]) and use mark() and reset().

{noformat}
  private int readInputToBuffer() throws IOException {
    final int len = input.read(tmpBuffer);
    if (len == -1) {
      inputFinished = true;
      return 0;
    }
    inputBuffer.append(tmpBuffer, 0, len);
    if (len >= 2 && normalizer.hasBoundaryAfter(tmpBuffer[len-1]) && !Character.isHighSurrogate(tmpBuffer[len-1])) {
        return len;
    } else return len + readInputToBuffer();
  }
{noformat}

> CharFilter that Unicode-normalizes input
> ----------------------------------------
>
>                 Key: LUCENE-4072
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4072
>             Project: Lucene - Core
>          Issue Type: New Feature
>          Components: modules/analysis
>            Reporter: Ippei UKAI
>         Attachments: 4072.patch, DebugCode.txt, LUCENE-4072.patch, LUCENE-4072.patch, LUCENE-4072.patch, LUCENE-4072.patch, LUCENE-4072.patch, LUCENE-4072.patch, ippeiukai-ICUNormalizer2CharFilter-4752cad.zip
>
>
> I'd like to contribute a CharFilter that Unicode-normalizes input with ICU4J.
> The benefit of having this process as CharFilter is that tokenizer can work on normalised text while offset-correction ensuring fast vector highlighter and other offset-dependent features do not break.
> The implementation is available at following repository:
> https://github.com/ippeiukai/ICUNormalizer2CharFilter
> Unfortunately this is my unpaid side-project and cannot spend much time to merge my work to Lucene to make appropriate patch. I'd appreciate it if anyone could give it a go. I'm happy to relicense it to whatever that meets your needs.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org