|
@@ -1,8 +1,14 @@
|
|
|
import os
|
|
import os
|
|
|
import logging
|
|
import logging
|
|
|
|
|
+from pathlib import Path
|
|
|
from typing import List, Tuple
|
|
from typing import List, Tuple
|
|
|
from mylib.pdfzh_translator import OpenAITranslator
|
|
from mylib.pdfzh_translator import OpenAITranslator
|
|
|
|
|
+from mylib.read_encoding_cvs import read_csv
|
|
|
|
|
+from logging_config import setup_logging
|
|
|
|
|
+from mylib.logging_config import setup_logging
|
|
|
|
|
|
|
|
|
|
+# Setup custom logging
|
|
|
|
|
+setup_logging()
|
|
|
logger = logging.getLogger(__name__)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
def insert_empty_columns(data: List[List[str]], column_indices: List[int]) -> List[List[str]]:
|
|
def insert_empty_columns(data: List[List[str]], column_indices: List[int]) -> List[List[str]]:
|
|
@@ -103,7 +109,11 @@ def process_batch_translations(data: List[List[str]],
|
|
|
raise
|
|
raise
|
|
|
|
|
|
|
|
def main():
|
|
def main():
|
|
|
- pass
|
|
|
|
|
|
|
+ output_dir = Path('temp')
|
|
|
|
|
+ input_file = output_dir/"测试.csv"
|
|
|
|
|
+ output_file = output_dir/"processed_测试.csv"
|
|
|
|
|
+ data = read_csv(input_file)
|
|
|
|
|
+ process_batch_translations(data, 2)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
main()
|
|
main()
|