ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1599608 - /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/Utils.java
Date Tue, 03 Jun 2014 15:32:44 GMT
Author: dligach
Date: Tue Jun  3 15:32:43 2014
New Revision: 1599608

URL: http://svn.apache.org/r1599608
Log:
treating string-valued features in writeInstance as binary

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/Utils.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/Utils.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/Utils.java?rev=1599608&r1=1599607&r2=1599608&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/Utils.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/duration/Utils.java
Tue Jun  3 15:32:43 2014
@@ -416,9 +416,20 @@ public class Utils {
       if(feature.getName() == null || feature.getValue() == null) {
         continue;
       }
-      String name = feature.getName().replace(",", "COMMA").replace(":", "COLON");
-      String value = feature.getValue().toString().replace(",", "COMMA").replace(":", "COLON");
-      String nameValuePair = String.format(",%s:%s", name, value);
+      String name = feature.getName();
+      Object value = feature.getValue();
+      String nameValuePair;
+      if(value instanceof String) {
+        String cleanedUpName = name.replace(",", "COMMA").replace(":", "COLON").replace("\n",
"EOL");
+        String cleanedUpValue = value.toString().replace(",", "COMMA").replace(":", "COLON").replace("\n",
"EOL");
+        nameValuePair = String.format(",%s-%s:%s", cleanedUpName, cleanedUpValue, 1);
+      } else if(value instanceof Integer) {
+        String cleanedUpName = name.replace(",", "COMMA").replace(":", "COLON").replace("\n",
"EOL");
+        String cleanedUpValue = value.toString().replace(",", "COMMA").replace(":", "COLON").replace("\n",
"EOL");
+        nameValuePair = String.format(",%s:%s", cleanedUpName, cleanedUpValue);
+      } else {
+        continue;
+      }
       output.append(nameValuePair);
     }
     try {



Mime
View raw message