File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
src/edu/stanford/nlp/trees/ud Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change 15
15
* which is necessary for the CoNLLU format
16
16
*/
17
17
public class CoNLLUFeatures extends TreeMap <String , String > {
18
+ public static class LowercaseComparator implements Comparator <String > {
19
+ public int compare (String x , String y ) {
20
+ if (x == null && y == null ) {
21
+ return 0 ;
22
+ }
23
+ if (x == null ) {
24
+ return -1 ;
25
+ }
26
+ if (y == null ) {
27
+ return 1 ;
28
+ }
29
+ return x .compareToIgnoreCase (y );
30
+ }
31
+ }
32
+
33
+ static final LowercaseComparator comparator = new LowercaseComparator ();
34
+
18
35
/**
19
36
* Parses the value of the feature column in a CoNLL-U file
20
37
* and returns them in a HashMap with the feature names as keys
@@ -24,7 +41,7 @@ public class CoNLLUFeatures extends TreeMap<String, String> {
24
41
* @return A {@code HashMap<String,String>} with the feature values.
25
42
*/
26
43
public CoNLLUFeatures (String featureString ) {
27
- super ();
44
+ super (comparator );
28
45
29
46
if (!featureString .equals ("_" )) {
30
47
String [] featValPairs = featureString .split ("\\ |" );
@@ -36,11 +53,12 @@ public CoNLLUFeatures(String featureString) {
36
53
}
37
54
38
55
public CoNLLUFeatures (Map <String , String > features ) {
39
- super (features );
56
+ super (comparator );
57
+ putAll (features );
40
58
}
41
59
42
60
public CoNLLUFeatures () {
43
- super ();
61
+ super (comparator );
44
62
}
45
63
46
64
You can’t perform that action at this time.
0 commit comments