Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
refactor(parse): standardize module docstrings to match normalize module format
KaifAhmad1e7e849617179
diff --git a/semantica/parse/__init__.py b/semantica/parse/__init__.pyindex 7e23006f..b2270b1e 100644--- a/semantica/parse/__init__.py+++ b/semantica/parse/__init__.py@@ -1,15 +1,49 @@"""Data Parsing Module-This module provides comprehensive data parsing capabilities for various file formats.+This module provides comprehensive data parsing capabilities for various file formats,+enabling extraction of text, metadata, and structured data from documents, web content,+emails, code files, and media files.-Exports:+Key Features:+ - Document format parsing (PDF, DOCX, PPTX, HTML, TXT)+ - Web content parsing (HTML, XML, JavaScript-rendered content)+ - Structured data parsing (JSON, CSV, XML, YAML)+ - Email content parsing (headers, body, attachments, threads)+ - Source code parsing (multi-language, syntax trees, dependencies)+ - Media content parsing (images, audio, video metadata)+ - Batch processing support+ - Metadata extraction+ - Content structure analysis++Main Classes:- DocumentParser: Document format parsing (PDF, DOCX, etc.)- WebParser: Web content parsing (HTML, XML, etc.)- StructuredDataParser: Structured data parsing (JSON, CSV, etc.)- EmailParser: Email content parsing- CodeParser: Source code parsing- MediaParser: Media content parsing+ - PDFParser: PDF document parser+ - DOCXParser: Word document parser+ - PPTXParser: PowerPoint parser+ - ExcelParser: Excel spreadsheet parser+ - HTMLParser: HTML document parser+ - JSONParser: JSON data parser+ - CSVParser: CSV data parser+ - XMLParser: XML document parser+ - ImageParser: Image file parser with OCR++Example Usage:+ >>> from semantica.parse import DocumentParser, WebParser, StructuredDataParser+ >>> doc_parser = DocumentParser()+ >>> text = doc_parser.parse_document("document.pdf")+ >>> web_parser = WebParser()+ >>> content = web_parser.parse_html("https://example.com")+ >>> data_parser = StructuredDataParser()+ >>> data = data_parser.parse_json("data.json")++Author: Semantica Contributors+License: MIT"""from .document_parser import DocumentParserdiff --git a/semantica/parse/code_parser.py b/semantica/parse/code_parser.pyindex 799353af..b6500338 100644--- a/semantica/parse/code_parser.py+++ b/semantica/parse/code_parser.py@@ -1,20 +1,36 @@"""Source Code Parsing Module-Handles parsing of source code files and repositories.+This module handles parsing of source code files and repositories, providing+syntax tree analysis, code structure extraction, comment parsing, and dependency+analysis for multiple programming languages.Key Features:- - Multi-language code parsing- - Syntax tree analysis- - Code structure extraction+ - Multi-language code parsing (Python, JavaScript, Java, etc.)+ - Syntax tree analysis using AST+ - Code structure extraction (functions, classes, imports)- Comment and documentation parsing- Dependency analysis+ - Code metadata extraction+ - Repository-wide analysisMain Classes:- CodeParser: Main code parsing class- SyntaxTreeParser: Syntax tree analyzer- CommentExtractor: Code comment processor- DependencyAnalyzer: Code dependency analyzer+ - CodeStructure: Dataclass for code structure representation+ - CodeComment: Dataclass for code comment representation++Example Usage:+ >>> from semantica.parse import CodeParser+ >>> parser = CodeParser()+ >>> structure = parser.parse_file("script.py")+ >>> comments = parser.extract_comments("script.py")+ >>> dependencies = parser.analyze_dependencies("script.py")++Author: Semantica Contributors+License: MIT"""import astdiff --git a/semantica/parse/csv_parser.py b/semantica/parse/csv_parser.pyindex a6117a87..495d6491 100644--- a/semantica/parse/csv_parser.py+++ b/semantica/parse/csv_parser.py@@ -1,7 +1,30 @@"""-CSV document parser for Semantica framework.+CSV Document Parser Module-This module handles CSV file parsing for structured data extraction.+This module handles CSV file parsing for structured data extraction, supporting+various delimiters, encodings, and data type conversions.++Key Features:+ - CSV file parsing with configurable delimiters+ - Header detection and extraction+ - Data type conversion and validation+ - Large file processing support+ - Encoding detection and handling+ - Row and column filtering++Main Classes:+ - CSVParser: CSV document parser+ - CSVData: Dataclass for CSV data representation++Example Usage:+ >>> from semantica.parse import CSVParser+ >>> parser = CSVParser()+ >>> data = parser.parse("data.csv", delimiter=",")+ >>> rows = parser.parse_to_dict("data.csv")+ >>> headers = data.headers++Author: Semantica Contributors+License: MIT"""import csvdiff --git a/semantica/parse/document_parser.py b/semantica/parse/document_parser.pyindex f53c50ee..15b01805 100644--- a/semantica/parse/document_parser.py+++ b/semantica/parse/document_parser.py@@ -1,7 +1,8 @@"""Document Parsing Module-Handles parsing of various document formats.+This module handles parsing of various document formats including PDF, DOCX,+HTML, and plain text files, extracting text content, metadata, and document structure.Key Features:- PDF text and metadata extraction@@ -9,9 +10,22 @@ Key Features:- HTML content cleaning- Plain text processing- Document structure analysis+ - Batch document processing+ - Password-protected document handling+ - Embedded image and table extractionMain Classes:- DocumentParser: Main document parsing class++Example Usage:+ >>> from semantica.parse import DocumentParser+ >>> parser = DocumentParser()+ >>> text = parser.parse_document("document.pdf")+ >>> metadata = parser.extract_metadata("document.docx")+ >>> documents = parser.parse_batch(["doc1.pdf", "doc2.docx"])++Author: Semantica Contributors+License: MIT"""from pathlib import Pathdiff --git a/semantica/parse/docx_parser.py b/semantica/parse/docx_parser.pyindex db3dba7b..6d0df0d3 100644--- a/semantica/parse/docx_parser.py+++ b/semantica/parse/docx_parser.py@@ -1,8 +1,31 @@"""-Word document parser for Semantica framework.+Word Document Parser Module-This module handles DOCX document parsing using python-docx-for text, formatting, and structure extraction.+This module handles DOCX document parsing using python-docx for text, formatting,+and structure extraction, including sections, paragraphs, tables, and metadata.++Key Features:+ - DOCX text and formatting extraction+ - Document structure analysis (sections, headings)+ - Table extraction+ - Metadata extraction (title, author, dates)+ - Paragraph and style information+ - Embedded image handling++Main Classes:+ - DOCXParser: DOCX document parser+ - DocxSection: Dataclass for document section representation+ - DocxMetadata: Dataclass for document metadata representation++Example Usage:+ >>> from semantica.parse import DOCXParser+ >>> parser = DOCXParser()+ >>> text = parser.parse("document.docx")+ >>> sections = parser.extract_sections("document.docx")+ >>> metadata = parser.extract_metadata("document.docx")++Author: Semantica Contributors+License: MIT"""from dataclasses import dataclass, fielddiff --git a/semantica/parse/email_parser.py b/semantica/parse/email_parser.pyindex 27b8e0bf..b9c935bc 100644--- a/semantica/parse/email_parser.py+++ b/semantica/parse/email_parser.py@@ -1,19 +1,35 @@"""Email Content Parsing Module-Handles parsing of email content and metadata.+This module handles parsing of email content and metadata, including headers,+MIME messages, body content, attachments, and email thread analysis.Key Features:- - Email header parsing+ - Email header parsing (From, To, CC, BCC, Subject, Date)- MIME message processing- - Email body content extraction+ - Email body content extraction (plain text, HTML)- Attachment handling- Email thread analysis+ - Encoded header decoding+ - Multi-part message processingMain Classes:- EmailParser: Main email parsing class- MIMEParser: MIME message parser- EmailThreadAnalyzer: Email thread processor+ - EmailHeaders: Dataclass for email headers+ - EmailBody: Dataclass for email body content+ - EmailData: Dataclass for complete email data++Example Usage:+ >>> from semantica.parse import EmailParser+ >>> parser = EmailParser()+ >>> email_data = parser.parse("email.eml")+ >>> headers = parser.parse_headers("email.eml")+ >>> thread = parser.analyze_thread("email.eml")++Author: Semantica Contributors+License: MIT"""import emaildiff --git a/semantica/parse/excel_parser.py b/semantica/parse/excel_parser.pyindex c6709569..81c2cb7b 100644--- a/semantica/parse/excel_parser.py+++ b/semantica/parse/excel_parser.py@@ -1,8 +1,31 @@"""-Excel document parser for Semantica framework.+Excel Document Parser Module-This module handles Excel file parsing using openpyxl and pandas-for spreadsheet data extraction.+This module handles Excel file parsing using openpyxl and pandas for spreadsheet+data extraction, supporting multiple sheets, formulas, and metadata.++Key Features:+ - Excel spreadsheet parsing (XLSX, XLS)+ - Multiple sheet support+ - Data extraction with pandas+ - Formula and cell value extraction+ - Metadata extraction+ - Large file processing++Main Classes:+ - ExcelParser: Excel document parser+ - ExcelSheet: Dataclass for Excel sheet representation+ - ExcelData: Dataclass for Excel workbook representation++Example Usage:+ >>> from semantica.parse import ExcelParser+ >>> parser = ExcelParser()+ >>> data = parser.parse("spreadsheet.xlsx")+ >>> sheet = parser.parse_sheet("spreadsheet.xlsx", "Sheet1")+ >>> sheets = data.sheets++Author: Semantica Contributors+License: MIT"""from dataclasses import dataclass, fielddiff --git a/semantica/parse/html_parser.py b/semantica/parse/html_parser.pyindex 5d9cf2af..305469fe 100644--- a/semantica/parse/html_parser.py+++ b/semantica/parse/html_parser.py@@ -1,8 +1,31 @@"""-HTML document parser for Semantica framework.+HTML Document Parser Module-This module handles HTML parsing using BeautifulSoup and lxml-for content extraction and structure analysis.+This module handles HTML parsing using BeautifulSoup and lxml for content extraction+and structure analysis, including metadata, links, and element extraction.++Key Features:+ - HTML content parsing and cleaning+ - Metadata extraction (title, description, Open Graph, Twitter cards)+ - Link and media extraction+ - Element structure analysis+ - Text content extraction+ - BeautifulSoup integration++Main Classes:+ - HTMLParser: HTML document parser+ - HTMLMetadata: Dataclass for HTML metadata representation+ - HTMLElement: Dataclass for HTML element representation++Example Usage:+ >>> from semantica.parse import HTMLParser+ >>> parser = HTMLParser()+ >>> text = parser.parse("page.html")+ >>> metadata = parser.extract_metadata("page.html")+ >>> links = parser.extract_links("page.html")++Author: Semantica Contributors+License: MIT"""from dataclasses import dataclass, fielddiff --git a/semantica/parse/image_parser.py b/semantica/parse/image_parser.pyindex f26e714c..f7f920c1 100644--- a/semantica/parse/image_parser.py+++ b/semantica/parse/image_parser.py@@ -1,8 +1,31 @@"""-Image parser for Semantica framework.+Image Parser Module-This module handles image parsing using Tesseract OCR and PIL-for text extraction and image analysis.+This module handles image parsing using Tesseract OCR and PIL for text extraction+and image analysis, including metadata extraction and OCR processing.++Key Features:+ - Image metadata extraction (EXIF, format, size)+ - OCR text extraction using Tesseract+ - Image format support (JPEG, PNG, GIF, BMP, TIFF)+ - Image analysis and properties+ - Optional Tesseract OCR integration+ - PIL/Pillow integration++Main Classes:+ - ImageParser: Image parser for OCR and metadata extraction+ - ImageMetadata: Dataclass for image metadata representation+ - OCRResult: Dataclass for OCR result representation++Example Usage:+ >>> from semantica.parse import ImageParser+ >>> parser = ImageParser()+ >>> metadata = parser.extract_metadata("image.jpg")+ >>> ocr_result = parser.extract_text("image.jpg")+ >>> text = ocr_result.text++Author: Semantica Contributors+License: MIT"""from dataclasses import dataclass, fielddiff --git a/semantica/parse/json_parser.py b/semantica/parse/json_parser.pyindex 0e42fdaf..0f14ee68 100644--- a/semantica/parse/json_parser.py+++ b/semantica/parse/json_parser.py@@ -1,7 +1,30 @@"""-JSON document parser for Semantica framework.+JSON Document Parser Module-This module handles JSON file parsing for structured data extraction.+This module handles JSON file parsing for structured data extraction, supporting+nested structures, arrays, and various data types with validation and flattening.++Key Features:+ - JSON file and string parsing+ - Nested structure handling+ - Data type validation+ - Structure flattening+ - JSON path extraction+ - Large file processing++Main Classes:+ - JSONParser: JSON document parser+ - JSONData: Dataclass for JSON data representation++Example Usage:+ >>> from semantica.parse import JSONParser+ >>> parser = JSONParser()+ >>> data = parser.parse("data.json")+ >>> flattened = parser.parse("data.json", flatten=True)+ >>> paths = parser.extract_paths("data.json")++Author: Semantica Contributors+License: MIT"""import jsondiff --git a/semantica/parse/media_parser.py b/semantica/parse/media_parser.pyindex 9483bda8..4008c671 100644--- a/semantica/parse/media_parser.py+++ b/semantica/parse/media_parser.py@@ -1,7 +1,8 @@"""Media Content Parsing Module-Handles parsing of media files and content.+This module handles parsing of media files and content, including images, audio,+and video files, extracting metadata and analyzing media characteristics.Key Features:- Image metadata extraction@@ -9,12 +10,21 @@ Key Features:- Video metadata analysis- Media file information extraction- Content type detection+ - Format support detection+ - Batch media processingMain Classes:- MediaParser: Main media parsing class- - ImageParser: Image file parser- - AudioParser: Audio file parser- - VideoParser: Video file parser++Example Usage:+ >>> from semantica.parse import MediaParser+ >>> parser = MediaParser()+ >>> metadata = parser.parse("image.jpg")+ >>> info = parser.get_media_info("video.mp4")+ >>> formats = parser.get_supported_formats()++Author: Semantica Contributors+License: MIT"""from pathlib import Pathdiff --git a/semantica/parse/pdf_parser.py b/semantica/parse/pdf_parser.pyindex 9b54ed32..9c68df4f 100644--- a/semantica/parse/pdf_parser.py+++ b/semantica/parse/pdf_parser.py@@ -1,8 +1,31 @@"""-PDF document parser for Semantica framework.+PDF Document Parser Module-This module handles PDF document parsing using PyPDF2 and pdfplumber-for text, table, and image extraction.+This module handles PDF document parsing using PyPDF2 and pdfplumber for text,+table, and image extraction, including metadata and page-level processing.++Key Features:+ - PDF text extraction+ - Table extraction from PDFs+ - Image extraction+ - Metadata extraction (title, author, dates)+ - Page-level processing+ - Multi-page document support++Main Classes:+ - PDFParser: PDF document parser+ - PDFPage: Dataclass for PDF page representation+ - PDFMetadata: Dataclass for PDF metadata representation++Example Usage:+ >>> from semantica.parse import PDFParser+ >>> parser = PDFParser()+ >>> text = parser.parse("document.pdf")+ >>> pages = parser.extract_pages("document.pdf")+ >>> metadata = parser.extract_metadata("document.pdf")++Author: Semantica Contributors+License: MIT"""import iodiff --git a/semantica/parse/pptx_parser.py b/semantica/parse/pptx_parser.pyindex c685bc3d..57dabf57 100644--- a/semantica/parse/pptx_parser.py+++ b/semantica/parse/pptx_parser.py@@ -1,8 +1,31 @@"""-PowerPoint document parser for Semantica framework.+PowerPoint Document Parser Module-This module handles PPTX file parsing using python-pptx-for presentation content extraction.+This module handles PPTX file parsing using python-pptx for presentation content+extraction, including slides, notes, shapes, and images.++Key Features:+ - PPTX presentation parsing+ - Slide content extraction+ - Notes and speaker notes extraction+ - Shape and image extraction+ - Presentation metadata+ - Multi-slide processing++Main Classes:+ - PPTXParser: PPTX document parser+ - SlideContent: Dataclass for slide content representation+ - PPTXData: Dataclass for PPTX presentation representation++Example Usage:+ >>> from semantica.parse import PPTXParser+ >>> parser = PPTXParser()+ >>> data = parser.parse("presentation.pptx")+ >>> slides = data.slides+ >>> title = data.title++Author: Semantica Contributors+License: MIT"""from dataclasses import dataclass, fielddiff --git a/semantica/parse/structured_data_parser.py b/semantica/parse/structured_data_parser.pyindex cce08803..8294d4a4 100644--- a/semantica/parse/structured_data_parser.py+++ b/semantica/parse/structured_data_parser.py@@ -1,7 +1,8 @@"""Structured Data Parsing Module-Handles parsing of structured data formats.+This module handles parsing of structured data formats including JSON, CSV, XML,+and YAML, providing validation, type conversion, and data transformation.Key Features:- JSON data parsing and validation@@ -9,9 +10,21 @@ Key Features:- XML data extraction- YAML configuration parsing- Data type conversion and validation+ - Nested structure handling+ - Batch processing supportMain Classes:- StructuredDataParser: Main structured data parser++Example Usage:+ >>> from semantica.parse import StructuredDataParser+ >>> parser = StructuredDataParser()+ >>> json_data = parser.parse_json("data.json")+ >>> csv_data = parser.parse_csv("data.csv")+ >>> xml_data = parser.parse_xml("data.xml")++Author: Semantica Contributors+License: MIT"""from pathlib import Pathdiff --git a/semantica/parse/web_parser.py b/semantica/parse/web_parser.pyindex c284c37c..6f5c46d6 100644--- a/semantica/parse/web_parser.py+++ b/semantica/parse/web_parser.py@@ -1,7 +1,8 @@"""Web Content Parsing Module-Handles parsing of web content and HTML documents.+This module handles parsing of web content and HTML documents, including JavaScript+rendering, content extraction, and web scraping support.Key Features:- HTML content parsing and cleaning@@ -9,11 +10,23 @@ Key Features:- Web scraping content extraction- JavaScript rendering support- Content structure analysis+ - Link and media extraction+ - BeautifulSoup integrationMain Classes:- WebParser: Main web content parser- HTMLContentParser: HTML-specific parser- JavaScriptRenderer: JavaScript rendering engine++Example Usage:+ >>> from semantica.parse import WebParser+ >>> parser = WebParser()+ >>> content = parser.parse_html("https://example.com")+ >>> text = parser.extract_text("https://example.com")+ >>> links = parser.extract_links("https://example.com")++Author: Semantica Contributors+License: MIT"""from pathlib import Pathdiff --git a/semantica/parse/xml_parser.py b/semantica/parse/xml_parser.pyindex bf93cd58..8c455be5 100644--- a/semantica/parse/xml_parser.py+++ b/semantica/parse/xml_parser.py@@ -1,8 +1,31 @@"""-XML document parser for Semantica framework.+XML Document Parser Module-This module handles XML file parsing using lxml and xml.etree-for structured data extraction.+This module handles XML file parsing using lxml and xml.etree for structured data+extraction, including namespace handling and element tree processing.++Key Features:+ - XML file and string parsing+ - Namespace handling+ - Element tree processing+ - Attribute and text extraction+ - XPath query support+ - Large file processing++Main Classes:+ - XMLParser: XML document parser+ - XMLElement: Dataclass for XML element representation+ - XMLData: Dataclass for XML document representation++Example Usage:+ >>> from semantica.parse import XMLParser+ >>> parser = XMLParser()+ >>> data = parser.parse("data.xml")+ >>> root = data.root+ >>> elements = parser.find_elements("data.xml", "//item")++Author: Semantica Contributors+License: MIT"""import io