1 | <?php |
||
13 | class Phrase extends AbstractSuggest |
||
14 | { |
||
15 | public const DEFAULT_REAL_WORD_ERROR_LIKELIHOOD = 0.95; |
||
16 | public const DEFAULT_CONFIDENCE = 1.0; |
||
17 | public const DEFAULT_MAX_ERRORS = 1.0; |
||
18 | public const DEFAULT_STUPID_BACKOFF_DISCOUNT = 0.4; |
||
19 | public const DEFAULT_LAPLACE_SMOOTHING_ALPHA = 0.5; |
||
20 | |||
21 | /** |
||
22 | * @return $this |
||
23 | */ |
||
24 | public function setAnalyzer(string $analyzer): Phrase |
||
28 | |||
29 | /** |
||
30 | * Set the max size of the n-grams (shingles) in the field. |
||
31 | * |
||
32 | * @return $this |
||
33 | */ |
||
34 | public function setGramSize(int $size): Phrase |
||
38 | |||
39 | /** |
||
40 | * Set the likelihood of a term being misspelled even if the term exists in the dictionary. |
||
41 | * |
||
42 | * @param float $likelihood Defaults to 0.95, meaning 5% of the words are misspelled. |
||
43 | * |
||
44 | * @return $this |
||
45 | */ |
||
46 | public function setRealWordErrorLikelihood(float $likelihood): Phrase |
||
50 | |||
51 | /** |
||
52 | * Set the factor applied to the input phrases score to be used as a threshold for other suggestion candidates. |
||
53 | * Only candidates which score higher than this threshold will be included in the result. |
||
54 | * |
||
55 | * @param float $confidence Defaults to 1.0. |
||
56 | * |
||
57 | * @return $this |
||
58 | */ |
||
59 | public function setConfidence(float $confidence): Phrase |
||
63 | |||
64 | /** |
||
65 | * Set the maximum percentage of the terms considered to be misspellings in order to form a correction. |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function setMaxErrors(float $max): Phrase |
||
73 | |||
74 | /** |
||
75 | * @return $this |
||
76 | */ |
||
77 | public function setSeparator(string $separator): Phrase |
||
81 | |||
82 | /** |
||
83 | * Set suggestion highlighting. |
||
84 | * |
||
85 | * @return $this |
||
86 | */ |
||
87 | public function setHighlight(string $preTag, string $postTag): Phrase |
||
94 | |||
95 | /** |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function setStupidBackoffSmoothing(float $discount): Phrase |
||
104 | |||
105 | /** |
||
106 | * @return $this |
||
107 | */ |
||
108 | public function setLaplaceSmoothing(float $alpha): Phrase |
||
114 | |||
115 | /** |
||
116 | * @return $this |
||
117 | */ |
||
118 | public function setLinearInterpolationSmoothing(float $trigramLambda, float $bigramLambda, float $unigramLambda): Phrase |
||
126 | |||
127 | /** |
||
128 | * @param string $model the name of the smoothing model |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | public function setSmoothingModel(string $model, array $params): Phrase |
||
138 | |||
139 | /** |
||
140 | * @return $this |
||
141 | */ |
||
142 | public function addDirectGenerator(DirectGenerator $generator): self |
||
146 | |||
147 | /** |
||
148 | * @deprecated since version 7.2.0, use the "addDirectGenerator()" method instead. |
||
149 | * |
||
150 | * @return $this |
||
151 | */ |
||
152 | public function addCandidateGenerator(AbstractCandidateGenerator $generator): Phrase |
||
158 | |||
159 | /** |
||
160 | * {@inheritdoc} |
||
161 | */ |
||
162 | public function toArray(): array |
||
182 | } |
||
183 |