def split_by_gap(
            self,
            max_gap: float = 0.1,
            lock: bool = False,
            newline: bool = False,
            ignore_special_periods: bool = False
    ) -> "WhisperResult":
        """
        Split (in-place) any segment where the gap between two of its words is greater than ``max_gap``.

        Parameters
        ----------
        max_gap : float, default 0.1
            Maximum second(s) allowed between two words if the same segment.
        lock : bool, default False
            Whether to prevent future splits/merges from altering changes made by this method.
        newline: bool, default False
            Whether to insert line break at the split points instead of splitting into separate segments.
        ignore_special_periods : bool, default False
            Whether to avoid splitting at periods that is likely not an indication of the end of a sentence.

        Returns
        -------
        stable_whisper.result.WhisperResult
            The current instance after the changes.
        """
        ignore_special_periods = self._ignore_special_periods or ignore_special_periods
        self._split_segments(
            lambda x: x.get_gap_indices(max_gap),
            lock=lock,
            newline=newline,
            ignore_special_periods=ignore_special_periods
        )
        self._update_history(f'sg={max_gap}+{int(lock)}+{int(newline)}+{int(ignore_special_periods)}')
        return self

        Split (in-place) any segment where the gap between two of its words is greater than ``max_gap``.

        Parameters
        ----------
        max_gap : float, default 0.1
            Maximum second(s) allowed between two words if the same segment.
        lock : bool, default False
            Whether to prevent future splits/merges from altering changes made by this method.
        newline: bool, default False
            Whether to insert line break at the split points instead of splitting into separate segments.
        ignore_special_periods : bool, default False
            Whether to avoid splitting at periods that is likely not an indication of the end of a sentence.

        Returns
        -------
        stable_whisper.result.WhisperResult
            The current instance after the changes.
        
stable_whisper/result.py