class POSTagLanguageModel {

  public static void main(final String[] args) throws IOException {
    if (args.length == 1) {
      final Language language = getLanguageOrExit(args[0]);
      final JLanguageTool lt = new JLanguageTool(language, null);
      runOnStdIn(lt);
    } else {
      exitWithUsageMessage();
    }
  }

  private static Language getLanguageOrExit(final String lang) {
    Language language = null;
    boolean foundLanguage = false;
    final List<String> supportedLanguages = new ArrayList<>();
    for (final Language tmpLang : Languages.get()) {
      supportedLanguages.add(tmpLang.getShortCode());
      if (lang.equals(tmpLang.getShortCode())) {
        language = tmpLang;
        foundLanguage = true;
        break;
      }
    }
    if (!foundLanguage) {
      System.out.println("Unknown language '" + lang
          + "'. Supported languages are: " + supportedLanguages);
      exitWithUsageMessage();
    }
    return language;
  }

  private static void exitWithUsageMessage() {
    System.out.println("Usage: java org.languagetool.dev.archive.POSTagLanguageModel <language>");
  }

  private static void runOnStdIn(final JLanguageTool lt) throws IOException {<FILL_FUNCTION_BODY>}

  private static void tagText(final String contents, final JLanguageTool lt)
      throws IOException {
    AnalyzedSentence analyzedText;
    final List<String> sentences = lt.sentenceTokenize(contents);
    for (final String sentence : sentences) {
      analyzedText = lt.getAnalyzedSentence(sentence);
      System.out.println(getSentence(analyzedText));
    }
  }

  private static String getSentence(final AnalyzedSentence sent) {
    final StringBuilder sb = new StringBuilder();
    sb.append("<S>");
    for (final AnalyzedTokenReadings atr : sent.getTokensWithoutWhitespace()) {
      sb.append(getPOS(atr));
      sb.append(' ');
    }
    sb.append("</S>");
    return sb.toString();
  }

  private static String getPOS(final AnalyzedTokenReadings atr) {
    final StringBuilder sb = new StringBuilder();
    final int readNum = atr.getReadingsLength();
    for (int i = 0; i < readNum; i++) {
      if (!atr.isWhitespace()) {
        sb.append(atr.getAnalyzedToken(i).getPOSTag());
        if (i != readNum - 1) {
          sb.append('+');
        }
      }
    }
    return sb.toString();
  }
  
}

    final int MAX_FILE_SIZE = 64_000;
    InputStreamReader isr = null;
    BufferedReader br = null;
    StringBuilder sb = new StringBuilder();
    try {
      isr = new InputStreamReader(new BufferedInputStream(System.in));
      br = new BufferedReader(isr);
      String line;
      while ((line = br.readLine()) != null) {
        sb.append(line);
        sb.append('\n');
        if (lt.getLanguage().getSentenceTokenizer().singleLineBreaksMarksPara()) {
          tagText(sb.toString(), lt);
          sb = new StringBuilder();
        } else {
          if ("".equals(line) || sb.length() >= MAX_FILE_SIZE) {
            tagText(sb.toString(), lt);
            sb = new StringBuilder();
          }
        }
      }
    } finally {
      if (sb.length() > 0) {
        tagText(sb.toString(), lt);
      }
    }
    br.close();
    isr.close();
  
<no_super_class>