I’m working on a LangGraph project that will eventually generate reports automatically. I’m trying to count the total number of section headers, sub-section headers and sub-sub-section headers from the values in my “edited_outline” dictionary.
Below is the printed output of the current state. The dictionary key is “edited_outline” and the value is a long string of section, sub-section and sub-sub-section headers.
'edited_outline': 'Here is the refined report outline:n'
'n'
'**Section 1: Introduction to Management**n'
'n'
'1.1 Definition of Management and its significance in planningn'
'1.1.1 Importance of Management in the landscapen'
'1.2 Brief overview of the importance of Management for middle-aged working adultsn'
'n'
'**Section 2: Types of Challenges Faced by Middle-Aged Working Adults**n'
'n'
'2.1 Housing challenges and their impact on stabilityn'
'2.1.1 Case studies of middle-aged working adults struggling with housing paymentsn'
'2.2 Credit challenges and their effects on credit scoresn'
'2.2.1 Statistics on credit challengesn'
'2.3 Personal financial challenges and their implications on freedomn'
'2.3.1 Examples of personal financial traps and how to avoid themn'
'2.4 Business challenges and their risks for entrepreneursn'
'2.4.1 Case studies of entrepreneurs struggling with business financial issuesn'
'2.5 Tax challenges and their impact on planningn'
'2.5.1 Importance of tax planning in Managementn'
'n'
I have tried iterating through the value but have run into difficulties when filtering section headers from sub-section/sub-sub-section headers, due to their similar numbering.
Ryan Tan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.