Skip to content

Commit

Permalink
Refactoring of old parameters names. Issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
ftesser committed Oct 16, 2012
1 parent 714e088 commit 0d66898
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 100 deletions.
26 changes: 13 additions & 13 deletions src/edu/cuny/qc/speech/AuToBI/AuToBI.java
Original file line number Diff line number Diff line change
Expand Up @@ -707,18 +707,18 @@ public String generateTextGridString(List<Word> words) {
Word w = words.get(i);
String text = "";
if (getBooleanParameter("distributions", false)) {
String det_dist_feature = tasks.get("pitch_accent_detection").getDistFeature();
String class_dist_feature = tasks.get("pitch_accent_classification").getDistFeature();
String det_dist_feature = tasks.get("pitch_accent_detector").getDistFeature();
String class_dist_feature = tasks.get("pitch_accent_classifier").getDistFeature();
if (w.hasAttribute(det_dist_feature)) {
text = w.getAttribute(det_dist_feature).toString();
}
if (w.hasAttribute(class_dist_feature)) {
text += w.getAttribute(class_dist_feature).toString();
}
} else {
if (tasks.containsKey("pitch_accent_detection") &&
w.hasAttribute(tasks.get("pitch_accent_detection").getHypFeature())) {
text = w.getAttribute(tasks.get("pitch_accent_detection").getHypFeature()).toString();
if (tasks.containsKey("pitch_accent_detector") &&
w.hasAttribute(tasks.get("pitch_accent_detector").getHypFeature())) {
text = w.getAttribute(tasks.get("pitch_accent_detector").getHypFeature()).toString();
}
}

Expand All @@ -739,17 +739,17 @@ public String generateTextGridString(List<Word> words) {

String text = "";
if (getBooleanParameter("distributions", false)) {
if (w.hasAttribute(tasks.get("intonational_phrase_boundary_detection").getDistFeature())) {
text = w.getAttribute(tasks.get("intonational_phrase_boundary_detection").getDistFeature()).toString();
if (w.hasAttribute(tasks.get("intonational_phrase_boundary_detector").getDistFeature())) {
text = w.getAttribute(tasks.get("intonational_phrase_boundary_detector").getDistFeature()).toString();
}
if (w.hasAttribute(tasks.get("intermediate_phrase_boundary_detection").getDistFeature())) {
text = w.getAttribute(tasks.get("intermediate_phrase_boundary_detection").getDistFeature()).toString();
if (w.hasAttribute(tasks.get("intermediate_phrase_boundary_detector").getDistFeature())) {
text = w.getAttribute(tasks.get("intermediate_phrase_boundary_detector").getDistFeature()).toString();
}
if (w.hasAttribute(tasks.get("boundary_tone_classification").getDistFeature())) {
text += w.getAttribute(tasks.get("boundary_tone_classification").getDistFeature()).toString();
if (w.hasAttribute(tasks.get("phrase_accent_boundary_tone_classifier").getDistFeature())) {
text += w.getAttribute(tasks.get("phrase_accent_boundary_tone_classifier").getDistFeature()).toString();
}
if (w.hasAttribute(tasks.get("phrase_accent_classification").getDistFeature())) {
text += w.getAttribute(tasks.get("phrase_accent_classification").getDistFeature()).toString();
if (w.hasAttribute(tasks.get("phrase_accent_classifier").getDistFeature())) {
text += w.getAttribute(tasks.get("phrase_accent_classifier").getDistFeature()).toString();
}
} else {
if (w.hasAttribute("hyp_phrase_boundary")) {
Expand Down
2 changes: 1 addition & 1 deletion src/edu/cuny/qc/speech/AuToBI/AuToBITrainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void main(String[] args) {
// Tone classification tasks ignore those points that do not have any associated prosodic event
if (task_label.equals("phrase_accent_classifier")) {
autobi.getParameters().setParameter("attribute_omit", "nominal_PitchAccentType:NOTONE");
} else if (task_label.equals("boundary_tone_classifier")) {
} else if (task_label.equals("phrase_accent_boundary_tone_classifier")) {
autobi.getParameters().setParameter("attribute_omit", "nominal_PhraseAccentBoundaryTone:NOTONE");
} else if (task_label.equals("phrase_accent_classifier")) {
autobi.getParameters().setParameter("attribute_omit", "nominal_PhraseAccent:NOTONE");
Expand Down
4 changes: 2 additions & 2 deletions src/edu/cuny/qc/speech/AuToBI/AuToBITrainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ public static void main(String[] args) {
if (task_label.equals("phrase_accent_classifier")) {
autobi.getParameters()
.setParameter("attribute_omit", autobi.getTrueFeature("phrase_accent_classifier") + ":NOTONE");
} else if (task_label.equals("boundary_tone_classifier")) {
} else if (task_label.equals("phrase_accent_boundary_tone_classifier")) {
autobi.getParameters()
.setParameter("attribute_omit", autobi.getTrueFeature("boundary_tone_classifier") + ":NOTONE");
.setParameter("attribute_omit", autobi.getTrueFeature("phrase_accent_boundary_tone_classifier") + ":NOTONE");
} else if (task_label.equals("phrase_accent_classifier")) {
autobi.getParameters()
.setParameter("attribute_omit", autobi.getTrueFeature("phrase_accent_classifier") + ":NOTONE");
Expand Down
46 changes: 23 additions & 23 deletions src/edu/cuny/qc/speech/AuToBI/util/AuToBIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,62 +244,62 @@ public static void mergeAuToBIHypotheses(AuToBI autobi, List<Word> words) throws
// Assigns pitch accents to words. If only accent detection is available, a binary True/False hypothesis
// will be assigned. If location and type hypotheses are available, the hypothesized type will be assigned.
// Finally, if only type information is available, every word will be assigned its best guess for accent type.
if (word.hasAttribute(autobi.getHypothesizedFeature("pitch_accent_detection"))) {
if (word.hasAttribute(autobi.getConfidenceFeature("pitch_accent_detection"))) {
Double conf = (Double) word.getAttribute(autobi.getConfidenceFeature("pitch_accent_detection"));
if (!word.getAttribute(autobi.getHypothesizedFeature("pitch_accent_detection")).equals("ACCENTED")) {
if (word.hasAttribute(autobi.getHypothesizedFeature("pitch_accent_detector"))) {
if (word.hasAttribute(autobi.getConfidenceFeature("pitch_accent_detector"))) {
Double conf = (Double) word.getAttribute(autobi.getConfidenceFeature("pitch_accent_detector"));
if (!word.getAttribute(autobi.getHypothesizedFeature("pitch_accent_detector")).equals("ACCENTED")) {
conf = 1 - conf;
}
word.setAttribute("hyp_pitch_accent", "ACCENTED: " + conf);
} else {
word.setAttribute("hyp_pitch_accent", word.getAttribute(autobi.getHypothesizedFeature(
"pitch_accent_detection")));
"pitch_accent_detector")));
}
}
if (word.hasAttribute(autobi.getHypothesizedFeature("pitch_accent_classification"))) {
if (word.hasAttribute(autobi.getHypothesizedFeature("pitch_accent_classifier"))) {
if (!word.hasAttribute("hyp_pitch_accent") || word.getAttribute("hyp_pitch_accent").equals("ACCENTED")) {
word.setAttribute("hyp_pitch_accent", word.getAttribute(autobi.getHypothesizedFeature(
"pitch_accent_classification")));
"pitch_accent_classifier")));
}
}

// Assigns phrase ending tones.
if (word.hasAttribute(autobi.getHypothesizedFeature("intonational_phrase_boundary_detection"))) {
if (word.hasAttribute(autobi.getConfidenceFeature("intonational_phrase_boundary_detection"))) {
if (word.hasAttribute(autobi.getHypothesizedFeature("intonational_phrase_boundary_detector"))) {
if (word.hasAttribute(autobi.getConfidenceFeature("intonational_phrase_boundary_detector"))) {
Double conf =
(Double) word.getAttribute(autobi.getConfidenceFeature("intonational_phrase_boundary_detection"));
if (!word.getAttribute(autobi.getHypothesizedFeature("intonational_phrase_boundary_detection"))
(Double) word.getAttribute(autobi.getConfidenceFeature("intonational_phrase_boundary_detector"));
if (!word.getAttribute(autobi.getHypothesizedFeature("intonational_phrase_boundary_detector"))
.equals("INTONATIONAL_BOUNDARY")) {
conf = 1 - conf;
}
word.setAttribute("hyp_phrase_boundary", "BOUNDARY: " + conf);
} else {
word.setAttribute("hyp_phrase_boundary",
word.getAttribute(autobi.getHypothesizedFeature("intonational_phrase_boundary_detection")));
word.getAttribute(autobi.getHypothesizedFeature("intonational_phrase_boundary_detector")));
}
}

if (word.hasAttribute(autobi.getHypothesizedFeature("intermediate_phrase_boundary_detection"))) {
if (word.hasAttribute(autobi.getHypothesizedFeature("intermediate_phrase_boundary_detector"))) {
if (!word.hasAttribute("hyp_phrase_boundary") ||
word.getAttribute("hyp_phrase_boundary").equals("NONBOUNDARY")) {
word.setAttribute("hyp_phrase_boundary",
word.getAttribute(autobi.getHypothesizedFeature("intermediate_phrase_boundary_detection")));
word.getAttribute(autobi.getHypothesizedFeature("intermediate_phrase_boundary_detector")));
}
}

if (word.hasAttribute(autobi.getHypothesizedFeature("boundary_tone_classification"))) {
if (word.hasAttribute(autobi.getHypothesizedFeature("phrase_accent_boundary_tone_classifier"))) {
if (!word.hasAttribute("hyp_phrase_boundary") ||
word.getAttribute("hyp_phrase_boundary").equals("INTONATIONAL_BOUNDARY")) {
word.setAttribute("hyp_phrase_boundary",
word.getAttribute(autobi.getHypothesizedFeature("boundary_tone_classification").replace("x", "%")));
word.getAttribute(autobi.getHypothesizedFeature("phrase_accent_boundary_tone_classifier").replace("x", "%")));
}
}

if (word.hasAttribute(autobi.getHypothesizedFeature("phrase_accent_classification"))) {
if (word.hasAttribute(autobi.getHypothesizedFeature("phrase_accent_classifier"))) {
if (!word.hasAttribute("hyp_phrase_boundary") ||
word.getAttribute("hyp_phrase_boundary").equals("INTERMEDIATE_BOUNDARY")) {
word.setAttribute("hyp_phrase_boundary",
word.getAttribute(autobi.getHypothesizedFeature("phrase_accent_classification")));
word.getAttribute(autobi.getHypothesizedFeature("phrase_accent_classifier")));
}
}
}
Expand All @@ -315,9 +315,9 @@ public static void mergeAuToBIHypotheses(AuToBI autobi, List<Word> words) throws
* <p/>
* pitch_accent_classifier
* <p/>
* intonational_phrase_detector
* intonational_phrase_boundary_detector
* <p/>
* intermediate_phrase_detector
* intermediate_phrase_boundary_detector
* <p/>
* phrase_accent_classifier
* <p/>
Expand Down Expand Up @@ -352,9 +352,9 @@ public static HashMap<String, AuToBITask> createTaskListFromParameters(AuToBIPar
map.put("phrase_accent_classifier",
getPhraseAccentClassificationTask(serialized ? params.getParameter("phrase_accent_classifier") : null));
}
if (params.hasParameter("boundary_tone_classifier")) {
map.put("boundary_tone_classifier", getPABTClassificationTask(
serialized ? params.getParameter("boundary_tone_classifier") : null));
if (params.hasParameter("phrase_accent_boundary_tone_classifier")) {
map.put("phrase_accent_boundary_tone_classifier", getPABTClassificationTask(
serialized ? params.getParameter("phrase_accent_boundary_tone_classifier") : null));
}

} catch (AuToBIException e) {
Expand Down
Loading

0 comments on commit 0d66898

Please sign in to comment.