public function train_with_context(array &$train_ctx, FeatureFactoryInterface $ff, TrainingSet $tset, $a_smoothing=1)
    {
        $this->countTrainingSet(
                                $ff,
                                $tset,
                                $train_ctx['termcount_per_class'],
                                $train_ctx['termcount'],
                                $train_ctx['ndocs_per_class'],
                                $train_ctx['voc'],
                                $train_ctx['ndocs']
                            );

        $voccount = count($train_ctx['voc']);

        $this->computeProbabilitiesFromCounts(
                                    $tset->getClassSet(),
                                    $train_ctx['termcount_per_class'],
                                    $train_ctx['termcount'],
                                    $train_ctx['ndocs_per_class'],
                                    $train_ctx['ndocs'],
                                    $voccount,
                                    $a_smoothing
                                );

        return $train_ctx;
    }