20 lines
687 B
Python
20 lines
687 B
Python
import docx
|
|
from models.document_processor import DocumentProcessor
|
|
|
|
class DocxDocumentProcessor(DocumentProcessor):
|
|
def __init__(self, input_path: str, output_path: str):
|
|
self.input_path = input_path
|
|
self.output_path = output_path
|
|
|
|
def read_content(self) -> str:
|
|
doc = docx.Document(self.input_path)
|
|
return '\n'.join([paragraph.text for paragraph in doc.paragraphs])
|
|
|
|
def process_content(self, content: str) -> str:
|
|
# Implementation for processing docx content
|
|
return content
|
|
|
|
def save_content(self, content: str) -> None:
|
|
doc = docx.Document()
|
|
doc.add_paragraph(content)
|
|
doc.save(self.output_path) |