<commit_before>import AVKit
import UIKit

public enum TextStyle {
    case characterBackground(UIColor)
    case background(UIColor)
    case foreground(UIColor)
    case fontSize(Int)
    case bold
    case italic
    case underline
    case edge(EdgeStyle)
    case font(Font)
    case alignment(Alignment)
    case direction(Direction)

    var key: String {
        switch self {
        case .background: return String(kCMTextMarkupAttribute_BackgroundColorARGB)
        case .characterBackground: return String(kCMTextMarkupAttribute_CharacterBackgroundColorARGB)
        case .foreground: return String(kCMTextMarkupAttribute_ForegroundColorARGB)
        case .fontSize: return String(kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight)
        case .bold: return String(kCMTextMarkupAttribute_BoldStyle)
        case .underline: return String(kCMTextMarkupAttribute_UnderlineStyle)
        case .italic: return String(kCMTextMarkupAttribute_ItalicStyle)
        case .edge: return String(kCMTextMarkupAttribute_CharacterEdgeStyle)
        case .alignment: return String(kCMTextMarkupAttribute_Alignment)
        case .direction: return String(kCMTextMarkupAttribute_VerticalLayout)
        default: return ""
        }
    }

    var value: AVTextStyleRule {
        switch self {
        case .bold, .italic, .underline:
            return AVTextStyleRule(textMarkupAttributes: [ self.key: true])!
        case .fontSize(let size):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: size])!
        case .background(let color), .characterBackground(let color), .foreground(let color):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: color.argb])!
        case .edge(let edge):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: edge.value])!
        case .font(let font):
            return AVTextStyleRule(textMarkupAttributes: [ font.key: font.value])!
        case .alignment(let alignment):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: alignment.value])!
        case .direction(let direction):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: direction.value])!
        }
    }
}<commit_msg>chore: add equatable function on TextStyle<commit_after>import AVKit
import UIKit

public enum TextStyle {
    case characterBackground(UIColor)
    case background(UIColor)
    case foreground(UIColor)
    case fontSize(Int)
    case bold
    case italic
    case underline
    case edge(EdgeStyle)
    case font(Font)
    case alignment(Alignment)
    case direction(Direction)

    var key: String {
        switch self {
        case .background: return String(kCMTextMarkupAttribute_BackgroundColorARGB)
        case .characterBackground: return String(kCMTextMarkupAttribute_CharacterBackgroundColorARGB)
        case .foreground: return String(kCMTextMarkupAttribute_ForegroundColorARGB)
        case .fontSize: return String(kCMTextMarkupAttribute_BaseFontSizePercentageRelativeToVideoHeight)
        case .bold: return String(kCMTextMarkupAttribute_BoldStyle)
        case .underline: return String(kCMTextMarkupAttribute_UnderlineStyle)
        case .italic: return String(kCMTextMarkupAttribute_ItalicStyle)
        case .edge: return String(kCMTextMarkupAttribute_CharacterEdgeStyle)
        case .alignment: return String(kCMTextMarkupAttribute_Alignment)
        case .direction: return String(kCMTextMarkupAttribute_VerticalLayout)
        default: return ""
        }
    }

    var value: AVTextStyleRule {
        switch self {
        case .bold, .italic, .underline:
            return AVTextStyleRule(textMarkupAttributes: [ self.key: true])!
        case .fontSize(let size):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: size])!
        case .background(let color), .characterBackground(let color), .foreground(let color):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: color.argb])!
        case .edge(let edge):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: edge.value])!
        case .font(let font):
            return AVTextStyleRule(textMarkupAttributes: [ font.key: font.value])!
        case .alignment(let alignment):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: alignment.value])!
        case .direction(let direction):
            return AVTextStyleRule(textMarkupAttributes: [ self.key: direction.value])!
        }
    }
}

extension TextStyle: Equatable {
    public static func == (lhs: TextStyle, rhs: TextStyle) -> Bool {
        lhs.key == rhs.key && lhs.value == rhs.value
    }
}
{'fraction_non_alphanumeric': 0.08000862626698296, 'fraction_numerical': 0.0, 'mean_word_length': 3.342696629213483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5823721', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1258, 'n_words': 290}