ba4c25a77488026fb6212790c4d460e2c76db326,graphbrain/cognition/agents/reddit_parser.py,RedditParser,_parse_title,#RedditParser#Any#Any#,36

Before Change


        parts = title_parts(text)

        title_edge = ["title/P/.reddit", author]
        tags = []
        for part in parts:
            parse_results = parser.parse(part)
            for parse in parse_results["parses"]:
                main_edge = parse["resolved_corefs"]

                // add main edge
                if main_edge:
                    // attach text to edge
                    text = parse["text"]
                    attr = {"text": text}
                    yield create_op(main_edge, attributes=attr)

                    // add extra edges
                    for edge in parse["extra_edges"]:
                        yield create_op(edge)

                    if main_edge.type()[0] == "R":
                        title_edge.append(main_edge)
                    else:
                        tags.append(main_edge)
            for edge in parse_results["inferred_edges"]:
                yield create_op(edge, count=True)

        if len(title_edge) > 2:
            // add title edge
            yield create_op(title_edge)
            self.titles_added += 1

            // add title tags
            if len(tags) > 0:
                tags_edge = ["tags/P/.reddit", title_edge] + tags
                yield create_op(tags_edge)

        self.titles_parsed += 1

    def _parse_post(self, post):
        author = build_atom(post["author"], "C", "reddit.user")

After Change


        title_edge = ["title/P/.reddit", author]
        for part in parts:
            parse_results = parser.parse(part)
            for op in self.parse_results2ops(parse_results):
                yield op

            for parse in parse_results["parses"]:
                if "resolved_corefs" in parse:
                    main_edge = parse["resolved_corefs"]
                else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: graphbrain/graphbrain
Commit Name: ba4c25a77488026fb6212790c4d460e2c76db326
Time: 2021-01-09
Author: telmo@telmomenezes.net
File Name: graphbrain/cognition/agents/reddit_parser.py
Class Name: RedditParser
Method Name: _parse_title


Project Name: graphbrain/graphbrain
Commit Name: be9467b5faed0506bda9dcdf231cc9fae3954170
Time: 2020-06-16
Author: telmo@telmomenezes.net
File Name: graphbrain/agents/txt_parser.py
Class Name:
Method Name: paragraphs


Project Name: mathics/Mathics
Commit Name: f592ce49086098fe835de68a7ee7bf49967b14ad
Time: 2016-08-22
Author: Bernhard.Liebl@gmx.org
File Name: mathics/algorithm/clusters.py
Class Name:
Method Name: _shuffled_range