2
2
3
3
import edu .stanford .nlp .ling .AnnotationLookup ;
4
4
import edu .stanford .nlp .ling .CoreAnnotation ;
5
+ import edu .stanford .nlp .semgraph .SemanticGraphFactory ;
5
6
import edu .stanford .nlp .trees .TreePrint ;
6
7
import edu .stanford .nlp .util .PropertiesUtils ;
7
8
@@ -38,6 +39,8 @@ public abstract class AnnotationOutputter {
38
39
39
40
private static final Options DEFAULT_OPTIONS = new Options (); // IMPORTANT: must come after DEFAULT_CONSTITUENCY_TREE_PRINTER
40
41
42
+ /** Some outputters output all of the SemanticGraphs. Others may just output one */
43
+ private static final SemanticGraphFactory .Mode DEFAULT_SEMANTIC_GRAPH = SemanticGraphFactory .Mode .ENHANCED_PLUS_PLUS ;
41
44
42
45
public static class Options {
43
46
@@ -66,7 +69,8 @@ public static class Options {
66
69
/** Print some fake dependency info in the CoNLL output.
67
70
Useful for the original conll eval script, for example */
68
71
public final boolean printFakeDeps ;
69
-
72
+ /** Which graph to output if we only output one */
73
+ public final SemanticGraphFactory .Mode semanticGraphMode ;
70
74
71
75
public Options () {
72
76
// this creates the default options object
@@ -84,6 +88,7 @@ public Options(boolean pretty) {
84
88
relationsBeam = 0.0 ;
85
89
keysToPrint = getKeysToPrint (DEFAULT_KEYS );
86
90
printFakeDeps = false ;
91
+ semanticGraphMode = DEFAULT_SEMANTIC_GRAPH ;
87
92
}
88
93
89
94
public Options (Properties properties ) {
@@ -99,6 +104,12 @@ public Options(Properties properties) {
99
104
relationsBeam = PropertiesUtils .getDouble (properties , "output.relation.beam" , 0.0 );
100
105
keysToPrint = getKeysToPrint (properties .getProperty ("output.columns" , DEFAULT_KEYS ));
101
106
printFakeDeps = PropertiesUtils .getBool (properties , "output.printFakeDeps" , false );
107
+ String graphMode = properties .getProperty ("output.dependencyType" , null );
108
+ if (graphMode == null ) {
109
+ semanticGraphMode = DEFAULT_SEMANTIC_GRAPH ;
110
+ } else {
111
+ semanticGraphMode = SemanticGraphFactory .Mode .valueOf (graphMode .toUpperCase ());
112
+ }
102
113
}
103
114
104
115
private static List <Class <? extends CoreAnnotation <?>>> getKeysToPrint (String columns ) {
0 commit comments