-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbase.py
More file actions
32 lines (24 loc) · 884 Bytes
/
base.py
File metadata and controls
32 lines (24 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Dict, Optional, Tuple
class MetadataExtractor(ABC):
"""Base interface for metadata extractors."""
@abstractmethod
def extract(
self, content: str, file_path: Optional[Path] = None
) -> Tuple[str, Dict]:
"""Extract metadata from content.
Args:
content: The raw content to extract metadata from
file_path: Optional file path for context
Returns:
Tuple of (clean_content, metadata_dict)
"""
@abstractmethod
def supports_file_type(self, file_extension: str) -> bool:
"""Check if this extractor supports the given file type.
Args:
file_extension: File extension (e.g., '.md', '.pdf')
Returns:
True if this extractor can handle the file type
"""