angeloskath / php-nlp-tools

Natural Language Processing Tools in PHP
Do What The F*ck You Want To Public License
743 stars 152 forks source link

error while much array #53

Closed MisterFredy closed 6 years ago

MisterFredy commented 6 years ago

im sorry my english is bad.but i found error while i give more array input to hierarchi cluster

  $clusters = range(0,count($documents)-1);
        $c = count($clusters);
        while ($c>1) {
            // ask the strategy which to merge. The strategy
            // will assume that we will indeed merge the returned clusters
            list($i,$j) = $this->strategy->getNextMerge();
            $clusters[$i] = array($clusters[$i],$clusters[$j]);
            unset($clusters[$j]);
            $c--;
        }
        $clusters = array($clusters[$i]);

my error stack is Undefined variable: i maybe you can fix this :)

angeloskath commented 6 years ago

Judging from your snippet you are using the MergeStrategyInterface directly. I would suggest you use the Hierarchical clusterer. You can also find a small example in the docs.

If you want more specific help please add a runnable code snippet to reproduce the error.

Thanks, Angelos