Skip to content

Commit c5952ea

Browse files
committed
Fix text variable
Assigned a temp variable for the converted corpus text (ISO-8859-1) instead of changing the attribute. It will prevent to convert an already converted corpus text.
1 parent c94813e commit c5952ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Corpus/TextCorpus.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ public function concordance(string $needle, int $contextLength = 20, bool $ignor
137137
public function occurrences(string $needle, int $contextLength = 20, bool $ignorecase = true, string $position = 'contain', bool $mark = false) : array
138138
{
139139
// temporary solution to handle unicode chars
140-
$this->text = utf8_decode($this->text);
140+
$text = utf8_decode($this->text);
141141
$needle = utf8_decode($needle);
142142

143143
$found = [];
144-
$text = trim(preg_replace('/[\s\t\n\r\s]+/', ' ', $this->text));
144+
$text = trim(preg_replace('/[\s\t\n\r\s]+/', ' ', $text));
145145
$needleLength = strlen($needle);
146146
$textLength = strlen($text);
147147
$bufferLength = $needleLength + 2 * $contextLength;

0 commit comments

Comments
 (0)