@param string $text

@return string[]
503447
public function split($text)
    {
        $this->probabilityCalculator->setAbbreviations($this->getAbbreviations());

        $tokens = $this->lexer->run($text);
        $probabilities = $this->probabilityCalculator->calculate($tokens);
        $sentences = $this->sentenceBuilder->build($probabilities);

        return $sentences;
    }
52113
public function readPlace(string $text): array
    {
        $text = trim($text);

        return preg_split(self::PLACE_SEPARATOR_REGEX, $text, PREG_SPLIT_NO_EMPTY);
    }
678297
public function find_formulas($text) {
        preg_match_all(self::FORMULAS_IN_TEXT_REGEX, $text, $matches);
        return array_combine($matches[1], $matches[1]);
    }
1242529
public function text($text)
    {
        foreach ($this->_data as $macros => $value) {
            $macros = '{' . $macros . '}';
            $text   = preg_replace('#' . $macros . '#ius', $value, $text);
        }

        return $text;
    }
1087605
public function parse($text)
    {
        preg_match_all($this->shortcodeRegex, $text, $matches, PREG_OFFSET_CAPTURE);

        // loop instead of array_map to pass the arguments explicitly
        $shortcodes = array();
        foreach($matches[0] as $match) {
            $offset = mb_strlen(substr($text, 0, $match[1]), 'utf-8');
            $shortcodes[] = $this->parseSingle($match[0], $offset);
        }

        return array_filter($shortcodes);
    }
