Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AGI Edgerunners LLM Agents Papers read parsed by category

From Leeroopedia
Knowledge Sources
Domains Data_Organization, Data_Processing
Last Updated 2026-10-10 14:30 GMT

Overview

Concrete tool for grouping parsed paper metadata into a hierarchical category structure, provided by the LLM-Agents-Papers repository.

Description

The read_parsed_by_category function reads all JSON files from the parsed_v5/ folder and organizes paper records into a nested dict by their assigned categories. For each paper, it reads the category field (a list of [category, sub_category] pairs). Papers without categories are assigned to Others. The result is a two-level hierarchy: when a sub-category exists, papers are nested under {category: {sub_category: [papers]}}; when sub-category is None, papers are listed directly under {category: [papers]}.

Usage

Call this function when you need to access parsed papers organized by their assigned categories:

  • Grouping papers for README section generation (init calls this via parse_paper_section)
  • Retrieving all papers within a specific category or sub-category
  • Building category-based views over the parsed metadata

Code Reference

Source Location

Signature

PARSED_FOLDER = "parsed_v5"

def read_parsed_by_category() -> dict:
    """
    Read all parsed_v5/*.json files and group papers by category.

    Returns:
        Nested dict: {category: {sub_category: [paper_data, ...]}}
        when sub_category exists, or {category: [paper_data, ...]}
        when sub_category is None. Papers with no category go to 'Others'.
    """

Import

from script_v5_step2 import read_parsed_by_category

I/O Contract

Inputs

Name Type Required Description
PARSED_FOLDER str Yes Module-level constant pointing to parsed_v5 folder
parsed_v5/*.json Files Yes JSON files containing paper metadata keyed by MD5 hash

Outputs

Name Type Description
return dict Nested category hierarchy with paper data
Structure dict {category: {sub_category: [papers]}} or {category: [papers]}; uncategorized under Others

Usage Examples

Basic Category Grouping

from script_v5_step2 import read_parsed_by_category

# Group all parsed papers by category
grouped = read_parsed_by_category()

# Access papers in a specific category
survey_papers = grouped.get("Survey", [])
print(f"Survey papers: {len(survey_papers)}")

# Access papers in a sub-category
technique_papers = grouped.get("Technique For Enhancement", {})
planning_papers = technique_papers.get("Planning", [])
print(f"Planning papers: {len(planning_papers)}")

# Uncategorized papers
others = grouped.get("Others", [])
print(f"Uncategorized: {len(others)}")

Iterating All Categories

from script_v5_step2 import read_parsed_by_category

grouped = read_parsed_by_category()

for category, content in grouped.items():
    if isinstance(content, dict):
        # Has sub-categories
        for sub_category, papers in content.items():
            print(f"  {category} > {sub_category}: {len(papers)} papers")
    else:
        # Direct paper list (no sub-category)
        print(f"  {category}: {len(content)} papers")

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment