org.languagetool.rules.br.TopoReplaceRule Maven / Gradle / Ivy
The newest version!
/* LanguageTool, a natural language style checker
* Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA
*/
package org.languagetool.rules.br;
import org.languagetool.AnalyzedSentence;
import org.languagetool.AnalyzedTokenReadings;
import org.languagetool.JLanguageTool;
import org.languagetool.language.Breton;
import org.languagetool.rules.*;
import org.languagetool.tokenizers.Tokenizer;
import org.languagetool.tools.StringTools;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
/**
* A rule that matches place names in French which should be
* translated in Breton.
*
* Loads the list of words from rules/br/topo.txt
.
* This class is mostly copied from ro/SimpleReplaceRules.java.
*
* @author Dominique Pellé
*/
public class TopoReplaceRule extends Rule {
public static final String BRETON_TOPO = "BR_TOPO";
private static final String FILE_NAME = "/br/topo.txt";
private static final String FILE_ENCODING = "utf-8";
// locale used on case-conversion
private static final Locale BR_LOCALE = new Locale("br");
// list of maps containing error-corrections pairs.
// the n-th map contains key strings of (n+1) words
private static final List