зеркало из https://github.com/mozilla/marytts.git
format java code in marytts-transcription
This commit is contained in:
Родитель
9c81c6729e
Коммит
f776787fa5
|
@ -156,35 +156,35 @@ public class LTSLexiconPOSBuilder {
|
|||
|
||||
private LTSTrainer trainLTS(String treeAbsolutePath) throws IOException {
|
||||
|
||||
Object[][] tableData = transcriptionModel.getData();
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
boolean[] hasManualVerify = transcriptionModel.getManualVerifiedList();
|
||||
boolean[] hasCorrectSyntax = transcriptionModel.getCorrectSyntaxList();
|
||||
Object[][] tableData = transcriptionModel.getData();
|
||||
HashMap<String, String> map = new HashMap<String, String>();
|
||||
boolean[] hasManualVerify = transcriptionModel.getManualVerifiedList();
|
||||
boolean[] hasCorrectSyntax = transcriptionModel.getCorrectSyntaxList();
|
||||
|
||||
for (int i = 0; i < tableData.length; i++) {
|
||||
if (hasManualVerify[i] && hasCorrectSyntax[i]) {
|
||||
String grapheme = (String) tableData[i][1];
|
||||
String phone = (String) tableData[i][2];
|
||||
if (!phone.equals("")) {
|
||||
map.put(grapheme, phone);
|
||||
transcriptionModel.setAsCorrectSyntax(i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < tableData.length; i++) {
|
||||
if (hasManualVerify[i] && hasCorrectSyntax[i]) {
|
||||
String grapheme = (String) tableData[i][1];
|
||||
String phone = (String) tableData[i][2];
|
||||
if (!phone.equals("")) {
|
||||
map.put(grapheme, phone);
|
||||
transcriptionModel.setAsCorrectSyntax(i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LTSTrainer tp = new LTSTrainer(phoneSet, true, true, 2);
|
||||
tp.readLexicon(map);
|
||||
System.out.println("training ... ");
|
||||
// make some alignment iterations
|
||||
for (int i = 0; i < 5; i++) {
|
||||
System.out.println("iteration " + i);
|
||||
tp.alignIteration();
|
||||
}
|
||||
System.out.println("training completed.");
|
||||
CART st = tp.trainTree(100);
|
||||
tp.save(st, treeAbsolutePath);
|
||||
return tp;
|
||||
}
|
||||
LTSTrainer tp = new LTSTrainer(phoneSet, true, true, 2);
|
||||
tp.readLexicon(map);
|
||||
System.out.println("training ... ");
|
||||
// make some alignment iterations
|
||||
for (int i = 0; i < 5; i++) {
|
||||
System.out.println("iteration " + i);
|
||||
tp.alignIteration();
|
||||
}
|
||||
System.out.println("training completed.");
|
||||
CART st = tp.trainTree(100);
|
||||
tp.save(st, treeAbsolutePath);
|
||||
return tp;
|
||||
}
|
||||
|
||||
private String getLocaleString() {
|
||||
return locale;
|
||||
|
|
|
@ -640,43 +640,44 @@ public class TranscriptionGUI extends javax.swing.JFrame {
|
|||
mySqlDetailsDialog.setVisible(false);
|
||||
}// GEN-LAST:event_cancelMySqlDetails
|
||||
|
||||
private void loadFromSqlDatabase(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadFromSqlDatabase
|
||||
|
||||
if(!checkNecessaryEvents("load")) return;
|
||||
String hostName = hostNameTextField.getText();
|
||||
String databaseName = dbNameTextField.getText();
|
||||
String tableName = tableNameTextField.getText();
|
||||
String userName = userNameTextField.getText();
|
||||
String password = passwordTextField.getText();
|
||||
locale = simplePanel.getLocaleString();
|
||||
DBHandler wikiToDB = new DBHandler(locale);
|
||||
wikiToDB.createDBConnection(hostName,databaseName,userName,password);
|
||||
wikiToDB.setWordListTable(tableName);
|
||||
int noWords = wikiToDB.getNumberOfWords(0);
|
||||
//HashMap<String, Integer> hpMap = wikiToDB.getMostFrequentWords(noWords, 0);
|
||||
ArrayList<String> arrList = wikiToDB.getMostFrequentWordsArray(noWords, 0);
|
||||
wikiToDB.closeDBConnection();
|
||||
try {
|
||||
simplePanel.loadTranscription(arrList);
|
||||
simplePanel.repaint();
|
||||
simplePanel.updateUI();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
fileNametoSave = null;
|
||||
|
||||
treeAbsolutePath = null;
|
||||
dirName = null;
|
||||
baseName = null;
|
||||
suffix = null;
|
||||
|
||||
mySqlDetailsDialog.setVisible(false);
|
||||
loadTranscription = true;
|
||||
saveToFile.setEnabled(true);
|
||||
saveAsToFile.setEnabled(true);
|
||||
checkNecessaryEvents("load");
|
||||
|
||||
}//GEN-LAST:event_loadFromSqlDatabase
|
||||
private void loadFromSqlDatabase(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_loadFromSqlDatabase
|
||||
|
||||
if (!checkNecessaryEvents("load"))
|
||||
return;
|
||||
String hostName = hostNameTextField.getText();
|
||||
String databaseName = dbNameTextField.getText();
|
||||
String tableName = tableNameTextField.getText();
|
||||
String userName = userNameTextField.getText();
|
||||
String password = passwordTextField.getText();
|
||||
locale = simplePanel.getLocaleString();
|
||||
DBHandler wikiToDB = new DBHandler(locale);
|
||||
wikiToDB.createDBConnection(hostName, databaseName, userName, password);
|
||||
wikiToDB.setWordListTable(tableName);
|
||||
int noWords = wikiToDB.getNumberOfWords(0);
|
||||
// HashMap<String, Integer> hpMap = wikiToDB.getMostFrequentWords(noWords, 0);
|
||||
ArrayList<String> arrList = wikiToDB.getMostFrequentWordsArray(noWords, 0);
|
||||
wikiToDB.closeDBConnection();
|
||||
try {
|
||||
simplePanel.loadTranscription(arrList);
|
||||
simplePanel.repaint();
|
||||
simplePanel.updateUI();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
fileNametoSave = null;
|
||||
|
||||
treeAbsolutePath = null;
|
||||
dirName = null;
|
||||
baseName = null;
|
||||
suffix = null;
|
||||
|
||||
mySqlDetailsDialog.setVisible(false);
|
||||
loadTranscription = true;
|
||||
saveToFile.setEnabled(true);
|
||||
saveAsToFile.setEnabled(true);
|
||||
checkNecessaryEvents("load");
|
||||
|
||||
}// GEN-LAST:event_loadFromSqlDatabase
|
||||
|
||||
private void ancestorFrameResized(java.awt.event.HierarchyEvent evt) {// GEN-FIRST:event_ancestorFrameResized
|
||||
try {
|
||||
|
|
Загрузка…
Ссылка в новой задаче