protected function index(array $chars)
    {
        $index = [];

        foreach ($chars as $key => $char) {
            if (preg_match('/[\p{Han}\w]+/u', $char)) {
                $index[] = $key;
            }
        }

        return $index;
    }
protected function index(array $chars)
    {
        $index = [];

        foreach ($chars as $key => $char) {
            if (preg_match('/[\p{Han}\w]+/u', $char)) {
                $index[] = $key;
            }
        }

        return $index;
    }
protected function index ( array $ chars ) { $ index = [ ] ; foreach ( $ chars as $ key => $ char ) { if ( preg_match ( '/[\p{Han}\w]+/u' , $ char ) ) { $ index [ ] = $ key ; } } return $ index ; }
Build words index.

@param array $chars

@return array
Build words index .