File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/edu/stanford/nlp/semgraph/semgrex Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,12 @@ public static CoreNLPProtos.SemgrexResponse processRequest(CoreNLPProtos.Semgrex
8888 for (CoreNLPProtos .SemgrexRequest .Dependencies sentence : request .getQueryList ()) {
8989 CoreNLPProtos .SemgrexResponse .GraphResult .Builder graphResultBuilder = CoreNLPProtos .SemgrexResponse .GraphResult .newBuilder ();
9090
91- List <CoreLabel > tokens = sentence .getTokenList ().stream ().map (serializer ::fromProto ).collect (Collectors .toList ());
91+ final List <CoreLabel > tokens ;
92+ if (sentence .getGraph ().getTokenList ().size () > 0 ) {
93+ tokens = sentence .getGraph ().getTokenList ().stream ().map (serializer ::fromProto ).collect (Collectors .toList ());
94+ } else {
95+ tokens = sentence .getTokenList ().stream ().map (serializer ::fromProto ).collect (Collectors .toList ());
96+ }
9297 SemanticGraph graph = ProtobufAnnotationSerializer .fromProto (sentence .getGraph (), tokens , "semgrex" );
9398 int patternIdx = 0 ;
9499 for (SemgrexPattern pattern : patterns ) {
You can’t perform that action at this time.
0 commit comments