src/Sentence.php
private function sentenceMerge($shorts)
    {
        $non_abbreviating_terminals = array_diff($this->terminals, $this->abbreviators);

        $sentences = [];

        $sentence = '';
        $has_words = false;
        $previous_word_ending = null;
        foreach ($shorts as $short) {
            $word_count = count(mb_split('\s+', Multibyte::trim($short)));
            $after_non_abbreviating_terminal = in_array($previous_word_ending, $non_abbreviating_terminals);

            if ($after_non_abbreviating_terminal
                || ($has_words && $word_count > 1)) {

                $sentences[] = $sentence;

                $sentence = '';
                $has_words = false;
            }

            $has_words = $has_words
                || $word_count > 1;

            $sentence .= $short;
            $previous_word_ending = mb_substr($short, -1);
        }

        if (!empty($sentence)) {
            $sentences[] = $sentence;
        }

        return $sentences;
    }
private function sentenceMerge($shorts)
    {
        $non_abbreviating_terminals = array_diff($this->terminals, $this->abbreviators);

        $sentences = [];

        $sentence = '';
        $has_words = false;
        $previous_word_ending = null;
        foreach ($shorts as $short) {
            $word_count = count(mb_split('\s+', Multibyte::trim($short)));
            $after_non_abbreviating_terminal = in_array($previous_word_ending, $non_abbreviating_terminals);

            if ($after_non_abbreviating_terminal
                || ($has_words && $word_count > 1)) {

                $sentences[] = $sentence;

                $sentence = '';
                $has_words = false;
            }

            $has_words = $has_words
                || $word_count > 1;

            $sentence .= $short;
            $previous_word_ending = mb_substr($short, -1);
        }

        if (!empty($sentence)) {
            $sentences[] = $sentence;
        }

        return $sentences;
    }
private function sentenceMerge ( $ shorts ) { $ non_abbreviating_terminals = array_diff ( $ this -> terminals , $ this -> abbreviators ) ; $ sentences = [ ] ; $ sentence = '' ; $ has_words = false ; $ previous_word_ending = null ; foreach ( $ shorts as $ short ) { $ word_count = count ( mb_split ( '\s+' , Multibyte :: trim ( $ short ) ) ) ; $ after_non_abbreviating_terminal = in_array ( $ previous_word_ending , $ non_abbreviating_terminals ) ; if ( $ after_non_abbreviating_terminal || ( $ has_words && $ word_count > 1 ) ) { $ sentences [ ] = $ sentence ; $ sentence = '' ; $ has_words = false ; } $ has_words = $ has_words || $ word_count > 1 ; $ sentence .= $ short ; $ previous_word_ending = mb_substr ( $ short , - 1 ) ; } if ( ! empty ( $ sentence ) ) { $ sentences [ ] = $ sentence ; } return $ sentences ; }
Merges items into larger sentences.
Multibyte.php safe

@param string[] $shorts
@return string[]
Merges items into larger sentences . Multibyte . php safe