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 Nicola Buso <nb...@ebi.ac.uk> on 2017/06/23 13:33:38 UTC
Extending Analyzer at runtime
Hi,
maybe it's a known question but I could not find and answer.
I need to base an Analyzer on another Analyzer at runtime.
I know that the Analyzer is a factory and I should really look at
combine the Filters. I'm looking for a way to get the
TokenStreamComponents from an analyzer at runtime and from there start
adding my filters.
Did someone already did something similar?
Nicola
--
Nicola Buso <nb...@ebi.ac.uk>
EMBL-EBI
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
RE: Extending Analyzer at runtime
Posted by "Allison, Timothy B." <ta...@mitre.org>.
Head meet brick. Thank you, Uwe!
-----Original Message-----
From: Uwe Schindler [mailto:uwe@thetaphi.de]
Sent: Friday, June 23, 2017 11:23 AM
To: java-user@lucene.apache.org
Subject: RE: Extending Analyzer at runtime
Hi,
Or just use CustomAnalyzer, shipped with Lucene since version 5.0. No need to write your own one.
Uwe
-----
Uwe Schindler
Achterdiek 19, D-28357 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: Allison, Timothy B. [mailto:tallison@mitre.org]
> Sent: Friday, June 23, 2017 3:55 PM
> To: java-user@lucene.apache.org; nbuso@ebi.ac.uk
> Subject: RE: Extending Analyzer at runtime
>
> I plagiarized Solr's org.apache.solr.analysis.TokenizerChain to read
> the configuration from a json file:
>
> https://github.com/tballison/lucene-
> addons/blob/6.x/gramreaper/src/main/java/org/tallison/gramreaper/inges
> t
> /schema/MyTokenizerChain.java
>
> I wouldn't recommend using anything in gramreaper just yet, but that
> might give you some ideas.
>
>
>
> -----Original Message-----
> From: Nicola Buso [mailto:nbuso@ebi.ac.uk]
> Sent: Friday, June 23, 2017 9:34 AM
> To: java-user <ja...@lucene.apache.org>
> Subject: Extending Analyzer at runtime
>
> Hi,
>
> maybe it's a known question but I could not find and answer.
> I need to base an Analyzer on another Analyzer at runtime.
>
> I know that the Analyzer is a factory and I should really look at
> combine the Filters. I'm looking for a way to get the
> TokenStreamComponents from an analyzer at runtime and from there start adding my filters.
>
> Did someone already did something similar?
>
>
> Nicola
>
>
> --
> Nicola Buso <nb...@ebi.ac.uk>
> EMBL-EBI
>
> ---------------------------------------------------------------------
> 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: Extending Analyzer at runtime
Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,
Or just use CustomAnalyzer, shipped with Lucene since version 5.0. No need to write your own one.
Uwe
-----
Uwe Schindler
Achterdiek 19, D-28357 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: Allison, Timothy B. [mailto:tallison@mitre.org]
> Sent: Friday, June 23, 2017 3:55 PM
> To: java-user@lucene.apache.org; nbuso@ebi.ac.uk
> Subject: RE: Extending Analyzer at runtime
>
> I plagiarized Solr's org.apache.solr.analysis.TokenizerChain to read the
> configuration from a json file:
>
> https://github.com/tballison/lucene-
> addons/blob/6.x/gramreaper/src/main/java/org/tallison/gramreaper/ingest
> /schema/MyTokenizerChain.java
>
> I wouldn't recommend using anything in gramreaper just yet, but that might
> give you some ideas.
>
>
>
> -----Original Message-----
> From: Nicola Buso [mailto:nbuso@ebi.ac.uk]
> Sent: Friday, June 23, 2017 9:34 AM
> To: java-user <ja...@lucene.apache.org>
> Subject: Extending Analyzer at runtime
>
> Hi,
>
> maybe it's a known question but I could not find and answer.
> I need to base an Analyzer on another Analyzer at runtime.
>
> I know that the Analyzer is a factory and I should really look at combine the
> Filters. I'm looking for a way to get the TokenStreamComponents from an
> analyzer at runtime and from there start adding my filters.
>
> Did someone already did something similar?
>
>
> Nicola
>
>
> --
> Nicola Buso <nb...@ebi.ac.uk>
> EMBL-EBI
>
> ---------------------------------------------------------------------
> 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: Extending Analyzer at runtime
Posted by "Allison, Timothy B." <ta...@mitre.org>.
I plagiarized Solr's org.apache.solr.analysis.TokenizerChain to read the configuration from a json file:
https://github.com/tballison/lucene-addons/blob/6.x/gramreaper/src/main/java/org/tallison/gramreaper/ingest/schema/MyTokenizerChain.java
I wouldn't recommend using anything in gramreaper just yet, but that might give you some ideas.
-----Original Message-----
From: Nicola Buso [mailto:nbuso@ebi.ac.uk]
Sent: Friday, June 23, 2017 9:34 AM
To: java-user <ja...@lucene.apache.org>
Subject: Extending Analyzer at runtime
Hi,
maybe it's a known question but I could not find and answer.
I need to base an Analyzer on another Analyzer at runtime.
I know that the Analyzer is a factory and I should really look at combine the Filters. I'm looking for a way to get the TokenStreamComponents from an analyzer at runtime and from there start adding my filters.
Did someone already did something similar?
Nicola
--
Nicola Buso <nb...@ebi.ac.uk>
EMBL-EBI
---------------------------------------------------------------------
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: Extending Analyzer at runtime
Posted by Alan Woodward <al...@flax.co.uk>.
Hi,
You should be able to use AnalyzerWrapper for this, adding your TokenFilters in wrapComponents().
Alan Woodward
www.flax.co.uk
> On 23 Jun 2017, at 14:33, Nicola Buso <nb...@ebi.ac.uk> wrote:
>
> Hi,
>
> maybe it's a known question but I could not find and answer.
> I need to base an Analyzer on another Analyzer at runtime.
>
> I know that the Analyzer is a factory and I should really look at
> combine the Filters. I'm looking for a way to get the
> TokenStreamComponents from an analyzer at runtime and from there start
> adding my filters.
>
> Did someone already did something similar?
>
>
> Nicola
>
>
> --
> Nicola Buso <nb...@ebi.ac.uk>
> EMBL-EBI
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>