The purpose of this library is to serve as a reliable and simple library to reassemble docx documents after they have been treated using AI/machine learning text treatment.
Project description
mod_docx
The purpose of this library is to serve as a reliable and simple library to reassemble docx documents after they have been treated using AI/machine learning text treatment.
Example of library usage
import os
import sys
sys.path.insert(1, '/usr/lib/python3.11/site-packages')
import mod_docx
[Step 0] Open the docx file as an XML object
Obtain the orignal docx file
fpath = ".../mod_docx/tests"
fichier = "test_document.docx"
docx_filename = os.path.join(fpath, fichier)
Create a class object for the name_of_file.class_name. Use the class object, to call the functions in the class.
md = mod_docx.mod_docx(docx_filename)
Convert the orignal docx file to XML
document_org = md.opendocx(docx_filename)
[Step 1] Modify the document
[To be completed for next version] Modify the document as desired (ie: replace text, change style, change font)
doc_finale = document_org
[Step 2] Save the changed XML document as a docx file
root_dir = f'{fpath}/'
desired_output_docx_name = 'test_document_out.docx'
md.savedocx_ver_fichier(docx_filename, root_dir, desired_output_docx_name, doc_finale)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mod_docx-0.1.0.tar.gz.
File metadata
- Download URL: mod_docx-0.1.0.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12199685cacdf93eeea907626a8c893c8cba039e9b5e3fd439d727215640397b
|
|
| MD5 |
7274834896920e5fc392816499888546
|
|
| BLAKE2b-256 |
048641076a2d05cccaa7dec28906013c0173fec2e0a6e276044b35a029451db2
|
File details
Details for the file mod_docx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mod_docx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5390696f01b0c3c6abf39f0de7c0711320a8da4d37404b5f571ee5681143ffa6
|
|
| MD5 |
42bf24503dfa148969a22944d2389c2c
|
|
| BLAKE2b-256 |
4a31b14fb27fb3c1dd13bb458fbdea0c7e2fd4cac7c705399cf6e8d4c05ea036
|