Skip to content

Commit 0d766be

Browse files
committed
Merge branch 'no_feature_labels'
2 parents dd42f0d + 2adf4d2 commit 0d766be

File tree

59 files changed

+164
-406
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+164
-406
lines changed

src/edu/jhu/thrax/hadoop/datatypes/FeatureMap.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void readFields(DataInput in) throws IOException {
6060
int key = 0;
6161
Writable val = null;
6262
key = WritableUtils.readVInt(in);
63-
if (key == Vocabulary.id(AnnotationPassthroughFeature.LABEL)) {
63+
if (key == Vocabulary.id(AnnotationPassthroughFeature.NAME)) {
6464
val = new Annotation();
6565
val.readFields(in);
6666
} else {
@@ -76,7 +76,7 @@ public void write(DataOutput out) throws IOException {
7676
WritableUtils.writeVInt(out, map.size());
7777
for (int key : map.keySet()) {
7878
WritableUtils.writeVInt(out, key);
79-
if (key == Vocabulary.id(AnnotationPassthroughFeature.LABEL)) {
79+
if (key == Vocabulary.id(AnnotationPassthroughFeature.NAME)) {
8080
((Annotation) this.get(key)).write(out);
8181
} else {
8282
((FloatWritable) this.get(key)).write(out);

src/edu/jhu/thrax/hadoop/features/AbstractnessFeature.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
public class AbstractnessFeature implements SimpleFeature {
1212

1313
public static final String NAME = "abstract";
14-
public static final String LABEL = "Abstract";
1514

1615
private static final IntWritable ZERO = new IntWritable(0);
1716
private static final IntWritable ONE = new IntWritable(1);
@@ -34,15 +33,11 @@ public String getName() {
3433
return NAME;
3534
}
3635

37-
public String getLabel() {
38-
return LABEL;
39-
}
40-
4136
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
42-
map.put(Vocabulary.id(LABEL), ONE);
37+
map.put(Vocabulary.id(NAME), ONE);
4338
}
4439

4540
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
46-
map.put(Vocabulary.id(LABEL), ONE);
41+
map.put(Vocabulary.id(NAME), ONE);
4742
}
4843
}

src/edu/jhu/thrax/hadoop/features/AdjacentNonTerminalsFeature.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
public class AdjacentNonTerminalsFeature implements SimpleFeature {
1212

1313
public static final String NAME = "adjacent";
14-
public static final String LABEL = "Adjacent";
1514

1615
private static final IntWritable ZERO = new IntWritable(0);
1716
private static final IntWritable ONE = new IntWritable(1);
@@ -33,15 +32,11 @@ public String getName() {
3332
return NAME;
3433
}
3534

36-
public String getLabel() {
37-
return LABEL;
38-
}
39-
4035
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
41-
map.put(Vocabulary.id(LABEL), ZERO);
36+
map.put(Vocabulary.id(NAME), ZERO);
4237
}
4338

4439
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
45-
map.put(Vocabulary.id(LABEL), ONE);
40+
map.put(Vocabulary.id(NAME), ONE);
4641
}
4742
}

src/edu/jhu/thrax/hadoop/features/CharacterCompressionRatioFeature.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public class CharacterCompressionRatioFeature implements SimpleFeature {
1212

1313
private static final FloatWritable ZERO = new FloatWritable(0f);
1414

15-
public static final String NAME = "char-cr";
16-
public static final String LABEL = "CharLogCR";
15+
public static final String NAME = "char_cr";
1716

1817
public Writable score(RuleWritable r) {
1918
int src_length = 0;
@@ -42,15 +41,11 @@ public String getName() {
4241
return NAME;
4342
}
4443

45-
public String getLabel() {
46-
return LABEL;
47-
}
48-
4944
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
50-
map.put(Vocabulary.id(LABEL), ZERO);
45+
map.put(Vocabulary.id(NAME), ZERO);
5146
}
5247

5348
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
54-
map.put(Vocabulary.id(LABEL), ZERO);
49+
map.put(Vocabulary.id(NAME), ZERO);
5550
}
5651
}

src/edu/jhu/thrax/hadoop/features/CharacterCountDifferenceFeature.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public class CharacterCountDifferenceFeature implements SimpleFeature {
1212

1313
private static final IntWritable ZERO = new IntWritable(0);
1414

15-
public static final String NAME = "char-count-difference";
16-
public static final String LABEL = "CharCountDiff";
15+
public static final String NAME = "char_count_difference";
1716

1817
public Writable score(RuleWritable r) {
1918
int char_difference = 0;
@@ -37,15 +36,11 @@ public String getName() {
3736
return NAME;
3837
}
3938

40-
public String getLabel() {
41-
return LABEL;
42-
}
43-
4439
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
45-
map.put(Vocabulary.id(LABEL), ZERO);
40+
map.put(Vocabulary.id(NAME), ZERO);
4641
}
4742

4843
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
49-
map.put(Vocabulary.id(LABEL), ZERO);
44+
map.put(Vocabulary.id(NAME), ZERO);
5045
}
5146
}

src/edu/jhu/thrax/hadoop/features/ConsumeSourceTerminalsFeature.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
public class ConsumeSourceTerminalsFeature implements SimpleFeature {
1212

13-
public static final String NAME = "source-terminals-without-target";
14-
public static final String LABEL = "SourceTerminalsButNoTarget";
13+
public static final String NAME = "source_terminals_without_target";
1514

1615
private static final IntWritable ZERO = new IntWritable(0);
1716
private static final IntWritable ONE = new IntWritable(1);
@@ -34,15 +33,11 @@ public String getName() {
3433
return NAME;
3534
}
3635

37-
public String getLabel() {
38-
return LABEL;
39-
}
40-
4136
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
42-
map.put(Vocabulary.id(LABEL), ZERO);
37+
map.put(Vocabulary.id(NAME), ZERO);
4338
}
4439

4540
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
46-
map.put(Vocabulary.id(LABEL), ZERO);
41+
map.put(Vocabulary.id(NAME), ZERO);
4742
}
4843
}

