66756de12d3f76d48774434bb210cab39a9590c0,graphbrain/agents/txt_parser.py,TxtParser,input_file,#TxtParser#Any#,24

Before Change



    def input_file(self, file_name):
        pos = 0
        with open(file_name, "r") as f:
            text = f.read().replace("\n", " ")
            parses = self.parser.parse(text)
            for parse in parses:
                main_edge = parse["main_edge"]

After Change



    def input_file(self, file_name):
        pos = 0
        for paragraph in paragraphs(file_name):
            parses = self.parser.parse(paragraph)
            for parse in parses:
                main_edge = parse["main_edge"]

                // add main edge
                if main_edge:
                    self.hg.add_to_sequence(self.sequence, pos, main_edge)
                    self.edges += 1
                    pos += 1

                    // attach text to edge
                    self.hg.set_attribute(main_edge, "text", parse["text"])

                    // add extra edges
                    for edge in parse["extra_edges"]:
                        self.add(edge)

    def report(self):
        rep_str = ("edges found: {}".format(self.edges))
        return "{}\n\n{}".format(rep_str, super().report())
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: graphbrain/graphbrain
Commit Name: 66756de12d3f76d48774434bb210cab39a9590c0
Time: 2020-01-15
Author: telmo@telmomenezes.net
File Name: graphbrain/agents/txt_parser.py
Class Name: TxtParser
Method Name: input_file


Project Name: GoogleCloudPlatform/ml-on-gcp
Commit Name: b0207dc0cac04995271f030608d0f6ff8e8039d3
Time: 2019-08-08
Author: yuhanliu@google.com
File Name: example_zoo/tools/cmle_package.py
Class Name: CMLEPackage
Method Name: generate


Project Name: pantsbuild/pants
Commit Name: 24d8a1652b3bf99115c67ba9f47e06b172fe8e00
Time: 2015-10-09
Author: john.sirois@gmail.com
File Name: src/python/pants/engine/exp/mapper.py
Class Name: AddressMap
Method Name: parse