![JAR search and dependency download from the Maven repository](/logo.png)
edu.berkeley.nlp.ui.EasyFormat Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of berkeleyparser Show documentation
Show all versions of berkeleyparser Show documentation
The Berkeley parser analyzes the grammatical structure of natural language using probabilistic context-free grammars (PCFGs).
The newest version!
package edu.berkeley.nlp.ui;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.List;
public class EasyFormat
{
private static DecimalFormat stdFormat = null;
public static DecimalFormat getStdFormat()
{
if (stdFormat == null)
{
DecimalFormatSymbols dsymb = new DecimalFormatSymbols();
// on french locales, dots print like comma
dsymb.setDecimalSeparator('.');
stdFormat = new DecimalFormat("0.0000");
stdFormat.setDecimalFormatSymbols(dsymb);
}
return stdFormat;
}
public static String std(double number)
{
return getStdFormat().format(number);
}
public static String fmt(double number)
{
return std(number);
}
public static String fmt(List numbers)
{
StringBuilder result = new StringBuilder();
result.append("[");
for (int i = 0; i < numbers.size(); i++)
{
result.append(fmt(numbers.get(i)));
if (i != numbers.size() - 1) result.append(" ");
}
result.append("]");
return result.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy