| 14 | from __future__ import annotations |
| 15 | |
| 16 | class PaperNode: |
| 17 | def __init__(self, attrs): |
| 18 | self.title = attrs.get("title", "") |
| 19 | self.arxiv_id = attrs.get("arxiv_id", "") |
| 20 | self.depth = attrs.get("depth", -1) |
| 21 | self.child = {k: [PaperNode(i) for i in v] for k, v in attrs.get("child", {}).items()} |
| 22 | self.abstract = attrs.get("abstract", "") |
| 23 | self.sections = attrs.get("sections", "") # section name -> list of citation papers |
| 24 | self.source = attrs.get("source", "Root") # Root, Search, Expand |
| 25 | self.select_score = attrs.get("select_score", 0.0) # the result of the selecte model |
| 26 | self.extra = attrs.get("extra", {}) |
| 27 | |
| 28 | def todic(self): |
| 29 | return { |
| 30 | "title": self.title, |
| 31 | "arxiv_id": self.arxiv_id, |
| 32 | "depth": self.depth, |
| 33 | "child": {k: [i.todic() for i in v] for k, v in self.child.items()}, |
| 34 | "abstract": self.abstract, |
| 35 | "sections": self.sections, |
| 36 | "source": self.source, |
| 37 | "select_score": self.select_score, |
| 38 | "extra": self.extra, |
| 39 | } |
| 40 | |
| 41 | @staticmethod |
| 42 | def sort_paper(item): |
| 43 | return item.select_score |
no outgoing calls
no test coverage detected