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

edu.stanford.nlp.util.logging.Color Maven / Gradle / Ivy

Go to download

Stanford CoreNLP provides a set of natural language analysis tools which can take raw English language text input and give the base forms of words, their parts of speech, whether they are names of companies, people, etc., normalize dates, times, and numeric quantities, mark up the structure of sentences in terms of phrases and word dependencies, and indicate which noun phrases refer to the same entities. It provides the foundational building blocks for higher level text understanding applications.

There is a newer version: 4.5.7
Show newest version

package edu.stanford.nlp.util.logging;

/**
 * ANSI supported colors.
 * These values are mirrored in Redwood.Util.
 *
 * @author Gabor Angeli (angeli at cs.stanford)
 */
public enum Color {

  //note: NONE BLACK and WHITE must be first three (for random colors in OutputHandler to work)
  NONE(""), BLACK("\033[30m"), WHITE("\033[37m"), RED("\033[31m"), GREEN("\033[32m"),
  YELLOW("\033[33m"), BLUE("\033[34m"), MAGENTA("\033[35m"), CYAN("\033[36m");

  public final String ansiCode;

  Color(String ansiCode){
    this.ansiCode = ansiCode;
  }

  public String apply(String toColor) {
    StringBuilder b = new StringBuilder();
    if (Redwood.supportsAnsi) { b.append(ansiCode); }
    b.append(toColor);
    if (Redwood.supportsAnsi) { b.append("\033[0m"); }
    return b.toString();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy