diff --git a/src/NlpTools/Models/Lda.php b/src/NlpTools/Models/Lda.php index bec01d2..af07d45 100644 --- a/src/NlpTools/Models/Lda.php +++ b/src/NlpTools/Models/Lda.php @@ -240,7 +240,11 @@ public function getDocumentsPerTopicsProbabilities($limit_docs=-1) $count_topics_docs = array(); foreach ($this->count_docs_topics as $doc=>$topics) { foreach ($topics as $t=>$c) - $count_topics_docs[$doc][$t]++; + try { + $count_topics_docs[$doc][$t]++; + } catch (\Exception $ex){ + $count_topics_docs[$doc][$t] = 1; + } } foreach ($p_t_d as $topic=>&$p) {