src/edu/jhu/thrax/hadoop/features/Feature.java

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ public interface Feature {
88

99
public String getName();
1010

11-
public String getLabel();
12-
1311
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map);
1412

1513
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map);

src/edu/jhu/thrax/hadoop/features/GlueRuleFeature.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
public class GlueRuleFeature implements SimpleFeature {
1212

13-
public static final String NAME = "glue-rule";
14-
public static final String LABEL = "GlueRule";
13+
public static final String NAME = "glue_rule";
1514

1615
private static final IntWritable ZERO = new IntWritable(0);
1716
private static final IntWritable ONE = new IntWritable(1);
@@ -24,15 +23,11 @@ public String getName() {
2423
return NAME;
2524
}
2625

27-
public String getLabel() {
28-
return LABEL;
29-
}
30-
3126
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
32-
map.put(Vocabulary.id(LABEL), ONE);
27+
map.put(Vocabulary.id(NAME), ONE);
3328
}
3429

3530
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
36-
map.put(Vocabulary.id(LABEL), ONE);
31+
map.put(Vocabulary.id(NAME), ONE);
3732
}
3833
}

src/edu/jhu/thrax/hadoop/features/IdentityFeature.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
public class IdentityFeature implements SimpleFeature {
1313

1414
public static final String NAME = "identity";
15-
public static final String LABEL = "Identity";
1615

1716
private static final IntWritable ZERO = new IntWritable(0);
1817
private static final IntWritable ONE = new IntWritable(1);
@@ -28,15 +27,11 @@ public String getName() {
2827
return NAME;
2928
}
3029

31-
public String getLabel() {
32-
return LABEL;
33-
}
34-
3530
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
36-
map.put(Vocabulary.id(LABEL), ZERO);
31+
map.put(Vocabulary.id(NAME), ZERO);
3732
}
3833

3934
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
40-
map.put(Vocabulary.id(LABEL), ZERO);
35+
map.put(Vocabulary.id(NAME), ZERO);
4136
}
4237
}

src/edu/jhu/thrax/hadoop/features/LexicalityFeature.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
public class LexicalityFeature implements SimpleFeature {
1212

1313
public static final String NAME = "lexical";
14-
public static final String LABEL = "Lexical";
1514

1615
private static final IntWritable ZERO = new IntWritable(0);
1716
private static final IntWritable ONE = new IntWritable(1);
@@ -28,15 +27,11 @@ public String getName() {
2827
return NAME;
2928
}
3029

31-
public String getLabel() {
32-
return LABEL;
33-
}
34-
3530
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
36-
map.put(Vocabulary.id(LABEL), ZERO);
31+
map.put(Vocabulary.id(NAME), ZERO);
3732
}
3833

3934
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
40-
map.put(Vocabulary.id(LABEL), ZERO);
35+
map.put(Vocabulary.id(NAME), ZERO);
4136
}
4237
}

src/edu/jhu/thrax/hadoop/features/MonotonicFeature.java

