ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From james-mas...@apache.org
Subject svn commit: r1502253 - /ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cc/JudgeAttributeInstances.java
Date Thu, 11 Jul 2013 15:51:28 GMT
Author: james-masanz
Date: Thu Jul 11 15:51:28 2013
New Revision: 1502253

URL: http://svn.apache.org/r1502253
Log:
get even more context if user enters m again

Modified:
    ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cc/JudgeAttributeInstances.java

Modified: ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cc/JudgeAttributeInstances.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cc/JudgeAttributeInstances.java?rev=1502253&r1=1502252&r2=1502253&view=diff
==============================================================================
--- ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cc/JudgeAttributeInstances.java
(original)
+++ ctakes/trunk/ctakes-assertion/src/main/java/org/apache/ctakes/assertion/cc/JudgeAttributeInstances.java
Thu Jul 11 15:51:28 2013
@@ -99,6 +99,11 @@ public class JudgeAttributeInstances ext
 //	@ConfigurationParameter(mandatory = true, description = "takes a path to directory into
which output files will be written.")
 //	private String ignorableAttributesString;
 
+	
+	private static int DEFAULT_CONTEXT_LEN = 80;
+	private int currentContextLen = DEFAULT_CONTEXT_LEN; // start with default, increase if
asked for more context
+	
+	
 	/**
 	 * The name of the XMI XML scheme. This is a valid value for the parameter
 	 * {@value #PARAM_XML_SCHEME_NAME}
@@ -323,7 +328,7 @@ public class JudgeAttributeInstances ext
 	}
 	
 	private void printContext(String text, IdentifiedAnnotation mention) {
-		printContext(text,mention,80);
+		printContext(text,mention, DEFAULT_CONTEXT_LEN);
 	}
 	
 	static public String prompt (String attr) {
@@ -372,11 +377,13 @@ public class JudgeAttributeInstances ext
 			}
 			else if (response.toLowerCase().startsWith("s")) {
 				deletableMentions.add(mention); // now redundant, all are being deleted
+				currentContextLen = DEFAULT_CONTEXT_LEN; // reset context length to default after done
with this instance
 				return false;
 			}
 			else if (response.toLowerCase().startsWith("m")) {
 				// more context response
-				printContext(jCas.getDocumentText(),mention,160);
+				currentContextLen += DEFAULT_CONTEXT_LEN;
+				printContext(jCas.getDocumentText(), mention, currentContextLen);
 				response = prompt( msg.get(attr) + "=" + getAttrValueString(mention,attr));
 			}
 			else {
@@ -384,6 +391,8 @@ public class JudgeAttributeInstances ext
 						msg.get(attr) + "=" + getAttrValueString(mention,attr));
 			}
 		}
+		
+		currentContextLen = DEFAULT_CONTEXT_LEN; // reset context length to default after done
with this instance
 		return true;
 	}
 



Mime
View raw message