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 Dutch language</p>
030 * <p><a href="DutchAnalyzer.java.html"><i>View Source</i></a></p>
031 * <p/>
032 *
033 */
034public final class DanishAnalyzer extends Analyzer {
035
036    private static SnowballAnalyzer analyzer;
037
038    private String STOP_WORDS[] = {
039        "de", "en", "van", "ik", "te", "dat", "die", "in", "een",
040        "hij", "het", "niet", "zijn", "is", "was", "op", "aan", "met", "als", "voor", "had",
041        "er", "maar", "om", "hem", "dan", "zou", "of", "wat", "mijn", "men", "dit", "zo",
042        "door", "over", "ze", "zich", "bij", "ook", "tot", "je", "mij", "uit", "der", "daar",
043        "haar", "naar", "heb", "hoe", "heeft", "hebben", "deze", "u", "want", "nog", "zal",
044        "me", "zij", "nu", "ge", "geen", "omdat", "iets", "worden", "toch", "al", "waren",
045        "veel", "meer", "doen", "toen", "moet", "ben", "zonder", "kan", "hun", "dus",
046        "alles", "onder", "ja", "eens", "hier", "wie", "werd", "altijd", "doch", "wordt",
047        "wezen", "kunnen", "ons", "zelf", "tegen", "na", "reeds", "wil", "kon", "niets",
048        "uw", "iemand", "geweest", "andere"
049    }; 
050
051    /**
052     * Creates new instance of SpanishAnalyzer
053     */
054    public DanishAnalyzer() {
055        analyzer = new SnowballAnalyzer("Danish", STOP_WORDS);
056    }
057
058    public DanishAnalyzer(String stopWords[]) {
059        analyzer = new SnowballAnalyzer("Danish", stopWords);
060    }
061
062    @Override
063    public TokenStream tokenStream(String fieldName, Reader reader) {
064        return analyzer.tokenStream(fieldName, reader);
065    }
066}