Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mod_docx-0.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

mod_docx-0.1.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

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

Hashes for mod_docx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 12199685cacdf93eeea907626a8c893c8cba039e9b5e3fd439d727215640397b
MD5 7274834896920e5fc392816499888546
BLAKE2b-256 048641076a2d05cccaa7dec28906013c0173fec2e0a6e276044b35a029451db2

See more details on using hashes here.

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

Hashes for mod_docx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5390696f01b0c3c6abf39f0de7c0711320a8da4d37404b5f571ee5681143ffa6
MD5 42bf24503dfa148969a22944d2389c2c
BLAKE2b-256 4a31b14fb27fb3c1dd13bb458fbdea0c7e2fd4cac7c705399cf6e8d4c05ea036

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page