ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keb...@apache.org
Subject svn commit: r1622784 - /ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/algorithms/FirstTokenPermutationImpl.java
Date Fri, 05 Sep 2014 20:18:22 GMT
Author: kebert
Date: Fri Sep  5 20:18:21 2014
New Revision: 1622784

URL: http://svn.apache.org/r1622784
Log:
CTAKES-310 fix to make it so all permutations are available and used.

Modified:
    ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/algorithms/FirstTokenPermutationImpl.java

Modified: ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/algorithms/FirstTokenPermutationImpl.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/algorithms/FirstTokenPermutationImpl.java?rev=1622784&r1=1622783&r2=1622784&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/algorithms/FirstTokenPermutationImpl.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup/src/main/java/org/apache/ctakes/dictionary/lookup/algorithms/FirstTokenPermutationImpl.java
Fri Sep  5 20:18:21 2014
@@ -210,11 +210,12 @@ public class FirstTokenPermutationImpl i
       final List<List<Integer>> permutationList = iv_permCacheMap.get( permutationIndex
);
       for ( List<Integer> permutations : permutationList ) {
          // Moved sort and offset calculation from inner (per MetaDataHit) iteration 2-21-2013
spf
-         Collections.sort( permutations );
+         List<Integer> permutationsSorted = (List) ((ArrayList)permutations).clone();
+         Collections.sort( permutationsSorted );
          int startOffset = firstWordStartOffset;
          int endOffset = firstWordEndOffset;
-         if ( !permutations.isEmpty() ) {
-            int firstIdx = permutations.get( 0 );
+         if ( !permutationsSorted.isEmpty() ) {
+            int firstIdx = permutationsSorted.get( 0 );
             if ( firstIdx <= firstTokenIndex ) {
                firstIdx--;
             }
@@ -222,7 +223,7 @@ public class FirstTokenPermutationImpl i
             if ( firstToken.getStartOffset() < firstWordStartOffset ) {
                startOffset = firstToken.getStartOffset();
             }
-            int lastIdx = permutations.get( permutations.size() - 1 );
+            int lastIdx = permutationsSorted.get( permutationsSorted.size() - 1 );
             if ( lastIdx <= firstTokenIndex ) {
                lastIdx--;
             }



Mime
View raw message