本文整理了Java中weka.core.Utils.unbackQuoteChars()
方法的一些代码示例,展示了Utils.unbackQuoteChars()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.unbackQuoteChars()
方法的具体详情如下:
包路径:weka.core.Utils
类名称:Utils
方法名:unbackQuoteChars
[英]The inverse operation of backQuoteChars(). Converts back-quoted carriage returns and new lines in a string to the corresponding character ('\r' and '\n'). Also "un"-back-quotes the following characters: ` " \ \t and %
[中]backQuoteChars()的逆运算。将带反引号的回车和字符串中的新行转换为相应的字符(“\r”和“\n”)。还有“un”-将下列字符反引:“\t和%
代码示例来源:origin: Waikato/weka-trunk
/**
* Set the value of delimiters. For convenienve, the strings "\r", "\n", "\t",
* "\'", "\\" get automatically translated into their character
* representations '\r', '\n', '\t', '\'', '\\'. This means, one can either
* use <code>setDelimiters("\r\n\t\\");</code> or
* <code>setDelimiters("\\r\\n\\t\\\\");</code>.
*
* @param value Value to assign to delimiters.
* @see Utils#unbackQuoteChars(String)
*/
public void setDelimiters(String value) {
m_Delimiters = Utils.unbackQuoteChars(value);
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Set the value of delimiters. For convenienve, the strings "\r", "\n", "\t",
* "\'", "\\" get automatically translated into their character
* representations '\r', '\n', '\t', '\'', '\\'. This means, one can either
* use <code>setDelimiters("\r\n\t\\");</code> or
* <code>setDelimiters("\\r\\n\\t\\\\");</code>.
*
* @param value Value to assign to delimiters.
* @see Utils#unbackQuoteChars(String)
*/
public void setDelimiters(String value) {
m_Delimiters = Utils.unbackQuoteChars(value);
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Sets the character used as column separator.
*
* @param value the character to use
*/
public void setFieldSeparator(String value) {
m_FieldSeparator = Utils.unbackQuoteChars(value);
/*
* if (m_FieldSeparator.length() != 1) { m_FieldSeparator = ","; System.err
* .println(
* "Field separator can only be a single character (exception being '\t'), "
* + "defaulting back to '" + m_FieldSeparator + "'!"); }
*/
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Sets the character used as column separator.
*
* @param value the character to use
*/
public void setFieldSeparator(String value) {
m_FieldSeparator = Utils.unbackQuoteChars(value);
/*
* if (m_FieldSeparator.length() != 1) { m_FieldSeparator = ","; System.err
* .println(
* "Field separator can only be a single character (exception being '\t'), "
* + "defaulting back to '" + m_FieldSeparator + "'!"); }
*/
}
代码示例来源:origin: nz.ac.waikato.cms.weka/distributedWekaBase
/**
* Sets the character used as column separator.
*
* @param value the character to use
*/
public void setFieldSeparator(String value) {
m_FieldSeparator = Utils.unbackQuoteChars(value);
if (m_FieldSeparator.length() != 1) {
m_FieldSeparator = ",";
System.err
.println("Field separator can only be a single character (exception being '\t'), "
+ "defaulting back to '" + m_FieldSeparator + "'!");
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Sets the character used as column separator.
*
* @param value the character to use
*/
public void setFieldSeparator(String value) {
m_FieldSeparator = Utils.unbackQuoteChars(value);
if (m_FieldSeparator.length() != 1) {
m_FieldSeparator = ",";
System.err
.println("Field separator can only be a single character (exception being '\t'), "
+ "defaulting back to '" + m_FieldSeparator + "'!");
}
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Sets the character used as column separator.
*
* @param value the character to use
*/
public void setFieldSeparator(String value) {
m_FieldSeparator = Utils.unbackQuoteChars(value);
if (m_FieldSeparator.length() != 1) {
m_FieldSeparator = ",";
System.err
.println("Field separator can only be a single character (exception being '\t'), "
+ "defaulting back to '" + m_FieldSeparator + "'!");
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* unquotes are previously quoted string (but only if necessary), i.e., it
* removes the single quotes around it. Inverse to quote(String).
*
* @param string the string to process
* @return the unquoted string
* @see #quote(String)
*/
public static String unquote(String string) {
if (string.startsWith("'") && string.endsWith("'")) {
string = string.substring(1, string.length() - 1);
if ((string.indexOf("\\n") != -1) || (string.indexOf("\\r") != -1)
|| (string.indexOf("\\'") != -1) || (string.indexOf("\\\"") != -1)
|| (string.indexOf("\\\\") != -1) || (string.indexOf("\\t") != -1)
|| (string.indexOf("\\%") != -1) || (string.indexOf("\\u001E") != -1)) {
string = unbackQuoteChars(string);
}
}
return string;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* unquotes are previously quoted string (but only if necessary), i.e., it
* removes the single quotes around it. Inverse to quote(String).
*
* @param string the string to process
* @return the unquoted string
* @see #quote(String)
*/
public static String unquote(String string) {
if (string.startsWith("'") && string.endsWith("'")) {
string = string.substring(1, string.length() - 1);
if ((string.indexOf("\\n") != -1) || (string.indexOf("\\r") != -1)
|| (string.indexOf("\\'") != -1) || (string.indexOf("\\\"") != -1)
|| (string.indexOf("\\\\") != -1) || (string.indexOf("\\t") != -1)
|| (string.indexOf("\\%") != -1) || (string.indexOf("\\u001E") != -1)) {
string = unbackQuoteChars(string);
}
}
return string;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
optStr = replaceStrings(optStr, toReplace, replacements);
} else {
optStr = unbackQuoteChars(optStr);
代码示例来源:origin: Waikato/weka-trunk
optStr = replaceStrings(optStr, toReplace, replacements);
} else {
optStr = unbackQuoteChars(optStr);
代码示例来源:origin: Waikato/weka-trunk
/**
* tests backQuoteChars and unbackQuoteChars
*
* @see Utils#backQuoteChars(String)
* @see Utils#unbackQuoteChars(String)
*/
public void testBackQuoting() {
String input;
String output;
input = "blahblah";
output = Utils.backQuoteChars(input);
assertTrue("No backquoting necessary", input.equals(output));
input = "\r\n\t'\"%";
output = Utils.backQuoteChars(input);
assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output)));
input = "\\r\\n\\t\\'\\\"\\%";
output = Utils.backQuoteChars(input);
assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output)));
input = Utils.joinOptions(new StringToWordVector().getOptions());
output = Utils.backQuoteChars(input);
assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output)));
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* tests backQuoteChars and unbackQuoteChars
*
* @see Utils#backQuoteChars(String)
* @see Utils#unbackQuoteChars(String)
*/
public void testBackQuoting() {
String input;
String output;
input = "blahblah";
output = Utils.backQuoteChars(input);
assertTrue("No backquoting necessary", input.equals(output));
input = "\r\n\t'\"%";
output = Utils.backQuoteChars(input);
assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output)));
input = "\\r\\n\\t\\'\\\"\\%";
output = Utils.backQuoteChars(input);
assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output)));
input = Utils.joinOptions(new StringToWordVector().getOptions());
output = Utils.backQuoteChars(input);
assertTrue(">" + input + "< restored", input.equals(Utils.unbackQuoteChars(output)));
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
vals[index] = data.attribute(index).indexOfValue(Utils.unbackQuoteChars(Utils.unquote(value)));
if (vals[index] == -1) {
System.err.println("Unknown label '" + value + "' for attribute #" + (index+1) + "!");
代码示例来源:origin: Waikato/weka-trunk
vals[index] = data.attribute(index).indexOfValue(Utils.unbackQuoteChars(Utils.unquote(value)));
if (vals[index] == -1) {
System.err.println("Unknown label '" + value + "' for attribute #" + (index+1) + "!");
代码示例来源:origin: Waikato/weka-trunk
setAttributeName(Utils.unbackQuoteChars(Utils.getOption('N', options)));
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
setAttributeName(Utils.unbackQuoteChars(Utils.getOption('N', options)));
代码示例来源:origin: net.sf.meka/meka
/**
* Sets the options.
*
* @param options the options
* @throws Exception if parsing fails
*/
@Override
public void setOptions(String[] options) throws Exception {
setNotes(Utils.unbackQuoteChars(OptionUtils.parse(options, "notes", "")));
setClassifiers(OptionUtils.parse(options, 'C', MultiLabelClassifier.class));
setDatasetProvider((DatasetProvider) OptionUtils.parse(options, 'D', getDefaultDatasetProvider()));
setEvaluator((Evaluator) OptionUtils.parse(options, 'E', getDefaultEvaluator()));
setStatisticsHandler((EvaluationStatisticsHandler) OptionUtils.parse(options, 'S', getDefaultStatisticsHandler()));
}
代码示例来源:origin: Waikato/meka
/**
* Sets the options.
*
* @param options the options
* @throws Exception if parsing fails
*/
@Override
public void setOptions(String[] options) throws Exception {
setNotes(Utils.unbackQuoteChars(OptionUtils.parse(options, "notes", "")));
setClassifiers(OptionUtils.parse(options, 'C', MultiLabelClassifier.class));
setDatasetProvider((DatasetProvider) OptionUtils.parse(options, 'D', getDefaultDatasetProvider()));
setEvaluator((Evaluator) OptionUtils.parse(options, 'E', getDefaultEvaluator()));
setStatisticsHandler((EvaluationStatisticsHandler) OptionUtils.parse(options, 'S', getDefaultStatisticsHandler()));
}
内容来源于网络,如有侵权,请联系作者删除!