protected function prepareDocument($document, SVMModel $model)
    {
        $tokenMap = $model->getTokenMap();

        $data = array();

        if ($this->documentNormalizer) {
            $document = $this->documentNormalizer->normalize($document);
        }

        $tokens = $this->tokenizer->tokenize($document);

        if ($this->tokenNormalizer) {
            $tokens = $this->tokenNormalizer->normalize($tokens);
        }

        $tokenCounts = array_count_values($tokens);

        foreach ($tokenCounts as $token => $value) {
            if (isset($tokenMap[$token])) {
                $data[$tokenMap[$token]] = $value;
            }
        }

        ksort($data, SORT_NUMERIC);

        return $data;
    }
protected function prepareDocument($document, SVMModel $model)
    {
        $tokenMap = $model->getTokenMap();

        $data = array();

        if ($this->documentNormalizer) {
            $document = $this->documentNormalizer->normalize($document);
        }

        $tokens = $this->tokenizer->tokenize($document);

        if ($this->tokenNormalizer) {
            $tokens = $this->tokenNormalizer->normalize($tokens);
        }

        $tokenCounts = array_count_values($tokens);

        foreach ($tokenCounts as $token => $value) {
            if (isset($tokenMap[$token])) {
                $data[$tokenMap[$token]] = $value;
            }
        }

        ksort($data, SORT_NUMERIC);

        return $data;
    }
protected function prepareDocument ( $ document , SVMModel $ model ) { $ tokenMap = $ model -> getTokenMap ( ) ; $ data = array ( ) ; if ( $ this -> documentNormalizer ) { $ document = $ this -> documentNormalizer -> normalize ( $ document ) ; } $ tokens = $ this -> tokenizer -> tokenize ( $ document ) ; if ( $ this -> tokenNormalizer ) { $ tokens = $ this -> tokenNormalizer -> normalize ( $ tokens ) ; } $ tokenCounts = array_count_values ( $ tokens ) ; foreach ( $ tokenCounts as $ token => $ value ) { if ( isset ( $ tokenMap [ $ token ] ) ) { $ data [ $ tokenMap [ $ token ] ] = $ value ; } } ksort ( $ data , SORT_NUMERIC ) ; return $ data ; }
Formats the document for use in \SVMModel
@param  string                                          $document
@param  \Camspiers\StatisticalClassifier\Model\SVMModel $model
@return array
Formats the document for use in \ SVMModel