ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1688846 - /ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/tree/FragmentUtils.java
Date Thu, 02 Jul 2015 15:11:25 GMT
Author: tmill
Date: Thu Jul  2 15:11:24 2015
New Revision: 1688846

URL: http://svn.apache.org/r1688846
Log:
Check for case where there are no fragments.

Modified:
    ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/tree/FragmentUtils.java

Modified: ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/tree/FragmentUtils.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/tree/FragmentUtils.java?rev=1688846&r1=1688845&r2=1688846&view=diff
==============================================================================
--- ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/tree/FragmentUtils.java
(original)
+++ ctakes/trunk/ctakes-utils/src/main/java/org/apache/ctakes/utils/tree/FragmentUtils.java
Thu Jul  2 15:11:24 2015
@@ -23,6 +23,11 @@ public class FragmentUtils {
 	public static SimpleTree frag2tree(String frag){
 		char[] chars = frag.toCharArray();
 		int ind = frag.indexOf('(', 1);
+		if(ind < 0){
+		  ind = frag.indexOf(')', 1);
+		  // fragment is just a single token:
+		  return new SimpleTree(frag.substring(1,ind));
+		}
 		String type = frag.substring(1, ind);
 		SimpleTree root = new SimpleTree(type);
 		SimpleTree cur = root;



Mime
View raw message