Got it working. Even though it has to build the wordGraph it's still pretty quick! Faster than the ruby or haskell versions that built the wordGraph too.