1478c86c831a2f616cb41b35695f96e6c07ae3b2,textacy/datasets/oxford_text_archive.py,OxfordTextArchive,_load_and_parse_metadata,#OxfordTextArchive#,84

Before Change


        re_extract_authors = re.compile(r"([^\d]+)(?:\d{4}(?:\?| or \d{1,2})?-(?:ca\. )?\d{4}|[bdfl]\.(?: ca\.)? \d{4}\??|-\d{4}|\d{4} or \d{1,2}|\d{2}th cent\.)\.?")
        re_clean_authors = re.compile(r"^[,; ]+|[,.]+\s*?$")

        metadata = []
        with ZipFile(self._filename, mode="r") as f:
            subf = io.StringIO(f.read("ota-master/metadata.tsv").decode("utf-8"))
            for row in csv.DictReader(subf, delimiter="\t"):
                // only include English-language works (99.9% of all works)
                if not row["Language"].startswith("English"):
                    continue
                // clean up years
                year_match = re_extract_year.search(row["Year"])
                if year_match:
                    row["Year"] = year_match.group()
                else:
                    row["Year"] = None
                // extract and clean up authors
                authors = re_extract_authors.findall(row["Author"]) or [row["Author"]]
                row["Author"] = [re_clean_authors.sub("", author) for author in authors]
                // get rid of uniform "Language" and "License" fields
                del row["Language"]
                del row["License"]
                metadata.append({key.lower(): val for key, val in row.items()})

        self.metadata = metadata

After Change



        // set authors attribute
        // self.authors = {a for m in metadata for a in m["author"]}
        self.authors = {
            author for value in metadata.values()
            for author in value["author"]
            if value.get("author")}

        // return tuple(metadata)
        return metadata
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: chartbeat-labs/textacy
Commit Name: 1478c86c831a2f616cb41b35695f96e6c07ae3b2
Time: 2017-06-09
Author: burton@chartbeat.com
File Name: textacy/datasets/oxford_text_archive.py
Class Name: OxfordTextArchive
Method Name: _load_and_parse_metadata


Project Name: pantsbuild/pants
Commit Name: 327a8d989f986623b258d5926142333d80697e4c
Time: 2018-03-09
Author: benjyw@gmail.com
File Name: src/python/pants/init/options_initializer.py
Class Name: OptionsInitializer
Method Name: _install_options


Project Name: AlexEMG/DeepLabCut
Commit Name: 0ef2bfb1adda578c45e9c56412f86c02b950c0a3
Time: 2020-06-18
Author: saveliy.m.yusufov@gmail.com
File Name: deeplabcut/utils/make_labeled_video.py
Class Name:
Method Name: CreateVideoSlow