Skip to content

Commit a2b4833

Browse files
committed
now outputs counts if 'count' feature requested
1 parent 9344395 commit a2b4833

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

example/counts/thrax-phrase.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ phrase-penalty 2.718
5454
# in this example, the features are phrase translation probability,
5555
# lexical probability, and phrase penalty
5656
# features phrase-penalty e2fphrase f2ephrase lexprob lexical abstract adjacent x-rule source-terminals-without-target target-terminals-without-source monotonic glue-rule rarity target-word-count unaligned-count
57-
features e_given_f_phrase f_given_e_phrase e_given_f_lex f_given_e_lex rarity phrase-penalty alignment counts
57+
features e_given_f_phrase f_given_e_phrase e_given_f_lex f_given_e_lex rarity phrase-penalty alignment count
5858

5959
# the only option and default later we will want to add formats for other decoders such as moses and
6060
# cdec, if they use other formats

src/edu/jhu/thrax/util/FormatUtils.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public static Text ruleToText(RuleWritable r, Map<String, Writable> fs, boolean
126126

127127
sb.append(DELIM);
128128
for (String t : fs.keySet()) {
129-
System.err.println("WRITING FEATURE: " + t);
130129
String score;
131130
Writable val = fs.get(t);
132131
if (t.equals("Count")) {
@@ -159,10 +158,11 @@ public static Text ruleToText(RuleWritable r, Map<String, Writable> fs, boolean
159158
sb.append(DELIMITER + " ").append(alignment + " ");
160159

161160
if (! ruleCount.equals("")) {
161+
// If there was no alignment, output a blank
162162
if (alignment == null)
163163
sb.append(DELIMITER + " ");
164164

165-
sb.append(DELIMITER + " ").append(ruleCount);
165+
sb.append(DELIMITER + " ").append(ruleCount).append(" ");
166166
}
167167
return new Text(sb.substring(0, sb.length() - 1));
168168
}

0 commit comments

Comments
 (0)