public function getFeatureArray($class, DocumentInterface $d)
    {
        $features = array_filter(
            array_map( function ($feature) use ($class,$d) {
                    return call_user_func($feature, $class, $d);
                },
                $this->functions
            ));
        $set = array();
        foreach ($features as $f) {
            if (is_array($f)) {
                foreach ($f as $ff) {
                    if (!isset($set[$ff]))
                        $set[$ff] = 0;
                    $set[$ff]++;
                }
            } else {
                if (!isset($set[$f]))
                    $set[$f] = 0;
                $set[$f]++;
            }
        }
        if ($this->frequency)
            return $set;
        else
            return array_keys($set);
    }