src/Dictionary/Dictionary.php
public function getPatternsForWord($word)
    {
        $return = array();
        $word = '.' . $word . '.';
        $strlen = mb_strlen($word);
        for ($i = 0; $i <= $strlen; $i ++) {
            for ($j = 2; $j <= ($strlen-$i); $j++) {
                $substr = mb_substr($word, $i, $j);
                if (! isset($this->dictionary[$substr])) {
                    continue;
                }
                $return[$substr] = $this->dictionary[$substr];
            }
        }

        return $return;
    }
public function getPatternsForWord($word)
    {
        $return = array();
        $word = '.' . $word . '.';
        $strlen = mb_strlen($word);
        for ($i = 0; $i <= $strlen; $i ++) {
            for ($j = 2; $j <= ($strlen-$i); $j++) {
                $substr = mb_substr($word, $i, $j);
                if (! isset($this->dictionary[$substr])) {
                    continue;
                }
                $return[$substr] = $this->dictionary[$substr];
            }
        }

        return $return;
    }
Get all patterns for a given word.

@param string $word The word to get the patterns for.

@return array