+2-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
public class MonotonicFeature implements SimpleFeature {
1212

1313
public static final String NAME = "monotonic";
14-
public static final String LABEL = "Monotonic";
1514

1615
private static final IntWritable ZERO = new IntWritable(0);
1716
private static final IntWritable ONE = new IntWritable(1);
@@ -24,15 +23,11 @@ public String getName() {
2423
return NAME;
2524
}
2625

27-
public String getLabel() {
28-
return LABEL;
29-
}
30-
3126
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
32-
map.put(Vocabulary.id(LABEL), ONE);
27+
map.put(Vocabulary.id(NAME), ONE);
3328
}
3429

3530
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
36-
map.put(Vocabulary.id(LABEL), ONE);
31+
map.put(Vocabulary.id(NAME), ONE);
3732
}
3833
}

src/edu/jhu/thrax/hadoop/features/PhrasePenaltyFeature.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
public class PhrasePenaltyFeature implements SimpleFeature {
1212

13-
public static final String NAME = "phrase-penalty";
14-
public static final String LABEL = "PhrasePenalty";
13+
public static final String NAME = "phrase_penalty";
1514

1615
private static final IntWritable ONE = new IntWritable(1);
1716

@@ -23,15 +22,11 @@ public String getName() {
2322
return NAME;
2423
}
2524

26-
public String getLabel() {
27-
return LABEL;
28-
}
29-
3025
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
31-
map.put(Vocabulary.id(LABEL), ONE);
26+
map.put(Vocabulary.id(NAME), ONE);
3227
}
3328

3429
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
35-
map.put(Vocabulary.id(LABEL), ONE);
30+
map.put(Vocabulary.id(NAME), ONE);
3631
}
3732
}

src/edu/jhu/thrax/hadoop/features/ProduceTargetTerminalsFeature.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
public class ProduceTargetTerminalsFeature implements SimpleFeature {
1212

13-
public static final String NAME = "target-terminals-without-source";
14-
public static final String LABEL = "TargetTerminalsButNoSource";
13+
public static final String NAME = "target_terminals_without_source";
1514

1615
private static final IntWritable ZERO = new IntWritable(0);
1716
private static final IntWritable ONE = new IntWritable(1);
@@ -28,15 +27,11 @@ public String getName() {
2827
return NAME;
2928
}
3029

31-
public String getLabel() {
32-
return LABEL;
33-
}
34-
3530
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
36-
map.put(Vocabulary.id(LABEL), ZERO);
31+
map.put(Vocabulary.id(NAME), ZERO);
3732
}
3833

3934
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
40-
map.put(Vocabulary.id(LABEL), ZERO);
35+
map.put(Vocabulary.id(NAME), ZERO);
4136
}
4237
}

src/edu/jhu/thrax/hadoop/features/SourceWordCounterFeature.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
public class SourceWordCounterFeature implements SimpleFeature {
1212

13-
public static final String NAME = "source-word-count";
14-
private static final String LABEL = "SourceWords";
13+
public static final String NAME = "source_word_count";
1514

1615
private static final IntWritable ZERO = new IntWritable(0);
1716

@@ -26,15 +25,11 @@ public String getName() {
2625
return NAME;
2726
}
2827

29-
public String getLabel() {
30-
return LABEL;
31-
}
32-
3328
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
34-
map.put(Vocabulary.id(LABEL), ZERO);
29+
map.put(Vocabulary.id(NAME), ZERO);
3530
}
3631

3732
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
38-
map.put(Vocabulary.id(LABEL), ZERO);
33+
map.put(Vocabulary.id(NAME), ZERO);
3934
}
4035
}

src/edu/jhu/thrax/hadoop/features/TargetWordCounterFeature.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
public class TargetWordCounterFeature implements SimpleFeature {
1212

13-
public static final String NAME = "target-word-count";
14-
public static final String LABEL = "TargetWords";
13+
public static final String NAME = "target_word_count";
1514

1615
private static final IntWritable ZERO = new IntWritable(0);
1716

@@ -26,15 +25,11 @@ public String getName() {
2625
return NAME;
2726
}
2827

29-
public String getLabel() {
30-
return LABEL;
31-
}
32-
3328
public void unaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
34-
map.put(Vocabulary.id(LABEL), ZERO);
29+
map.put(Vocabulary.id(NAME), ZERO);
3530
}
3631

3732
public void binaryGlueRuleScore(int nt, Map<Integer, Writable> map) {
38-
map.put(Vocabulary.id(LABEL), ZERO);
33+
map.put(Vocabulary.id(NAME), ZERO);
3934
}
4035
}

0 commit comments

Comments
 (0)