| Metadata | Value |
|---|---|
| Status | Completed |
| Version | 1.2.0 |
| Last Updated | 2026-02-03 |
| Author | Sangita Grantha Team |
Shift the primary responsibility for Lyric and Section Extraction from the LLM-based WebScrapingService to the deterministic TextBlocker component. This ensures consistent, accurate parsing of standard formats (like guru-guha.blogspot.com) while reserving the LLM for high-value enrichment (metadata, meaning, translations).
WebScrapingService fetches HTML, extracts text, and sends it to Gemini to parse sections (Pallavi, Charanam, etc.) and metadata. TextBlocker is used mainly to structure the prompt, with a fallback logic (deriveSectionsFromBlocks) that is secondary.TextBlocker already identifies blocks. We can promote it to be the definitive source for sections, significantly reducing LLM load and increasing reliability for supported formats.TextBlocker (The Parser)TextBlocker to return strongly-typed List<ScrapedSectionDto> instead of just PromptBlocks.WebScrapingService) into TextBlocker or a dedicated SectionMapper.guru-guha specific patterns:
Samashti Charanam followed by (madhyama kAla sAhityam).MADHYAMA_KALA is a section in our Enum).bAla kucAmbikE).WebScrapingService (The Orchestrator)scrapeKrithi flow:
TextBlocker.extractSections().TextBlocker returns a valid set of sections (e.g., contains PALLAVI), prioritize these sections.TextBlocker sections + Gemini Metadata.https://guru-guha.blogspot.com/2008/02/dikshitar-kriti-bala-kuchambike-raga.html.MADHYAMA_KALA is correctly extracted.TextBlocker to support deterministic section extraction using extractSections method. Added mapping for RagaSectionDto.TextBlocker regex to support (madhyama kAla sAhityam) and variations, mapping them to MADHYAMA_KALA.WebScrapingService to prioritize sections extracted by TextBlocker and adjusted the Gemini prompt to focus on metadata when sections are already found.HEADER META.TextBlockerTest (including bAla kRshNaM bhAvayAmi case) and WebScrapingServiceTest. All tests passed.TextBlocker and optimized WebScrapingService. Now, if deterministic sections/variants are found, the prompt sent to Gemini EXCLUDES the lyric blocks, reducing token usage by ~90% while preserving multi-script data.TextBlocker to KrithiStructureParser to reflect its evolved role.label property, preserving the “Garland” structure.modules/backend/api/src/main/kotlin/com/sangita/grantha/backend/api/services/scraping/TextBlocker.ktmodules/backend/api/src/main/kotlin/com/sangita/grantha/backend/api/services/WebScrapingService.kt