feat: enhance Earthing & Lighting layout sensitivity, un-gate tag classifier, fix deliverable exports & property access
- Un-gated pattern loops across all drawing types in tag_classifier.py - Added missing EARTH_PIT_TAG & BOND_CONDUCTOR_TAG passes and expanded IEEE 80 / IS 3043 earthing patterns - Expanded Luminaire, Distribution Panel, and Circuit search patterns - Added smart compiler defaults for materials, dimensions, and resistance limits in compiler.py - Un-gated EARTHED_TO and FEEDS topological relations mapping across all drawings in line_tracer.py - Fixed EquipmentItem missing location attribute error in models.py and output_generator.py - Fixed Relationship missing source_tag attribute error by adding property getters in models.py - Updated SmartPlant CSV and Excel generators to export RELATIONSHIP rows and dynamic Earthing/Equipment sheets - Updated README.md and .gitignore
This commit is contained in:
@@ -282,8 +282,8 @@ class TextRecognitionAgent(BaseAgent):
|
||||
except Exception as pdf_err:
|
||||
logger.warning(f"PyMuPDF vector text extraction failed ({pdf_err}).")
|
||||
|
||||
# Option C: Local PaddleOCR / PaddleOCR-VL baseline
|
||||
if not ocr_items or ocr_engine in ("paddle", "pdf_text", "paddle_vl", "got-ocr", "local"):
|
||||
# Option C: Local PaddleOCR / PaddleOCR-VL baseline (only if vector text layer returned nothing)
|
||||
if not ocr_items:
|
||||
try:
|
||||
from src.utils.preprocess import preprocess_for_ocr
|
||||
from src.utils.paddle_ocr import run_paddle_ocr
|
||||
@@ -597,6 +597,17 @@ class PipelineRecognitionAgent(BaseAgent):
|
||||
text_elements = state.get("extracted_entities", {}).get("text_elements", [])
|
||||
symbols = state.get("extracted_entities", {}).get("symbols", [])
|
||||
|
||||
# Guarantee non-empty text_elements for line tracer even if running in parallel
|
||||
if not text_elements:
|
||||
try:
|
||||
from src.utils.paddle_ocr import run_paddle_ocr
|
||||
from src.utils.tag_classifier import classify_paddle_results
|
||||
raw_ocr = run_paddle_ocr(raw_image)
|
||||
text_elements = classify_paddle_results(raw_ocr, drawing_type)
|
||||
logger.info(f"PipelineRecognitionAgent fallback OCR loaded {len(text_elements)} text elements.")
|
||||
except Exception as e:
|
||||
logger.warning(f"PipelineRecognitionAgent fallback OCR failed: {e}")
|
||||
|
||||
cv_res = trace_lines_and_connections(
|
||||
image_path=raw_image,
|
||||
text_elements=text_elements,
|
||||
|
||||
Reference in New Issue
Block a user