MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / normalize_paper

Function normalize_paper

scripts/collect_all_papers.py:75–88  ·  view source on GitHub ↗

统一不同来源的论文格式

(paper: Dict, source: str)

Source from the content-addressed store, hash-verified

73
74
75def normalize_paper(paper: Dict, source: str) -> Dict:
76 """统一不同来源的论文格式"""
77 return {
78 "arxiv_id": paper.get("arxiv_id", ""),
79 "doi": paper.get("doi", ""),
80 "title": paper.get("title", "Unknown"),
81 "abstract": paper.get("abstract", ""),
82 "authors": ",".join(paper.get("authors", [])) if isinstance(paper.get("authors"), list) else str(paper.get("authors", "")),
83 "categories": ",".join(paper.get("categories", [])) if isinstance(paper.get("categories"), list) else str(paper.get("categories", "")),
84 "venue": paper.get("venue", source),
85 "publish_date": paper.get("publish_date", "")[:10] if paper.get("publish_date") else "",
86 "pdf_url": paper.get("pdf_url", paper.get("url", "")),
87 "source": source,
88 }
89
90
91def save_paper(conn: sqlite3.Connection, paper: Dict) -> None:

Callers 1

collect_from_sourceFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected