lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3731) Create a analysis/uima module for UIMA based tokenizers/analyzers
Date Fri, 03 Feb 2012 15:35:54 GMT


Robert Muir commented on LUCENE-3731:

Thanks for starting this Tommaso:

I was unable to apply the patch (were there some svn-copies?)

But I suggest in general using the BaseTokenStreamTestCase.assertTokenStreamContents/assertAnalyzesTo:
e.g. instead of:
// check that 'the big brown fox jumped on the wood' tokens have the expected PoS types
   String[] expectedPos = new String[]{"at", "jj", "jj", "nn", "vbd", "in", "at", "nn"};
   int i = 0;
   while (ts.incrementToken()) {
     assertEquals(typeAttr.type(), expectedPos[i]);

you could use:
     new String[] { "the", "big", "brown", ... }, /* expected terms */
     new String[] { "at", "jj", "jj", ... }, /* expected types */

There are also variants that let you supply expected start/end offsets, I think that would
be good.

Finally, to check for lots of other bugs (including thread-safety, compatibility with charfilters,
I would recommend:
  /** blast some random strings through the analyzer */
  public void testRandomStrings() throws Exception {
    Analyzer a = new Analyzer() {

      protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
        Tokenizer tokenizer = new MyTokenizer(reader);
        return new TokenStreamComponents(tokenizer, tokenizer);
    checkRandomData(random, a, 10000*RANDOM_MULTIPLIER);

If you look at BaseTokenStreamTestCase you will see all of these methods are insanely nitpicky
and find all kinds of bugs in analysis components, so it will really help test coverage I

> Create a analysis/uima module for UIMA based tokenizers/analyzers
> -----------------------------------------------------------------
>                 Key: LUCENE-3731
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: modules/analysis
>            Reporter: Tommaso Teofili
>            Assignee: Tommaso Teofili
>             Fix For: 3.6, 4.0
>         Attachments: LUCENE-3731.patch
> As discussed in SOLR-3013 the UIMA Tokenizers/Analyzer should be refactored out in a
separate module (modules/analysis/uima) as they can be used in plain Lucene. Then the solr/contrib/uima
will contain only the related factories.

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