<commit_before>import json
import os
import re
from icu import Locale, Collator, UnicodeString


class IndexedCollation:

    def __init__(self, iso639_3):
        try:
            with open(os.path.join(os.path.dirname(__file__), 'data/{language}.json'.format(language=iso639_3)), 'r') as f:
                self.spec = json.load(f)
        except IOError:
            with open(os.path.join(os.path.dirname(__file__), 'data/{language}.json'.format(language='eng')), 'r') as f:
                self.spec = json.load(f)

    @property
    def section_titles(self):
        return self.spec.get('section_titles', self.spec.get('index_titles'))

    @property
    def index_titles(self):
        return self.spec.get('index_titles', self.spec.get('section_titles'))

    @property
    def start_strings(self):
        return self.spec.get('start_strings', [self.to_lowercase(title) for title in self.index_titles])<commit_msg>Use pkg_resources.<commit_after>import json
import pkg_resources
import re
from icu import Locale, Collator, UnicodeString


class IndexedCollation:

    def __init__(self, iso639_3):
        try:
            self.spec = json.loads(pkg_resources.resource_string(__name__, 'data/{language}.json'.format(language=iso639_3)))
        except IOError:
            self.spec = json.loads(pkg_resources.resource_string(__name__, 'data/{language}.json'.format(language='eng')))

    @property
    def section_titles(self):
        return self.spec.get('section_titles', self.spec.get('index_titles'))

    @property
    def index_titles(self):
        return self.spec.get('index_titles', self.spec.get('section_titles'))

    @property
    def start_strings(self):
        return self.spec.get('start_strings', [self.to_lowercase(title) for title in self.index_titles])
{'fraction_non_alphanumeric': 0.1282194848824188, 'fraction_numerical': 0.008958566629339306, 'mean_word_length': 3.5470737913486006, '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': '5911509', 'n_tokens_mistral': 576, 'n_tokens_neox': 551, 'n_words': 106}