<commit_before>import UIKit


/// Converts a generic element to `NSAttributedString`.  Should only be used if a specific converter is not found.
///
class GenericElementConverter: ElementConverter {
    
    let serializer: AttributedStringSerializer
    
    init(using serializer: AttributedStringSerializer) {
        self.serializer = serializer
    }
    
    // MARK: - ElementConverter
    
    func canConvert(element: ElementNode) -> Bool {
        return true
    }
    
    func convert(_ element: ElementNode, inheriting attributes: [AttributedStringKey: Any]) -> NSAttributedString {
        let content = NSMutableAttributedString()
        
        for child in element.children {
            let childContent = serializer.serialize(child, inheriting: attributes)
            content.append(childContent)
        }
        
        return content
    }
}

<commit_msg>Fix a memory leak issue<commit_after>import UIKit


/// Converts a generic element to `NSAttributedString`.  Should only be used if a specific converter is not found.
///
class GenericElementConverter: ElementConverter {
    
    unowned let serializer: AttributedStringSerializer
    
    init(using serializer: AttributedStringSerializer) {
        self.serializer = serializer
    }
    
    // MARK: - ElementConverter
    
    func canConvert(element: ElementNode) -> Bool {
        return true
    }
    
    func convert(_ element: ElementNode, inheriting attributes: [AttributedStringKey: Any]) -> NSAttributedString {
        let content = NSMutableAttributedString()
        
        for child in element.children {
            let childContent = serializer.serialize(child, inheriting: attributes)
            content.append(childContent)
        }
        
        return content
    }
}


{'fraction_non_alphanumeric': 0.06950672645739911, 'fraction_numerical': 0.0, 'mean_word_length': 2.5416666666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '378541', 'n_tokens_mistral': 467, 'n_tokens_neox': 443, 'n_words': 129}