* Simple string hash function
(str: string)
| 209 | * Simple string hash function |
| 210 | */ |
| 211 | function simpleHash(str: string): number { |
| 212 | let hash = 0; |
| 213 | for (let i = 0; i < str.length; i++) { |
| 214 | hash = (hash << 5) - hash + str.charCodeAt(i); |
| 215 | hash = hash & hash; // Convert to 32bit integer |
| 216 | } |
| 217 | return Math.abs(hash); |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * Common English words to filter out |