1+ # Table of Contents
2+
3+ * [ formfyxer.docx\_ wrangling] ( #formfyxer.docx_wrangling )
4+ * [ add\_ paragraph\_ after] ( #formfyxer.docx_wrangling.add_paragraph_after )
5+ * [ update\_ docx] ( #formfyxer.docx_wrangling.update_docx )
6+ * [ get\_ docx\_ repr] ( #formfyxer.docx_wrangling.get_docx_repr )
7+ * [ get\_ labeled\_ docx\_ runs] ( #formfyxer.docx_wrangling.get_labeled_docx_runs )
8+ * [ get\_ modified\_ docx\_ runs] ( #formfyxer.docx_wrangling.get_modified_docx_runs )
9+ * [ make\_ docx\_ plain\_ language] ( #formfyxer.docx_wrangling.make_docx_plain_language )
10+ * [ modify\_ docx\_ with\_ openai\_ guesses] ( #formfyxer.docx_wrangling.modify_docx_with_openai_guesses )
11+
112---
213sidebar_label: docx_wrangling
314title: formfyxer.docx_wrangling
415---
516
6- #### update\_ docx
17+ <a id =" formfyxer.docx_wrangling.add_paragraph_after " ></a >
18+
19+ #### add\_ paragraph\_ after(paragraph, text)
20+
21+ ``` python
22+ def add_paragraph_after (paragraph , text )
23+ ```
24+
25+ Wowza
26+
27+ <a id =" formfyxer.docx_wrangling.update_docx " ></a >
28+
29+ #### update\_ docx(document: Union[ docx.document.Document, str] , modified\_ runs: List[ Tuple[ int, int, str, int]] )
30+
31+ ``` python
32+ def update_docx (
33+ document : Union[docx.document.Document, str ],
34+ modified_runs : List[Tuple[int , int , str ,
35+ int ]]) -> docx.document.Document
36+ ```
737
838Update the document with the modified runs.
939
@@ -24,7 +54,15 @@ Take a careful look at the output document to make sure it is still correct.
2454
2555 The modified document.
2656
27- #### get\_ docx\_ repr
57+ < a id = " formfyxer.docx_wrangling.get_docx_repr" >< / a>
58+
59+ # ### get\_docx\_repr(docx\_path: str, paragraph\_start: int = 0, paragraph\_end: Optional[int] = None)
60+
61+ ```python
62+ def get_docx_repr (docx_path : str ,
63+ paragraph_start : int = 0 ,
64+ paragraph_end : Optional[int ] = None )
65+ ```
2866
2967Return a JSON representation of the paragraphs and runs in the DOCX file.
3068
@@ -37,7 +75,18 @@ Return a JSON representation of the paragraphs and runs in the DOCX file.
3775
3876 A JSON representation of the paragraphs and runs in the DOCX file.
3977
40- #### get\_ labeled\_ docx\_ runs
78+ <a id =" formfyxer.docx_wrangling.get_labeled_docx_runs " ></a >
79+
80+ #### get\_ labeled\_ docx\_ runs(docx\_ path: Optional[ str] = None, docx\_ repr=Optional[ str] , custom\_ people\_ names: Optional[ Tuple[ str, str]] = None, openai\_ client: Optional[ OpenAI] = None, api\_ key: Optional[ str] = None)
81+
82+ ``` python
83+ def get_labeled_docx_runs (
84+ docx_path : Optional[str ] = None ,
85+ docx_repr = Optional[str ],
86+ custom_people_names : Optional[Tuple[str , str ]] = None ,
87+ openai_client : Optional[OpenAI] = None ,
88+ api_key : Optional[str ] = None ) -> List[Tuple[int , int , str , int ]]
89+ ```
4190
4291Scan the DOCX and return a list of modified text with Jinja2 variable names inserted.
4392
@@ -52,7 +101,19 @@ Scan the DOCX and return a list of modified text with Jinja2 variable names inse
52101
53102 A list of tuples, each containing a paragraph number, run number, and the modified text of the run.
54103
55- #### get\_ modified\_ docx\_ runs
104+ < a id = " formfyxer.docx_wrangling.get_modified_docx_runs" >< / a>
105+
106+ # ### get\_modified\_docx\_runs(docx\_path: Optional[str] = None, docx\_repr: Optional[str] = None, custom\_example: str = "", instructions: str = "", openai\_client: Optional[OpenAI] = None, api\_key: Optional[str] = None, temperature=0.5)
107+
108+ ```python
109+ def get_modified_docx_runs (docx_path : Optional[str ] = None ,
110+ docx_repr : Optional[str ] = None ,
111+ custom_example : str = " " ,
112+ instructions : str = " " ,
113+ openai_client : Optional[OpenAI] = None ,
114+ api_key : Optional[str ] = None ,
115+ temperature = 0.5 ) -> List[Tuple[int , int , str , int ]]
116+ ```
56117
57118Use GPT to rewrite the contents of a DOCX file paragraph by paragraph. Does not handle tables, footers, or
58119other structures yet.
@@ -104,11 +165,23 @@ You may also want to customize the input example to better match your use case.
104165
105166 A list of tuples, each containing a paragraph number, run number, and the modified text of the run.
106167
107- #### make\_ docx\_ plain\_ language
168+ < a id =" formfyxer.docx_wrangling.make_docx_plain_language" >< / a>
169+
170+ # ### make\_docx\_plain\_language(docx\_path: str)
171+
172+ ```python
173+ def make_docx_plain_language(docx_path: str ) -> docx.document.Document
174+ ```
108175
109176Convert a DOCX file to plain language with the help of OpenAI.
110177
111- #### modify\_ docx\_ with\_ openai\_ guesses
178+ < a id =" formfyxer.docx_wrangling.modify_docx_with_openai_guesses" >< / a>
179+
180+ # ### modify\_docx\_with\_openai\_guesses(docx\_path: str)
181+
182+ ```python
183+ def modify_docx_with_openai_guesses(docx_path: str ) -> docx.document.Document
184+ ```
112185
113186Uses OpenAI to guess the variable names for a document and then modifies the document with the guesses.
114187
0 commit comments