1: <?php
2: 3: 4: 5: 6: 7:
8:
9: namespace Sastrawi\Stemmer\Context\Visitor;
10:
11: use Sastrawi\Morphology\Disambiguator;
12:
13: class VisitorProvider
14: {
15: protected $visitors = array();
16:
17: protected $suffixVisitors = array();
18:
19: protected $prefixVisitors = array();
20:
21: public function __construct()
22: {
23: $this->initVisitors();
24: }
25:
26: protected function initVisitors()
27: {
28: $this->visitors[] = new DontStemShortWord();
29:
30: $this->suffixVisitors[] = new RemoveInflectionalParticle();
31: $this->suffixVisitors[] = new RemoveInflectionalPossessivePronoun();
32: $this->suffixVisitors[] = new RemoveDerivationalSuffix();
33:
34: $this->prefixVisitors[] = new RemovePlainPrefix();
35: $this->prefixVisitors[] = new PrefixDisambiguator(
36: array(
37: new Disambiguator\DisambiguatorPrefixRule1a(),
38: new Disambiguator\DisambiguatorPrefixRule1b(),
39: )
40: );
41: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule2()));
42: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule3()));
43: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule4()));
44: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule5()));
45: $this->prefixVisitors[] = new PrefixDisambiguator(
46: array(
47: new Disambiguator\DisambiguatorPrefixRule6a(),
48: new Disambiguator\DisambiguatorPrefixRule6b(),
49: )
50: );
51:
52: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule7()));
53: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule8()));
54: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule9()));
55: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule10()));
56: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule11()));
57: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule12()));
58: $this->prefixVisitors[] = new PrefixDisambiguator(
59: array(
60: new Disambiguator\DisambiguatorPrefixRule13a(),
61: new Disambiguator\DisambiguatorPrefixRule13b(),
62: )
63: );
64:
65: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule14()));
66: $this->prefixVisitors[] = new PrefixDisambiguator(
67: array(
68: new Disambiguator\DisambiguatorPrefixRule15a(),
69: new Disambiguator\DisambiguatorPrefixRule15b(),
70: )
71: );
72: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule16()));
73:
74: $this->prefixVisitors[] = new PrefixDisambiguator(
75: array(
76: new Disambiguator\DisambiguatorPrefixRule17a(),
77: new Disambiguator\DisambiguatorPrefixRule17b(),
78: new Disambiguator\DisambiguatorPrefixRule17c(),
79: )
80: );
81:
82: $this->prefixVisitors[] = new PrefixDisambiguator(
83: array(
84: new Disambiguator\DisambiguatorPrefixRule18a(),
85: new Disambiguator\DisambiguatorPrefixRule18b(),
86: )
87: );
88: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule19()));
89: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule20()));
90: $this->prefixVisitors[] = new PrefixDisambiguator(
91: array(
92: new Disambiguator\DisambiguatorPrefixRule21a(),
93: new Disambiguator\DisambiguatorPrefixRule21b(),
94: )
95: );
96: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule23()));
97: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule24()));
98: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule25()));
99:
100: $this->prefixVisitors[] = new PrefixDisambiguator(
101: array(
102: new Disambiguator\DisambiguatorPrefixRule26a(),
103: new Disambiguator\DisambiguatorPrefixRule26b(),
104: )
105: );
106:
107: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule27()));
108:
109: $this->prefixVisitors[] = new PrefixDisambiguator(
110: array(
111: new Disambiguator\DisambiguatorPrefixRule28a(),
112: new Disambiguator\DisambiguatorPrefixRule28b(),
113: )
114: );
115:
116: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule29()));
117:
118: $this->prefixVisitors[] = new PrefixDisambiguator(
119: array(
120: new Disambiguator\DisambiguatorPrefixRule30a(),
121: new Disambiguator\DisambiguatorPrefixRule30b(),
122: new Disambiguator\DisambiguatorPrefixRule30c(),
123: )
124: );
125:
126: $this->prefixVisitors[] = new PrefixDisambiguator(
127: array(
128: new Disambiguator\DisambiguatorPrefixRule31a(),
129: new Disambiguator\DisambiguatorPrefixRule31b(),
130: )
131: );
132: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule32()));
133: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule34()));
134:
135:
136: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule35()));
137: $this->prefixVisitors[] = new PrefixDisambiguator(array(new Disambiguator\DisambiguatorPrefixRule36()));
138:
139:
140: $this->prefixVisitors[] = new PrefixDisambiguator(
141: array(
142: new Disambiguator\DisambiguatorPrefixRule37a(),
143: new Disambiguator\DisambiguatorPrefixRule37b(),
144: )
145: );
146:
147: $this->prefixVisitors[] = new PrefixDisambiguator(
148: array(
149: new Disambiguator\DisambiguatorPrefixRule38a(),
150: new Disambiguator\DisambiguatorPrefixRule38b(),
151: )
152: );
153:
154: $this->prefixVisitors[] = new PrefixDisambiguator(
155: array(
156: new Disambiguator\DisambiguatorPrefixRule39a(),
157: new Disambiguator\DisambiguatorPrefixRule39b(),
158: )
159: );
160:
161: $this->prefixVisitors[] = new PrefixDisambiguator(
162: array(
163: new Disambiguator\DisambiguatorPrefixRule40a(),
164: new Disambiguator\DisambiguatorPrefixRule40b(),
165: )
166: );
167: }
168:
169: public function getVisitors()
170: {
171: return $this->visitors;
172: }
173:
174: public function getSuffixVisitors()
175: {
176: return $this->suffixVisitors;
177: }
178:
179: public function getPrefixVisitors()
180: {
181: return $this->prefixVisitors;
182: }
183: }
184: