本文整理了Java中org.antlr.v4.runtime.misc.Utils.writeFile()
方法的一些代码示例,展示了Utils.writeFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.writeFile()
方法的具体详情如下:
包路径:org.antlr.v4.runtime.misc.Utils
类名称:Utils
方法名:writeFile
暂无
代码示例来源:origin: org.antlr/antlr4-runtime
public static void writeFile(String fileName, String content) throws IOException {
writeFile(fileName, content, null);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
public static void writeFile(String fileName, String content) throws IOException {
writeFile(fileName, content, null);
}
代码示例来源:origin: uk.co.nichesolutions/antlr4-runtime
public static void writeFile(String fileName, String content) throws IOException {
writeFile(fileName, content, null);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
public static void writeFile(String fileName, String content) throws IOException {
writeFile(fileName, content, null);
}
代码示例来源:origin: antlr/codebuff
public static void main(String[] args) throws Exception {
LangDescriptor[] languages = new LangDescriptor[] {
JAVA_DESCR,
JAVA8_DESCR,
JAVA_GUAVA_DESCR,
};
List<String> corpusDirs = map(languages, l -> l.corpusDir);
String[] dirs = corpusDirs.toArray(new String[languages.length]);
String python = testAllLanguages(languages, dirs, "all_java_leave_one_out.pdf");
String fileName = "python/src/all_java_leave_one_out.py";
Utils.writeFile(fileName, python);
System.out.println("wrote python code to "+fileName);
}
}
代码示例来源:origin: antlr/codebuff
public static void main(String[] args) throws Exception {
LangDescriptor[] languages = new LangDescriptor[] {
SQLITE_NOISY_DESCR,
SQLITE_CLEAN_DESCR,
TSQL_NOISY_DESCR,
TSQL_CLEAN_DESCR,
};
List<String> corpusDirs = map(languages, l -> l.corpusDir);
String[] dirs = corpusDirs.toArray(new String[languages.length]);
String python = testAllLanguages(languages, dirs, "all_sql_leave_one_out.pdf");
String fileName = "python/src/all_sql_leave_one_out.py";
Utils.writeFile(fileName, python);
System.out.println("wrote python code to "+fileName);
}
代码示例来源:origin: antlr/codebuff
public static void main(String[] args) throws Exception {
LangDescriptor[] languages = new LangDescriptor[] {
JAVA_DESCR,
JAVA8_DESCR,
JAVA_GUAVA_DESCR,
JAVA8_GUAVA_DESCR,
ANTLR4_DESCR,
SQLITE_CLEAN_DESCR,
TSQL_CLEAN_DESCR,
SQLITE_NOISY_DESCR,
TSQL_NOISY_DESCR,
// QUORUM_DESCR,
};
List<String> corpusDirs = map(languages, l -> l.corpusDir);
String[] dirs = corpusDirs.toArray(new String[languages.length]);
String python = testAllLanguages(languages, dirs, "leave_one_out.pdf");
String fileName = "python/src/leave_one_out.py";
Utils.writeFile(fileName, python);
System.out.println("wrote python code to "+fileName);
}
}
代码示例来源:origin: antlr/codebuff
Utils.writeFile(fileName, code);
System.out.println("wrote python code to "+fileName);
代码示例来源:origin: com.tunnelvisionlabs/antlr4-runtime
public static void writeFile(@NotNull String fileName, @NotNull String content) throws IOException {
writeFile(fileName, content, null);
}
代码示例来源:origin: antlr/codebuff
Utils.writeFile(fileName, code);
System.out.println("wrote python code to "+fileName);
代码示例来源:origin: antlr/codebuff
fileName = "python/src/drop_one_ws_feature_from_all.py";
Utils.writeFile(fileName, code);
System.out.println("wrote python code to "+fileName);
代码示例来源:origin: antlr/codebuff
public static void format(LangDescriptor language,
String testFileName,
String outputFileName)
throws Exception
{
// load all files up front
List<String> allFiles = getFilenames(new File(language.corpusDir), language.fileRegex);
List<InputDocument> documents = load(allFiles, language);
// if in corpus, don't include in corpus
final String path = new File(testFileName).getAbsolutePath();
List<InputDocument> others = filter(documents, d -> !d.fileName.equals(path));
InputDocument testDoc = parse(testFileName, language);
Corpus corpus = new Corpus(others, language);
corpus.train();
Formatter formatter = new Formatter(corpus, language.indentSize, Formatter.DEFAULT_K,
FEATURES_INJECT_WS, FEATURES_HPOS);
String output = formatter.format(testDoc, false);
if ( outputFileName!=null ) {
Utils.writeFile(outputFileName, output);
}
else {
System.out.print(output);
}
}
代码示例来源:origin: antlr/codebuff
pythonST.add("N", STAGES+1);
String fileName = "python/src/stability.py";
Utils.writeFile(fileName, pythonST.render());
System.out.println("wrote python code to "+fileName);
代码示例来源:origin: antlr/codebuff
public static Triple<Formatter,Float,Float> validate(LangDescriptor language,
List<InputDocument> documents,
InputDocument testDoc,
boolean saveOutput,
boolean computeEditDistance)
throws Exception
{
// kNNClassifier.resetCache();
Corpus corpus = new Corpus(documents, language);
corpus.train();
// System.out.printf("%d feature vectors\n", corpus.featureVectors.size());
Formatter formatter = new Formatter(corpus, language.indentSize);
String output = formatter.format(testDoc, false);
float editDistance = 0;
if ( computeEditDistance ) {
editDistance = normalizedLevenshteinDistance(testDoc.content, output);
}
ClassificationAnalysis analysis = new ClassificationAnalysis(testDoc, formatter.getAnalysisPerToken());
// System.out.println(testDoc.fileName+": edit distance = "+editDistance+", error rate = "+analysis.getErrorRate());
if ( saveOutput ) {
File dir = new File(outputDir+"/"+language.name);
if ( saveOutput ) {
dir = new File(outputDir+"/"+language.name);
dir.mkdir();
}
Utils.writeFile(dir.getPath()+"/"+new File(testDoc.fileName).getName(), output);
}
return new Triple<>(formatter, editDistance, analysis.getErrorRate());
}
代码示例来源:origin: antlr/codebuff
String[] dirs = corpusDirs.toArray(new String[languages.length]);
String fileName = "python/src/subset_validator.py";
Utils.writeFile(fileName, pythonST.render());
System.out.println("wrote python code to "+fileName);
代码示例来源:origin: antlr/codebuff
Utils.writeFile(fileName, code);
System.out.println("wrote python code to "+fileName);
内容来源于网络,如有侵权,请联系作者删除!