All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.berkeley.nlp.util.CharEncUtils Maven / Gradle / Ivy

Go to download

The Berkeley parser analyzes the grammatical structure of natural language using probabilistic context-free grammars (PCFGs).

The newest version!
package edu.berkeley.nlp.util;

import java.io.*;

public class CharEncUtils {
  //private static String charEncoding = "ISO-8859-1";
  private static String charEncoding = "UTF-8";

  public static String getCharEncoding() { return charEncoding; }

  public static void setCharEncoding(String charEncoding) {
    if(StrUtils.isEmpty(charEncoding)) return;
    CharEncUtils.charEncoding = charEncoding;
    LogInfo.updateStdStreams();
  }

  public static BufferedReader getReader(InputStream in) throws IOException {
    return new BufferedReader(new InputStreamReader(in, getCharEncoding()));
  }
  public static PrintWriter getWriter(OutputStream out) throws IOException {
    return new PrintWriter(new OutputStreamWriter(out, getCharEncoding()), true);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy