本文整理了Java中marytts.util.io.FileUtils.getFileAsString()
方法的一些代码示例,展示了FileUtils.getFileAsString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.getFileAsString()
方法的具体详情如下:
包路径:marytts.util.io.FileUtils
类名称:FileUtils
方法名:getFileAsString
[英]Read a file into a string, using the given encoding, and return that string.
[中]使用给定的编码将文件读入字符串,然后返回该字符串。
代码示例来源:origin: marytts/marytts
public void read(String festivalUttFile) {
String allText = null;
try {
allText = FileUtils.getFileAsString(new File(festivalUttFile), "ASCII");
} catch (IOException e) {
代码示例来源:origin: marytts/marytts
public void read(String festivalUttFile) {
String allText = null;
try {
allText = FileUtils.getFileAsString(new File(festivalUttFile), "ASCII");
} catch (IOException e) {
代码示例来源:origin: marytts/marytts
System.err.println("Warning: Number of labels is different!");
System.err.println(args[1] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[1]), "ASCII"));
System.err.println(args[3] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[3]), "ASCII"));
代码示例来源:origin: marytts/marytts
System.err.println("Warning: Number of labels is different!");
System.err.println(args[1] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[1]), "ASCII"));
System.err.println(args[3] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[3]), "ASCII"));
代码示例来源:origin: marytts/marytts
System.err.println("Warning: Number of labels is different!");
System.err.println(args[1] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[1]), "ASCII"));
System.err.println(args[3] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[3]), "ASCII"));
代码示例来源:origin: marytts/marytts
System.err.println("Warning: Number of labels is different!");
System.err.println(args[1] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[1]), "ASCII"));
System.err.println(args[3] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[3]), "ASCII"));
代码示例来源:origin: marytts/marytts
System.err.println("Warning: Number of labels is different!");
System.err.println(args[2] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[2]), "ASCII"));
System.err.println(args[5] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[5]), "ASCII"));
代码示例来源:origin: marytts/marytts
System.err.println("Warning: Number of labels is different!");
System.err.println(args[2] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[2]), "ASCII"));
System.err.println(args[5] + ":");
System.err.println(FileUtils.getFileAsString(new File(args[5]), "ASCII"));
代码示例来源:origin: de.dfki.mary/marytts-builder
public void computeFeaturesFor(String basename) throws IOException {
File allophoneFile = new File(getProp(ALLOPHONES) + basename + xmlExt);
String text = FileUtils.getFileAsString(allophoneFile, "UTF-8");
OutputStream os = new BufferedOutputStream(new FileOutputStream(new File(unitfeatureDir, basename + featsExt)));
MaryHttpClient maryClient = getMaryClient();
maryClient.process(text, maryInputType, maryOutputType, locale, null, null, "", null, featureList, os);
os.flush();
os.close();
}
代码示例来源:origin: de.dfki.mary/marytts-builder
@Override
protected void initialiseComp() {
locale = db.getProp(db.LOCALE);
mary = null; // initialised only if needed
featureFile = new File(getProp(FEATUREFILE));
if (featureFile.exists()) {
System.out.println("Loading features from file " + getProp(FEATUREFILE));
try {
features = FileUtils.getFileAsString(featureFile, "UTF-8");
} catch (IOException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: de.dfki.mary/marytts-transcription
public TranscriptionTableModel(String fileName) throws Exception {
String fileData = FileUtils.getFileAsString(new File(fileName), "UTF-8");
String[] words = fileData.split("\n");
this.data = new Object[words.length][4];
this.hasManualVerification = new boolean[words.length];
this.hasCorrectSyntax = new boolean[words.length];
for (int i = 0; i < words.length; i++) {
data[i][0] = Integer.toString(i);
data[i][1] = words[i];
data[i][2] = "";
data[i][3] = Boolean.FALSE;
setAsManualVerify(i, false);
setAsCorrectSyntax(i, true);
}
lastSavedData = storeLastSavedData();
}
代码示例来源:origin: de.dfki.mary/marytts-builder
/**
* Create phone sequence file, which is used for Alignment
*
* @throws Exception
* Exception
*/
private void getPhoneSequence() throws Exception {
String phoneSeq;
File alignFile = new File(outputDir + "/" + "ehmm" + ".align");
// open transcription file used for labeling
PrintWriter transLabelOut = new PrintWriter(new FileOutputStream(alignFile));
for (int i = 0; i < bnl.getLength(); i++) {
phoneSeq = getLineFromXML(bnl.getName(i));
transLabelOut.println(phoneSeq.trim());
}
transLabelOut.flush();
transLabelOut.close();
String data = FileUtils.getFileAsString(alignFile, "UTF-8");
PrintWriter pw = new PrintWriter(new FileWriter(alignFile));
// Check for minimum number of short pauses should be in Text
if (countShortSil > 10) { // delete word boundaries
data = data.replaceAll("vssil ", "");
} else { // else insert short pauses at each word boundary
data = data.replaceAll("vssil ", "ssil ");
data = data.replaceAll("ssil ssil ", "ssil ");
}
pw.print(data);
pw.flush();
pw.close();
}
代码示例来源:origin: de.dfki.mary/marytts-builder
System.out.println("Loading features from file " + getProp(FEATURELIST));
try {
featureList = FileUtils.getFileAsString(featureFile, "UTF-8");
featureList = featureList.replaceAll("\\s+", " ");
代码示例来源:origin: de.dfki.mary/marytts-builder
System.out.println("Loading features from file " + getProp(FEATURELIST));
try {
featureList = FileUtils.getFileAsString(featureFile, "UTF-8");
featureList = featureList.replaceAll("\\s+", " ");
代码示例来源:origin: de.dfki.mary/marytts-builder
macroFile.println(FileUtils.getFileAsString(new File(hmmDir + "hmm-dummy" + File.separator + "vFloors"), "ASCII"));
macroFile.flush();
macroFile.close();
代码示例来源:origin: de.dfki.mary/marytts-builder
private void editMaryXML(String basename) throws Exception {
final File maryxmlFile = new File(db.getProp(db.MARYXMLDIR) + basename + db.getProp(db.MARYXMLEXT));
if (!maryxmlFile.exists()) {
// need to create it
String text = FileUtils
.getFileAsString(new File(db.getProp(db.TEXTDIR) + basename + db.getProp(db.TEXTEXT)), "UTF-8");
PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(maryxmlFile), "UTF-8"));
pw.println(PhoneUnitFeatureComputer.getMaryXMLHeaderWithInitialBoundary(db.getProp(db.LOCALE)));
pw.println(text);
pw.println("</maryxml>");
pw.close();
}
boolean edited = new EditFrameShower(maryxmlFile).display();
if (edited) {
allophoneExtractor.generateAllophonesFile(basename);
try {
transcriptionAligner.alignTranscription(basename);
} catch (Exception e) {
e.printStackTrace();
}
labelComputer.computePhoneLabel(basename);
featureComputer.computeFeaturesFor(basename);
}
}
代码示例来源:origin: de.dfki.mary/marytts-builder
private void loadFile(String basename) {
try {
File wavFile = new File(wavDir, basename + db.getProp(db.WAVEXT));
if (!wavFile.exists())
throw new IllegalArgumentException("File " + wavFile.getAbsolutePath() + " does not exist");
File labFile = new File(phoneLabDir, basename + db.getProp(db.LABEXT));
if (!labFile.exists())
throw new IllegalArgumentException("File " + labFile.getAbsolutePath() + " does not exist");
// pm file is optional
File pmFile = new File(pmDir, basename + db.getProp(PMEXT));
if (pmFile.exists()) {
System.out.println("Loading pitchmarks file " + pmFile.getAbsolutePath());
pitchmarks = new ESTTextfileDoubleDataSource(pmFile).getAllData();
} else {
System.out.println("Pitchmarks file " + pmFile.getAbsolutePath() + " does not exist");
pitchmarks = null;
}
AudioInputStream ais = AudioSystem.getAudioInputStream(wavFile);
audioFormat = ais.getFormat();
samplingRate = (int) audioFormat.getSampleRate();
audioSignal = new AudioDoubleDataSource(ais).getAllData();
String file = FileUtils.getFileAsString(labFile, "ASCII");
String[] lines = file.split("\n");
labels.setListData(lines);
saveFilename.setText(basename);
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: de.dfki.mary/marytts-builder
String fileDict = FileUtils.getFileAsString(new File(phoneDict), "ASCII");
PrintWriter augPhoneDict = new PrintWriter(new FileWriter(phoneAugDict));
augPhoneDict.println("!ENTER sil");
augPhoneDict.close();
String fileList = FileUtils.getFileAsString(new File(phoneList), "ASCII");
PrintWriter augPhoneList = new PrintWriter(new FileWriter(phoneAugList));
augPhoneList.println("!ENTER");
代码示例来源:origin: de.dfki.mary/marytts-builder
text = FileUtils.getFileAsString(rawmaryxmlFile, "UTF-8");
} else {
text = getMaryXMLHeaderWithInitialBoundary(locale)
+ FileUtils.getFileAsString(new File(db.getProp(db.TEXTDIR) + basename + db.getProp(db.TEXTEXT)), "UTF-8")
+ "</maryxml>";
text = FileUtils.getFileAsString(intonisedxmlFile, "UTF-8");
代码示例来源:origin: de.dfki.mary/marytts-builder
text = FileUtils.getFileAsString(rawmaryxmlFile, "UTF-8");
} else {
text = getMaryXMLHeaderWithInitialBoundary(locale)
+ FileUtils.getFileAsString(new File(db.getProp(db.TEXTDIR) + basename + db.getProp(db.TEXTEXT)), "UTF-8")
+ "</maryxml>";
内容来源于网络,如有侵权,请联系作者删除!