<commit_before>//
//  FoodEmojiDataSource.swift
//  LoopKit
//
//  Copyright © 2017 LoopKit Authors. All rights reserved.
//


struct FoodEmojiSection {
    let items: [String]
    let title: String
}


class FoodEmojiDataSource {
    private static let fast   = ["🍭", "🍇", "🍈", "🍉", "🍊", "🍋", "🍌", "🍍",
                                 "🍎", "🍏", "🍐", "🍑", "🍒", "🍓", "🥝",
                                 "🍅", "🥔", "🥕", "🌽", "🌶", "🥒", "🥗", "🍄",
                                 "🍞", "🥐", "🥖", "🥞", "🍿", "🍘", "🍙",
                                 "🍚", "🍢", "🍣", "🍡", "🍦", "🍧", "🍨",
                                 "🍩", "🍪", "🎂", "🍰", "🍫", "🍬", "🍮",
                                 "🍯", "🍼", "🥛", "☕️", "🍵"]
    private static let medium = ["🌮", "🍆", "🍟", "🍳", "🍲", "🍱", "🍛",
                                 "🍜", "🍠", "🍤", "🍥", "🍹"]
    private static let slow   = ["🍕", "🥑", "🥜", "🌰", "🧀", "🍖", "🍗", "🥓",
                                 "🍔", "🌭", "🌯", "🍝"]
    private static let other  = ["🍶", "🍾", "🍷", "🍸", "🍺", "🍻", "🥂", "🥃",
                                 "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣",
                                 "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]
    let sections: [FoodEmojiSection]

    init() {
        sections = [
            FoodEmojiSection(
                items: type(of: self).fast,
                title: NSLocalizedString("Fast", comment: "Section title for fast absorbing food")
            ),
            FoodEmojiSection(
                items: type(of: self).medium,
                title: NSLocalizedString("Medium", comment: "Section title for medium absorbing food")
            ),
            FoodEmojiSection(
                items: type(of: self).slow,
                title: NSLocalizedString("Slow", comment: "Section title for slow absorbing food")
            ),
            FoodEmojiSection(
                items: type(of: self).other,
                title: NSLocalizedString("Other", comment: "Section title for no-carb food")
            )
        ]
    }

    func maxAbsorptionTimeIndexForText(_ text: String) -> Int? {
        for (index, section) in sections.dropLast().enumerated().reversed() {
            for character in text.characters {
                if section.items.contains(String(character)) {
                    return index
                }
            }
        }

        return nil
    }
}
<commit_msg>Support for more food emojis<commit_after>//
//  FoodEmojiDataSource.swift
//  LoopKit
//
//  Copyright © 2017 LoopKit Authors. All rights reserved.
//


struct FoodEmojiSection {
    let items: [String]
    let title: String
}


class FoodEmojiDataSource {
    private static let fast: [String] = {
        var fast = [
            "🍭", "🍇", "🍈", "🍉", "🍊", "🍋", "🍌", "🍍",
            "🍎", "🍏", "🍐", "🍑", "🍒", "🍓", "🥝",
            "🍅", "🥔", "🥕", "🌽", "🌶", "🥒", "🥗", "🍄",
            "🍞", "🥐", "🥖", "🥞", "🍿", "🍘", "🍙",
            "🍚", "🍢", "🍣", "🍡", "🍦", "🍧", "🍨",
            "🍩", "🍪", "🎂", "🍰", "🍫", "🍬", "🍮",
            "🍯", "🍼", "🥛", "☕️", "🍵"
        ]

        if #available(iOS 11.1, watchOS 4.1, *) {
            fast += [
                "🥥", "🥦", "🥨", "🥠", "🥧"
            ]
        }

        return fast
    }()

    private static let medium: [String] = {
        var medium = [
            "🌮", "🍆", "🍟", "🍳", "🍲", "🍱", "🍛",
            "🍜", "🍠", "🍤", "🍥", "🍹"
        ]

        if #available(iOS 11.1, watchOS 4.1, *) {
            medium += [
                "🥪", "🥫", "🥟", "🥡"
            ]
        }

        return medium
    }()

    private static let slow: [String] = {
        var slow = [
            "🍕", "🥑", "🥜", "🌰", "🧀", "🍖", "🍗", "🥓",
            "🍔", "🌭", "🌯", "🍝"
        ]

        if #available(iOS 11.1, watchOS 4.1, *) {
            slow += [
                "🥩"
            ]
        }

        return slow
    }()

    private static let other: [String] = {
        var other = [
            "🍶", "🍾", "🍷", "🍸", "🍺", "🍻", "🥂", "🥃",
            "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣",
            "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"
        ]

        if #available(iOS 11.1, watchOS 4.1, *) {
            other += [
                "🥣", "🥤", "🥢"
            ]
        }

        return other
    }()

    let sections: [FoodEmojiSection]

    init() {
        sections = [
            FoodEmojiSection(
                items: type(of: self).fast,
                title: NSLocalizedString("Fast", comment: "Section title for fast absorbing food")
            ),
            FoodEmojiSection(
                items: type(of: self).medium,
                title: NSLocalizedString("Medium", comment: "Section title for medium absorbing food")
            ),
            FoodEmojiSection(
                items: type(of: self).slow,
                title: NSLocalizedString("Slow", comment: "Section title for slow absorbing food")
            ),
            FoodEmojiSection(
                items: type(of: self).other,
                title: NSLocalizedString("Other", comment: "Section title for no-carb food")
            )
        ]
    }

    func maxAbsorptionTimeIndexForText(_ text: String) -> Int? {
        for (index, section) in sections.dropLast().enumerated().reversed() {
            for character in text {
                if section.items.contains(String(character)) {
                    return index
                }
            }
        }

        return nil
    }
}

{'fraction_non_alphanumeric': 0.21927710843373494, 'fraction_numerical': 0.008526413345690454, 'mean_word_length': 1.3708260105448156, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 27, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3087110', 'n_tokens_mistral': 2345, 'n_tokens_neox': 2125, 'n_words': 469}