Lines Matching +defs:text +defs:line
40 * List of replacements in the text.
47 * Generate an in-text replacement code for the specified index
59 * Clean floating point numbers by replace them with an in-text index
61 * @param string $text
65 private function replaceFloatNumbers(string $text)
67 preg_match_all('!\d+(?:\.\d+)?!', $text, $matches, PREG_OFFSET_CAPTURE);
78 $text = (string)substr_replace($text, $code, $offset, mb_strlen($number));
83 return $text;
89 * @param string[] $text
93 private function restoreReplacements($text)
102 }, $text);
106 * Breaks a piece of text into lines by linebreak.
111 * @param string $text
115 private static function linebreakSplit($text)
118 $line = '';
120 foreach (Multibyte::split('([\r\n]+)', $text, -1, PREG_SPLIT_DELIM_CAPTURE) as $part) {
121 $line .= $part;
123 $lines[] = $line;
124 $line = '';
127 $lines[] = $line;
143 * @param string $line
147 private function punctuationSplit($line)
151 $chars = preg_split('//u', $line, -1, PREG_SPLIT_NO_EMPTY); // This is UTF8 multibyte safe!
399 * Return the sentences sentences detected in the provided text.
402 * @param string $text
407 public function split($text, $flags = 0)
421 $text = Multibyte::cleanUnicode($text);
425 foreach (self::linebreakSplit($text) as $input) {
457 * Return the number of sentences detected in the provided text.
459 * @param string $text
463 public function count($text)
465 return count($this->split($text));