001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.search.lucene2.analyzer; 020 021import java.io.Reader; 022 023import org.apache.lucene.analysis.Analyzer; 024import org.apache.lucene.analysis.TokenStream; 025import org.apache.lucene.analysis.snowball.SnowballAnalyzer; 026 027 028/** 029 * <p>Analyzer for Norwegian language</p> 030 * <p><a href="NorwegianAnalyzer.java.html"><i>View Source</i></a></p> 031 * <p/> 032 * 033 * @author Andrey Grebnev <a href="mailto:andrey.grebnev@blandware.com"><andrey.grebnev@blandware.com></a> 034 * @version $Revision: 1.3 $ $Date: 2005/02/24 19:51:22 $ 035 */ 036public final class NorwegianAnalyzer extends Analyzer { 037 038 private static SnowballAnalyzer analyzer; 039 040 private String NORWEGIAN_STOP_WORDS[] = { 041 "og", "i", "er", "det", "som","til", "for", "av", "at", "med", "har", "en", "om", "du", "de", 042 "ikke", "no", "vi", "jeg", "kan", "den", "eller", "seg", "men", "et", "dei", "skal", "ein", "blir", 043 "vil", "fra", "var", "alle", "andre", "dette", "hva", "bla" 044 }; 045 046 /** 047 * Creates new instance of SpanishAnalyzer 048 */ 049 public NorwegianAnalyzer() { 050 analyzer = new SnowballAnalyzer("Norwegian", NORWEGIAN_STOP_WORDS); 051 } 052 053 public NorwegianAnalyzer(String stopWords[]) { 054 analyzer = new SnowballAnalyzer("Norwegian", stopWords); 055 } 056 057 @Override 058 public TokenStream tokenStream(String fieldName, Reader reader) { 059 return analyzer.tokenStream(fieldName, reader); 060 } 061}