class BretonTagger extends BaseTagger {

  private static final Pattern patternSuffix = Pattern.compile("(?iu)(..+)-(mañ|se|hont)$");

  private final Locale conversionLocale = Locale.getDefault();

  public BretonTagger() {
    super("/br/breton.dict", new Locale("br"));
  }

  // This method is almost the same as the 'tag' method in
  // BaseTagger class, except that when probing the
  // dictionary fails, it retry without the suffixes
  // -mañ, -se, -hont.
  @Override
  public List<AnalyzedTokenReadings> tag(List<String> sentenceTokens)
  throws IOException {<FILL_FUNCTION_BODY>}

  private void addTokens(List<AnalyzedToken> taggedTokens, List<AnalyzedToken> l) {
    if (taggedTokens != null) {
      for (AnalyzedToken at : taggedTokens) {
        l.add(at);
      }
    }
  }
}

    List<AnalyzedToken> taggerTokens;
    List<AnalyzedToken> lowerTaggerTokens;
    List<AnalyzedToken> upperTaggerTokens;
    List<AnalyzedTokenReadings> tokenReadings = new ArrayList<>();
    int pos = 0;

    Matcher matcher;
    for (String word : sentenceTokens) {
      String probeWord = word;
      if (probeWord.length() > 50) {
        // avoid excessively long computation times for long (probably artificial) tokens:
        List<AnalyzedToken> l = new ArrayList<>();
        l.add(new AnalyzedToken(word, null, null));
        tokenReadings.add(new AnalyzedTokenReadings(l, pos));
        pos += word.length();
        continue;
      }

      // This loop happens when we need to retry probing the dictionary
      // which happens rarely when trying to remove suffixes -mañ, -se, etc.
      for (;;) {
        List<AnalyzedToken> l = new ArrayList<>();
        String lowerWord = probeWord.toLowerCase(conversionLocale);
        taggerTokens = asAnalyzedTokenListForTaggedWords(word, getWordTagger().tag(probeWord));
        lowerTaggerTokens = asAnalyzedTokenListForTaggedWords(word, getWordTagger().tag(lowerWord));
        boolean isLowercase = probeWord.equals(lowerWord);

        // Normal case.
        addTokens(taggerTokens, l);

        if (!isLowercase) {
          // Lowercase.
          addTokens(lowerTaggerTokens, l);
        }

        // Uppercase.
        if (lowerTaggerTokens.isEmpty() && taggerTokens.isEmpty()) {
          if (isLowercase) {
            upperTaggerTokens = asAnalyzedTokenListForTaggedWords(word,
                getWordTagger().tag(StringTools.uppercaseFirstChar(probeWord)));
            if (!upperTaggerTokens.isEmpty()) {
              addTokens(upperTaggerTokens, l);
            }
          }
          if (l.isEmpty()) {
            if ((matcher = patternSuffix.matcher(probeWord)).find()) {
              // Remove the suffix and probe dictionary again.
              // So given a word such as "xxx-mañ", we're going to
              // try to probe the dictionary again with "xxx" this time.
              probeWord = matcher.group(1);
              continue;
            }
            l.add(new AnalyzedToken(word, null, null));
          }
        }
        tokenReadings.add(new AnalyzedTokenReadings(l, pos));
        pos += word.length();
        break;
      }
    }

    return tokenReadings;

  
<methods>public void <init>(java.lang.String, java.util.Locale) ,public void <init>(java.lang.String, java.util.Locale, boolean) ,public void <init>(java.lang.String, java.util.Locale, boolean, boolean) ,public final org.languagetool.AnalyzedTokenReadings createNullToken(java.lang.String, int) ,public org.languagetool.AnalyzedToken createToken(java.lang.String, java.lang.String) ,public java.lang.String getDictionaryPath() ,public List<java.lang.String> getManualAdditionsFileNames() ,public List<java.lang.String> getManualRemovalsFileNames() ,public boolean overwriteWithManualTagger() ,public List<org.languagetool.AnalyzedTokenReadings> tag(List<java.lang.String>) throws java.io.IOException<variables>private static final java.lang.String CUSTOM_MANUAL_ADDITIONS_FILE,private static final java.lang.String CUSTOM_MANUAL_REMOVALS_FILE,private static final java.lang.String MANUAL_ADDITIONS_FILE,private static final java.lang.String MANUAL_REMOVALS_FILE,private final non-sealed Dictionary#RAW dictionary,private final non-sealed java.lang.String dictionaryPath,protected final non-sealed java.util.Locale locale,private final non-sealed boolean tagLowercaseWithUppercase,protected final non-sealed org.languagetool.tagging.WordTagger wordTagger