title: How to split Strings into all possible n-grams / all possible 6-grams
body: <p>Ok, here is my input</p>
  
  <p><strong>ProductName</strong></p>
  
  <p>Machinery</p>
  
  <p>Machinery, big</p>
  
  <p>Farming Machinery</p>
  
  <p>Applejuice</p>
  
  <p>Juice Machines</p>
  
  <p>Software Development</p>
  
  <p>Business Development</p>
  
  <p>Software Licensing</p>
  
  <p>Eggs</p>
  
  <p>...</p>
  
  <p>Productname can be any String with varying lengths - Min(Length()) actually is 3, but assume Max(Length()) can be anything from 15 to 50(?).</p>
  
  <p>What i need is</p>
  
  <p>a) Extract every possible 6-gram from the Source List above (Save it somewhere?)
  b) See how often each of these 6-grams can be found in the Source List</p>
  
  <p>a)
  "Machin"
  "achine"
  "chiner"
  "hinery"
  "inery,"
  "nery, "
  "ery, B"
  "ry, Bi"
  ...
  "icensi"
  "censin"
  "ensing"
  "Eggs"</p>
  
  <p>b)
  Basically, SELECT &lt;6-gram> AS gram, COUNT(*) FROM products WHERE productname like '%&lt;6-gram>%'
  (Or maybe with a JOIN, if grams are stored in a different table)</p>
  
  <p>I can do it using a TJava Component and a GlobalVar Set Object (kinda as seen here: <a href="http://bekwam.blogspot.de/2012/08/iterating-over-java-collection-with.html" rel="nofollow">http://bekwam.blogspot.de/2012/08/iterating-over-java-collection-with.html</a>), putting one String at a time into the TJava Component and making a Set of all possible 6-grams, which can be processed afterwards. (Set, because i dont need duplicates)</p>
  
  <p>Is there an easier, better way to do this? Preferably without TJava Component? I use Talend Open Studio for Data Integration 99% of the time, maybe other components can do this?
  If there is no better way to do this, how can i re-use the code in other Jobs &amp; Projects / make it more dynamic by allowing to chose 4-gram, 5-gram, n-gram.</p>
  
  <p>First Question put up here, so forgive me if its not specific enough / bad English / not precise enough. Criticism welcome</p>
  
  <p>SELECT Greetings FROM Germany
  Stefan</p>