Simple steps to prepare input JSON and upload texts, instances, and translations.
Source files live in json/. This script creates input_json/<incipit_title>/ folders with:
text_metadata.jsoninstance_payload.jsontranslation_payloads.json(only if translations exist)
Run:
python text_separater/build_input_json.pyCheck a single folder:
python text_separater/bdrc_checker.py --input-folder "/path/to/input_json/<incipit_title>"Check all folders:
python text_separater/bdrc_checker.py --all --input-root "/home/lungsang/Desktop/fodian_text_upload_task/input_json"Save results for reuse: ***********************************
python text_separater/bdrc_checker.py --all --input-root "/home/lungsang/Desktop/fodian_text_upload_task/input_json" --output "/home/lungsang/Desktop/fodian_text_upload_task/bdrc_cache.json"Upload a single folder:
python text_separater/text_upload.py --input-folder "/path/to/input_json/<incipit_title>" --skip-existing-bdrcUpload all folders:
python text_separater/text_upload.py --all --input-root "/home/lungsang/Desktop/fodian_text_upload_task/input_json" --skip-existing-bdrcUse saved BDRC results (avoid API lookups when skipping existing): ***************************
python text_separater/text_upload.py --all --input-root "/home/lungsang/Desktop/fodian_text_upload_task/input_json" --skip-existing-bdrc --bdrc-cache "/home/lungsang/Desktop/fodian_text_upload_task/bdrc_cache.json"Use translation_payloads.json and the instance ids returned from step 3.
Example translation plan (add instance_id):
[
{
"instance_id": "ABC12345678",
"language": "en",
"content": "Translated text...",
"title": "Translated Title",
"source": "Source of the translation"
}
]Run (single file):
python text_separater/translation_upload.py --input /path/to/translation_plan.jsonRun (all folders): *******************************************
for payload in "/home/lungsang/Desktop/fodian_text_upload_task/input_json"/*/translation_payloads.json; do \
python text_separater/translation_upload.py --input "$payload"; \
done- API base URL defaults to
https://api-aq25662yyq-uc.a.run.app. - Content must be a single string. Arrays are flattened and joined with
\n. - Use
--output <file>with any script to save results.