<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Foundation
import Firebase

class ReviewProvider {

    let url: String

    // Optional values.
    let rating: Double?
    let reviews: [String]?
    let totalReviewCount: Int?

    init?(fromFirebaseSnapshot data: FIRDataSnapshot) {
        guard data.exists(), data.hasChildren(),
                let value = data.value as? NSDictionary,
                let url = value["url"] as? String else {
            print("lol unable to init ReviewProvider")
            return nil
        }

        self.url = url

        self.rating = value["rating"] as? Double
        self.totalReviewCount = value["totalReviewCount"] as? Int

        // TODO: get values from DB (these are default).
        self.reviews = []
    }
}<commit_msg>Change ReviewProvider.score to Float.<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Foundation
import Firebase

class ReviewProvider {

    let url: String

    // Optional values.
    let rating: Float?
    let reviews: [String]?
    let totalReviewCount: Int?

    init?(fromFirebaseSnapshot data: FIRDataSnapshot) {
        guard data.exists(), data.hasChildren(),
                let value = data.value as? NSDictionary,
                let url = value["url"] as? String else {
            print("lol unable to init ReviewProvider")
            return nil
        }

        self.url = url

        self.rating = value["rating"] as? Float
        self.totalReviewCount = value["totalReviewCount"] as? Int

        // TODO: get values from DB (these are default).
        self.reviews = []
    }
}
{'fraction_non_alphanumeric': 0.09700722394220847, 'fraction_numerical': 0.0041279669762641896, 'mean_word_length': 2.2976190476190474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3613312', 'n_tokens_mistral': 545, 'n_tokens_neox': 517, 'n_words': 199}