20 lines
625 B
Python
20 lines
625 B
Python
|
# services/translation/base.py
|
||
|
"""
|
||
|
Base class for translation services
|
||
|
"""
|
||
|
from abc import ABC, abstractmethod
|
||
|
from typing import Optional, List, Dict
|
||
|
|
||
|
class TranslationService(ABC):
|
||
|
"""Abstract base class for translation services"""
|
||
|
|
||
|
@abstractmethod
|
||
|
def translate_text(self, text: str, target_language: str, source_language: Optional[str] = None) -> str:
|
||
|
"""Translate a single text"""
|
||
|
pass
|
||
|
|
||
|
@abstractmethod
|
||
|
def translate_batch(self, texts: List[str], target_language: str, source_language: Optional[str] = None) -> List[str]:
|
||
|
"""Translate a batch of texts"""
|
||
|
pass
|