public void read(String festivalUttFile) { String allText = null; try { allText = FileUtils.getFileAsString(new File(festivalUttFile), "ASCII"); } catch (IOException e) {
public void read(String festivalUttFile) { String allText = null; try { allText = FileUtils.getFileAsString(new File(festivalUttFile), "ASCII"); } catch (IOException e) {
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"));
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"));
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"));
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"));
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"));
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"));
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(); }
@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(); } } }
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(); }
/** * 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(); }
System.out.println("Loading features from file " + getProp(FEATURELIST)); try { featureList = FileUtils.getFileAsString(featureFile, "UTF-8"); featureList = featureList.replaceAll("\\s+", " ");
System.out.println("Loading features from file " + getProp(FEATURELIST)); try { featureList = FileUtils.getFileAsString(featureFile, "UTF-8"); featureList = featureList.replaceAll("\\s+", " ");
macroFile.println(FileUtils.getFileAsString(new File(hmmDir + "hmm-dummy" + File.separator + "vFloors"), "ASCII")); macroFile.flush(); macroFile.close();
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); } }
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(); } }
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");
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");
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>";