From 5612a145d4e195d67e7e69307168ee57b5af072a Mon Sep 17 00:00:00 2001 From: Ignacio Colautti Date: Tue, 6 Nov 2018 17:18:42 -0300 Subject: [PATCH] Adding setters to TermExtractor --- src/TermExtractor/TermExtractor.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/TermExtractor/TermExtractor.php b/src/TermExtractor/TermExtractor.php index 889c426..cc97835 100644 --- a/src/TermExtractor/TermExtractor.php +++ b/src/TermExtractor/TermExtractor.php @@ -30,16 +30,24 @@ class TermExtractor { const SEARCH = 0; const NOUN = 1; - public $tagger; - public $filter; + protected $tagger; + protected $filter; public function __construct(Tagger $tagger = null, FilterInterface $filter = null) { + $this->setTagger($tagger); + $this->setFilter($filter); + } + + public function setTagger(Tagger $tagger = null) { if ($tagger === null) { $this->tagger = new Tagger(); $this->tagger->initialize(); } else { $this->tagger = $tagger; } + } + + public function setFilter(FilterInterface $filter = null) { if ($filter === null) { $this->filter = new DefaultFilter(); } else {