protected function toArray(array $stopWords) 
    {
        $data = [];
        foreach($stopWords as $key => $value)
        {
            $data[] = ['token' => utf8_encode($key), 'freq' => $value];
        }
        return $data;
    }
protected function toArray(array $stopWords) 
    {
        $data = [];
        foreach($stopWords as $key => $value)
        {
            $data[] = ['token' => utf8_encode($key), 'freq' => $value];
        }
        return $data;
    }
protected function toArray ( array $ stopWords ) { $ data = [ ] ; foreach ( $ stopWords as $ key => $ value ) { $ data [ ] = [ 'token' => utf8_encode ( $ key ) , 'freq' => $ value ] ; } return $ data ; }
So you can easily serialize the data to json
@return array
So you can easily serialize the data to json