src/Sentence.php
private function abbreviationMerge($fragments)
    {
        $return_fragment = [];

        $previous_fragment = '';
        $previous_is_abbreviation = false;
        $i = 0;
        foreach ($fragments as $fragment) {
            $is_abbreviation = self::isAbreviation($fragment);

            // merge previous fragment with this
            if ($previous_is_abbreviation) {
                $fragment = $previous_fragment . $fragment;
            }
            $return_fragment[$i] = $fragment;

            $previous_is_abbreviation = $is_abbreviation;
            $previous_fragment = $fragment;

            // only increment if this isn't an abbreviation
            if (!$is_abbreviation) {
                $i++;
            }
        }
        return $return_fragment;
    }
private function abbreviationMerge($fragments)
    {
        $return_fragment = [];

        $previous_fragment = '';
        $previous_is_abbreviation = false;
        $i = 0;
        foreach ($fragments as $fragment) {
            $is_abbreviation = self::isAbreviation($fragment);

            // merge previous fragment with this
            if ($previous_is_abbreviation) {
                $fragment = $previous_fragment . $fragment;
            }
            $return_fragment[$i] = $fragment;

            $previous_is_abbreviation = $is_abbreviation;
            $previous_fragment = $fragment;

            // only increment if this isn't an abbreviation
            if (!$is_abbreviation) {
                $i++;
            }
        }
        return $return_fragment;
    }
private function abbreviationMerge ( $ fragments ) { $ return_fragment = [ ] ; $ previous_fragment = '' ; $ previous_is_abbreviation = false ; $ i = 0 ; foreach ( $ fragments as $ fragment ) { $ is_abbreviation = self :: isAbreviation ( $ fragment ) ; // merge previous fragment with this if ( $ previous_is_abbreviation ) { $ fragment = $ previous_fragment . $ fragment ; } $ return_fragment [ $ i ] = $ fragment ; $ previous_is_abbreviation = $ is_abbreviation ; $ previous_fragment = $ fragment ; // only increment if this isn't an abbreviation if ( ! $ is_abbreviation ) { $ i ++ ; } } return $ return_fragment ; }
Looks for capitalized abbreviations & includes them with the following fragment.

For example:
[ "Last week, former director of the F.B.I. James B. Comey was fired. Mr. Comey was not available for comment." ]
... becomes ...
[ "Last week, former director of the F.B.I. James B. Comey was fired." ]
[ "Mr. Comey was not available for comment." ]

@param string[] $fragments
@return string[]
Looks for capitalized abbreviations & includes them with the following fragment .