<commit_before>import Foundation

extension String {

    /// Checks if the receiver has an empty paragraph at the specified index.
    ///
    /// - Parameters:
    ///     - index: the receiver's index to check
    ///
    /// - Returns: `true` if the specified index is in an empty paragraph, `false` otherwise.
    ///
    func isEmptyParagraph(at index: String.Index) -> Bool {
        return isStartOfNewLine(at: index) && isEndOfLine(at: index)
    }

    /// Checks if the receiver has an empty paragraph at the specified offset.
    ///
    /// - Parameters:
    ///     - offset: the receiver's offset to check
    ///
    /// - Returns: `true` if the specified offset is in an empty paragraph, `false` otherwise.
    ///
    func isEmptyParagraph(at offset: Int) -> Bool {

        let index = self.index(startIndex, offsetBy: offset)
        
        return isEmptyParagraph(at: index)
    }

    /// Checks if the receiver has an empty paragraph at the specified offset and if the offset
    /// corresponds to EOF (end-of-file).
    ///
    /// - Parameters:
    ///     - offset: the receiver's offset to check
    ///
    /// - Returns: `true` if the specified offset is in an empty paragraph, `false` otherwise.
    ///
    func isEmptyParagraphAtEndOfFile(at offset: Int) -> Bool {
        return offset == characters.count && isEmptyParagraph(at: offset)<commit_msg>Fix way to calculate location.<commit_after>import Foundation

extension String {

    /// Checks if the receiver has an empty paragraph at the specified index.
    ///
    /// - Parameters:
    ///     - index: the receiver's index to check
    ///
    /// - Returns: `true` if the specified index is in an empty paragraph, `false` otherwise.
    ///
    func isEmptyParagraph(at index: String.Index) -> Bool {
        return isStartOfNewLine(at: index) && isEndOfLine(at: index)
    }

    /// Checks if the receiver has an empty paragraph at the specified offset.
    ///
    /// - Parameters:
    ///     - offset: the receiver's offset to check
    ///
    /// - Returns: `true` if the specified offset is in an empty paragraph, `false` otherwise.
    ///
    func isEmptyParagraph(at offset: Int) -> Bool {
        guard let index = self.indexFromLocation(offset) else {
            return true
        }        
        
        return isEmptyParagraph(at: index)
    }

    /// Checks if the receiver has an empty paragraph at the specified offset and if the offset
    /// corresponds to EOF (end-of-file).
    ///
    /// - Parameters:
    ///     - offset: the receiver's offset to check
    ///
    /// - Returns: `true` if the specified offset is in an empty paragraph, `false` otherwise.
    ///
    func isEmptyParagraphAtEndOfFile(at offset: Int) -> Bool {
        return offset == characters.count && isEmptyParagraph(at: offset)
{'fraction_non_alphanumeric': 0.11480042387848817, 'fraction_numerical': 0.0, 'mean_word_length': 2.095081967213115, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1879826', 'n_tokens_mistral': 773, 'n_tokens_neox': 752, 'n_words': 287}