<commit_before># encoding: utf-8

import choices


class Article(object):

    def __init__(self, data):
        self.data = data
        self.print_issn = None
        self.electronic_issn = None
        self._load_issn()

    def _load_issn(self):
        # ISSN and Other Complex Stuffs from the old version
        if not 'v935' in self.data['title']:  # Old fashion ISSN persistance style
            if 'v35' in self.data['title']:
                if self.data['title']['v35'][0]['_'] == "PRINT":
                    self.print_issn = self.data['title']['v400'][0]['_']
                else:
                    self.electronic_issn = self.data['title']['v400'][0]['_']
        else:  # New ISSN persistance style
            if 'v35' in self.data['title']:
                if self.data['title']['v35'][0]['_'] == "PRINT":
                    self.print_issn = self.data['title']['v935'][0]['_']
                    if self.data['title']['v935'][0]['_'] != self.data['title']['v400'][0]['_']:
                        self.electronic_issn = self.data['title']['v400'][0]['_']
                else:
                    self.electronic_issn = self.data['title']['v935'][0]['_']
                    if self.data['title']['v935'][0]['_'] != self.data['title']['v400'][0]['_']:
                        self.print_issn = self.data['title']['v400'][0]['_']

    def original_language(self, format='iso 639-b'):
        """
        Retrive the article original original language
        """

        if format == 'iso 639-b':
            if self.data['article']['v40'][0]['_'] in choices.ISO639_2:
                return choices.ISO639_2[self.data['article']['v40'][0]['_']]
        else:
            return self.data['article']['v40'][0]['_']

    @property
    def publisher_name(self):

        if 'v480' in self.data['title']:
            return self.data['title']['v480'][0]['_']

    @property
    def journal_title(self):

        if 'v100' in self.data['title']:
            return self.data['title']['v100'][0]['_']

    @property
    def publication_date(self):

        pub_date = [self.data['article']['v65'][0]['_'][0:4]]

        months = [i+1 for i in range(12)]
        days = [i+1 for i in range(31)]

        month = int(self.data['article']['v65'][0]['_'][4:6])
        day = int(self.data['article']['v65'][0]['_'][6:8])

        if month in months:
            pub_date.append(self.data['article']['v65'][0]['_'][4:6])

        if day in days:
            pub_date.append(self.data['article']['v65'][0]['_'][6:8])


        return "-".join(pub_date)

    @property
    def volume(self):

        if 'v31' in self.data['article']:
            return self.data['article']['v31'][0]['_']

    @property
    def issue(self):

        if 'v32' in self.data['article']:
            return self.data['article']['v32'][0]['_']

    @property
    def supplement_volume(self):

        if 'v131' in self.data['article']:
            return self.data['article']['v131'][0]['_']
<commit_msg>corrigindo uso de range<commit_after># encoding: utf-8

import choices


class Article(object):

    def __init__(self, data):
        self.data = data
        self.print_issn = None
        self.electronic_issn = None
        self._load_issn()

    def _load_issn(self):
        # ISSN and Other Complex Stuffs from the old version
        if not 'v935' in self.data['title']:  # Old fashion ISSN persistance style
            if 'v35' in self.data['title']:
                if self.data['title']['v35'][0]['_'] == "PRINT":
                    self.print_issn = self.data['title']['v400'][0]['_']
                else:
                    self.electronic_issn = self.data['title']['v400'][0]['_']
        else:  # New ISSN persistance style
            if 'v35' in self.data['title']:
                if self.data['title']['v35'][0]['_'] == "PRINT":
                    self.print_issn = self.data['title']['v935'][0]['_']
                    if self.data['title']['v935'][0]['_'] != self.data['title']['v400'][0]['_']:
                        self.electronic_issn = self.data['title']['v400'][0]['_']
                else:
                    self.electronic_issn = self.data['title']['v935'][0]['_']
                    if self.data['title']['v935'][0]['_'] != self.data['title']['v400'][0]['_']:
                        self.print_issn = self.data['title']['v400'][0]['_']

    def original_language(self, format='iso 639-b'):
        """
        Retrive the article original original language
        """

        if format == 'iso 639-b':
            if self.data['article']['v40'][0]['_'] in choices.ISO639_2:
                return choices.ISO639_2[self.data['article']['v40'][0]['_']]
        else:
            return self.data['article']['v40'][0]['_']

    @property
    def publisher_name(self):

        if 'v480' in self.data['title']:
            return self.data['title']['v480'][0]['_']

    @property
    def journal_title(self):

        if 'v100' in self.data['title']:
            return self.data['title']['v100'][0]['_']

    @property
    def publication_date(self):

        pub_date = [self.data['article']['v65'][0]['_'][0:4]]

        months = range(1,13)
        days = range(1,31)

        month = int(self.data['article']['v65'][0]['_'][4:6])
        day = int(self.data['article']['v65'][0]['_'][6:8])

        if month in months:
            pub_date.append(self.data['article']['v65'][0]['_'][4:6])

        if day in days:
            pub_date.append(self.data['article']['v65'][0]['_'][6:8])


        return "-".join(pub_date)

    @property
    def volume(self):

        if 'v31' in self.data['article']:
            return self.data['article']['v31'][0]['_']

    @property
    def issue(self):

        if 'v32' in self.data['article']:
            return self.data['article']['v32'][0]['_']

    @property
    def supplement_volume(self):

        if 'v131' in self.data['article']:
            return self.data['article']['v131'][0]['_']

{'fraction_non_alphanumeric': 0.1993977919036467, 'fraction_numerical': 0.046503847440615594, 'mean_word_length': 2.252992383025027, 'pattern_counts': {'":': 4, '<': 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': '4478930', 'n_tokens_mistral': 2046, 'n_tokens_neox': 1910, 'n_words': 351}