devicemap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From re...@apache.org
Subject svn commit: r1693330 - /devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java
Date Wed, 29 Jul 2015 18:33:29 GMT
Author: rezan
Date: Wed Jul 29 18:33:29 2015
New Revision: 1693330

URL: http://svn.apache.org/r1693330
Log:
ngrams

Modified:
    devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java

Modified: devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java?rev=1693330&r1=1693329&r2=1693330&view=diff
==============================================================================
--- devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java (original)
+++ devicemap/trunk/clients/2.0/reference/src/DeviceMapClient.java Wed Jul 29 18:33:29 2015
@@ -281,6 +281,25 @@ public class DeviceMapClient {
     }
 
     Main.log("  Tokens: " + tokens);
+
+    List<String> ngrams = new ArrayList<String>();
+
+    for(int i = 0; i < tokens.size(); i++) {
+      String ngram = "";
+      List<String> ngramParts = new ArrayList<String>();
+
+      for(int size = ngramConcatSize; size > 0 && i + ngramConcatSize - size <
tokens.size(); size--) {
+        ngram += tokens.get(i + ngramConcatSize - size);
+
+        ngramParts.add(0, ngram);
+      }
+
+      ngrams.addAll(ngramParts);
+
+      ngramParts.clear();
+    }
+
+    Main.log("  Ngrams: " + ngrams);
     
     return "";
   }



Mime
View raw message