Skip to content

Commit 4c99b18

Browse files
Stop making two folders for FormFyxer
Moves all of the generated `formfyxer` files into the `FormFyxer` folder.
1 parent a30dd15 commit 4c99b18

File tree

7 files changed

+624
-1314
lines changed

7 files changed

+624
-1314
lines changed

docs/components/FormFyxer/docx_wrangling.md

Lines changed: 79 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,39 @@
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
---
213
sidebar_label: docx_wrangling
314
title: 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

838
Update 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

2967
Return 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

4291
Scan 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

57118
Use GPT to rewrite the contents of a DOCX file paragraph by paragraph. Does not handle tables, footers, or
58119
other 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

109176
Convert 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

113186
Uses OpenAI to guess the variable names for a document and then modifies the document with the guesses.
114187

0 commit comments

Comments
 (0)