847971
static private function borkify( $text )
    {
        $textBlocks = preg_split( '/(%[^ ]+)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
        $newTextBlocks = array();
        foreach ( $textBlocks as $text )
        {
            if ( strlen( $text ) && $text[0] == '%' )
            {
                $newTextBlocks[] = (string) $text;
                continue;
            }

            $orgtext = $text;

            $searchMap = array(
                '/au/', '/\Bu/', '/\Btion/', '/an/', '/a\B/', '/en\b/',
                '/\Bew/', '/\Bf/', '/\Bir/', '/\Bi/', '/\bo/', '/ow/', '/ph/',
                '/th\b/', '/\bU/', '/y\b/', '/v/', '/w/', '/ooo/',
            );
            $replaceMap = array(
                'oo', 'oo', 'shun', 'un', 'e', 'ee',
                'oo', 'ff', 'ur', 'ee', 'oo', 'oo', 'f',
                't', 'Oo', 'ai', 'f', 'v', 'oo',
            );
            $text = preg_replace( $searchMap, $replaceMap, $text );

            if ( $orgtext == $text && count( $newTextBlocks ) )
            {
                $text .= '-a';
            }
            $newTextBlocks[] = (string) $text;
        }
        $text = implode( '', $newTextBlocks );
        $text = preg_replace( '/([:.?!])(.*)/', '\\2\\1', $text );
        return "[$text]";
    }
329175
protected function _parseScripts(&$text)
    {
        $scripts = '';

        $matches = array();
        // <script src="" />
        if (preg_match_all('#<script(?!\s+data\-inline\s*)\s+src="([^"]+)"(.*)/>#siU', $text, $matches)) {
            foreach (array_unique($matches[1]) as $key => $match) {
                $attribs = $this->_parseAttributes($matches[2][$key]);
                $scripts .= $this->_renderScript($match, true, $attribs);
            }

            $text = str_replace($matches[0], '', $text);
        }

        $matches = array();
        // <script></script>
        if (preg_match_all('#<script(?!\s+data\-inline\s*)(.*)>(.*)</script>#siU', $text, $matches)) {
            foreach ($matches[2] as $key => $match) {
                $attribs = $this->_parseAttributes($matches[1][$key]);
                $scripts .= $this->_renderScript($match, false, $attribs);
            }

            $text = str_replace($matches[0], '', $text);
        }

        return $scripts;
    }
272326
protected function normalize(string $text) : string
    {
        $search = ['jan.','feb.','mar.','apr.','may.','jun.','jul.','aug.','sep.','oct.','nov.','dec.'];
        $replace = [
            "january",
            "february",
            "march",
            "april",
            "may",
            "june",
            "july",
            "august",
            "september",
            "october",
            "november",
            "december"
        ];        
        return str_ireplace($search, $replace, $text);
    }
847674
static public function getAllSubStrings($text)
    {
        $splitText = str_split($text);
        $splitCount = count($splitText);
        $subStrings = [];
        for ($i = 0; $i < $splitCount; $i++)
        {
            for ($j = $i; $j < $splitCount; $j++)
            {
                $subStrings[] = implode(array_slice($splitText, $i, $j - $i + 1));
            }
        }
        return $subStrings;
    }
166699
function LinesToArray($text)
    {
        $result = array();
        $lines = Str::SplitLines($text);
        foreach ($lines as $line)
        {
            $line = trim($line);
            if (!$line)
            {
                continue;
            }
            $pos = strpos($line, $this->separator);
            $key = $line;
            $value = '';
            if ($pos !== false)
            {
                $key = substr($line, 0, $pos);
                $value = substr($line, $pos + strlen($this->separator));
            }
            $result[trim($key)] = trim($value);
        }
        return $result;
    }
584535
protected function explodeText($text)
    {
        $delimiter = $this->config('teaser_delimiter', '<!--teaser-->');
        $text = str_replace(htmlspecialchars($delimiter), $delimiter, $text);
        $parts = array_filter(array_map('trim', explode($delimiter, $text, 2)));

        return array_pad($parts, 2, '');
    }
935971
public function split($text) {
        if (count($this->patterns) === 0) {
            return false;
        }
        if ($this->concatenatedPatterns === null) {
            $this->concatenatedPatterns = '/' . implode('|', array_map(function ($pattern) {
                    return $pattern['pattern'];
                }, $this->patterns)) . '/msSi';
        }

        if (!preg_match($this->concatenatedPatterns, $text, $matches)) {
            return false;
        }

        $match = array_shift($matches);
        $patternNo = count($matches) - 1;
        $childRuleName = $this->patterns[$patternNo]['childRuleName'];
        list($first, $end) = preg_split($this->patterns[$patternNo]['pattern'] . 'msSi', $text, 2);

        return [$first, $match, $end, $childRuleName];
    }
529905
protected function resolveUrls($text)
    {
        static $search;

        if ($search === null) {
            $attr   = [ 'href', 'link', 'url', 'src' ];
            $scheme = [ '../', './', '/', 'data', 'mailto', 'http' ];

            $search = sprintf(
                '(?<=%1$s=")(?!%2$s)(\S+)(?=")',
                implode('="|', array_map('preg_quote', $attr, [ '~' ])),
                implode('|', array_map('preg_quote', $scheme, [ '~' ]))
            );
        }

        $text = preg_replace_callback(
            '~'.$search.'~i',
            function ($matches) {
                return $this->createAbsoluteUrl($matches[1]);
            },
            $text
        );

        return $text;
    }
543959
protected function splitText($text)
    {
        $punctuations = preg_quote(implode('', $this->punctuations), '/');

        $text = preg_replace('/([^\p{Han}\s'.$punctuations.']+)/u', "\t\t\t$1\t\t", $text);

        $array = [];

        foreach (preg_split('/\t\t/u', $text, -1, PREG_SPLIT_NO_EMPTY) as $item) {
            $array[] = ("\t" === $item[0])
                ? substr($item, 1)
                : preg_split('//u', $item, -1, PREG_SPLIT_NO_EMPTY);
        }

        return $this->flatten($array);
    }
660948
public static function extractSql(string $text): array
    {
        // remove comments
        // inline
        $text = (string)preg_replace('/\s*(?:--|#).*$/um', '', $text);
        // multi-line
        $text = (string)preg_replace('/\/\*[^*]*(\*)?[^*]*\*\//um', '', $text);
        // flatten and filter
        $text = (string)preg_replace('/\n/', ' ', $text);
        $text = (string)preg_replace('/\s{2,}/', ' ', $text);
        $text = trim($text, '; ');
        return $text === '' ? [] : preg_split('/\s*;\s*/', $text);
    }
1310217
private function getTranslatedText($text)
    {
        if ($this->isEnglish($text)) {
            return $text;
        }
        $text = $this->removeSegment($text);
        $url = $this->getTranslateUrl($text);
        $response = $this->http->get($url);

        return $this->getTranslation(json_decode($response->getBody(), true));
    }
1197092
public static function getSpinnerCombinations($text)
    {
        $matches = self::getSpinnerMatches($text);

        foreach ($matches as $row) {
            if(!preg_match('/[{}]/', $row)) {
                $all[] = explode('|', $row);
            }
        }

        $combinations = call_user_func_array(__CLASS__ . '::arrayCartesian', $all);
        foreach($combinations as $item) {
            $out[] = implode('', $item);
        }

        return array_values($out);
    }