<commit_before>import Foundation
import Yaml

class SnippetManager: NSObject {

    var items: Yaml!

    func load() {
        let path = Bundle.main.resourcePath! + "/snippet.yml"
        guard let snippet = try? String(contentsOfFile: path) else {
            return
        }
        guard let yml = try? Yaml.load(snippet) else {
            return
        }
        items = yml<commit_msg>select snippet file on each languages<commit_after>import Foundation
import Yaml

class SnippetManager: NSObject {

    var items: Yaml!

    func load() {
        // TODO : Need better code
        let lang : String = NSLocale.preferredLanguages[0]
        let path : String;
        if lang == "ja-JP" {
            path = Bundle.main.resourcePath! + "/ja.lproj/snippet.yml"
        }
        else {
            path = Bundle.main.resourcePath! + "/Base.lproj/snippet.yml"
        }
        guard let snippet = try? String(contentsOfFile: path) else {
            return
        }
        guard let yml = try? Yaml.load(snippet) else {
            return
        }
        items = yml
{'fraction_non_alphanumeric': 0.09250693802035152, 'fraction_numerical': 0.0009250693802035153, 'mean_word_length': 1.8398950131233596, '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': '4709900', 'n_tokens_mistral': 326, 'n_tokens_neox': 309, 'n_words': 87}