Spaces:
Runtime error
Runtime error
File size: 1,044 Bytes
e8216e0 |
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 |
"""Classe base abstrata para todos os processadores"""
from abc import ABC, abstractmethod
from typing import Dict, Any
from datetime import datetime
class ProcessorBase(ABC):
"""Classe base para processadores"""
def __init__(self, specialist_id: int, specialist_name: str):
self.specialist_id = specialist_id
self.specialist_name = specialist_name
self.confidence_score = 0
@abstractmethod
def process(self, acordao_data: Dict[str, Any]) -> Dict[str, Any]:
"""Processa acórdão"""
pass
@abstractmethod
def get_schema(self) -> Dict[str, Any]:
"""Retorna schema JSON"""
pass
def post_process(self, result: Dict[str, Any]) -> Dict[str, Any]:
"""Pós-processamento"""
return {
"specialist_id": self.specialist_id,
"specialist_name": self.specialist_name,
"result": result,
"confidence_score": self.confidence_score,
"timestamp": datetime.now().isoformat()
} |