Skip to content

Commit efff1a4

Browse files
Update voice-formatting-plan.mdx
1 parent 66145d2 commit efff1a4

File tree

1 file changed

+15
-126
lines changed

1 file changed

+15
-126
lines changed

fern/assistants/voice-formatting-plan.mdx

+15-126
Original file line numberDiff line numberDiff line change
@@ -20,132 +20,21 @@ You can turn off formatting if you want the TTS to read the raw LLM output.
2020

2121
When enabled, the formatter runs a series of transformations on your text, each handled by a specific function. Here's the order and what each function does:
2222

23-
<Steps>
24-
25-
<Step title="removeAngleBracketContent">
26-
Removes anything in `<...>`, except for `<break>`, `<spell>`, or double angle brackets `<< >>`.
27-
28-
**Example:**
29-
```
30-
Hello <tag> world
31-
**Wanted** to say *hi*
32-
...
33-
```
34-
Becomes:
35-
```
36-
Hello world
37-
**Wanted** to say *hi*
38-
...
39-
```
40-
</Step>
41-
42-
<Step title="removeMarkdownSymbols">
43-
Removes markdown characters like `_`, `` ` ``, and `~`. Some versions also remove double asterisks, but that might happen in the next step.
44-
45-
**Example:**
46-
```
47-
**Wanted** to say *hi*
48-
```
49-
If only `_`, backticks, and tildes are removed, asterisks remain for now.
50-
</Step>
51-
52-
<Step title="removePhrasesInAsterisks">
53-
Removes text wrapped in single or double asterisks.
54-
55-
**Example:**
56-
```
57-
**Wanted** to say *hi*
58-
```
59-
Becomes:
60-
```
61-
to say
62-
```
63-
</Step>
64-
65-
<Step title="replaceNewLinesWithPeriods">
66-
Converts line breaks to periods for smoother speech.
67-
68-
**Example:**
69-
```
70-
Hello world\n to say\nWe have NASA and .NET here,\ncall me at 123-456-7890,\nprice: $42.50\nand the date is 2023 05 10\nand time is 14:00\nDistance is 5km\nWe might see 9999\nthe address is 320 ST 21 RD\nmy email is JOHN.DOE@example.COM
71-
```
72-
Becomes:
73-
```
74-
Hello world . to say . We have NASA and .NET here, call me at 123-456-7890, price: $42.50 and the date is 2023 05 10 and time is 14:00 Distance is 5km We might see 9999 the address is 320 ST 21 RD my email is JOHN.DOE@example.COM
75-
```
76-
</Step>
77-
78-
<Step title="replaceColonsWithPeriods">
79-
Replaces `:` with `.` for better phrasing.
80-
81-
**Example:**
82-
```
83-
price: $42.50
84-
```
85-
Becomes:
86-
```
87-
price. $42.50
88-
```
89-
</Step>
90-
91-
<Step title="formatAcronyms">
92-
Converts known acronyms to lowercase or spaces out unknown all-caps words. If it's all-caps but not recognized, it might get spaced letters. If it has vowels, it's left alone.
93-
94-
**Example:**
95-
- `NASA``nasa`
96-
- `.NET``.net`
97-
</Step>
98-
99-
<Step title="formatDollarAmounts">
100-
Expands currency to words.
101-
102-
**Example:**
103-
- `$42.50` → "forty two dollars and fifty cents"
104-
</Step>
105-
106-
<Step title="formatEmails">
107-
Replaces `@` with "at" and `.` with "dot" in email addresses.
108-
109-
**Example:**
110-
- `JOHN.DOE@example.COM``JOHN dot DOE at example dot COM`
111-
</Step>
112-
113-
<Step title="formatDates">
114-
Converts date strings to spoken dates.
115-
116-
**Example:**
117-
- `2023 05 10` → "Wednesday, May 10, 2023"
118-
</Step>
119-
120-
<Step title="formatTimes">
121-
Expands time strings for clarity.
122-
123-
**Example:**
124-
- `14:00``14`
125-
</Step>
126-
127-
<Step title="formatDistances, formatUnits, formatPercentages, formatPhoneNumbers">
128-
- `5km` → "5 kilometers"
129-
- `43 lb` → "forty three pounds"
130-
- `50%` → "50 percent"
131-
- `123-456-7890` → "1 2 3 4 5 6 7 8 9 0"
132-
</Step>
133-
134-
<Step title="formatNumbers">
135-
- Years below the current year are read as digits (e.g., `2023`)
136-
- Large numbers above a cutoff are read as digits
137-
- Negative numbers: `-9` → "minus nine"
138-
- Decimals: `2.5` → "two point five"
139-
</Step>
140-
141-
<Step title="Applying Replacements">
142-
Runs user-defined replacements last, such as expanding street abbreviations.
143-
144-
**Example:**
145-
- `320 ST 21 RD``320 STREET 21 ROAD`
146-
</Step>
147-
148-
</Steps>
23+
| **Step** | **Function Name** | **Description** | **Before** | **After** |
24+
| :------- | :---------------- | :-------------- | :--------- | :-------- |
25+
| 1 | `removeAngleBracketContent` | Removes anything within `<...>`, except for `<break>`, `<spell>`, or double angle brackets `<< >>`. | `Hello <tag> world` | `Hello world` |
26+
| 2 | `removeMarkdownSymbols` | Removes markdown symbols like `_`, `` ` ``, and `~`. Asterisks (`*`) are preserved in this step. | `**Wanted** to say *hi*` | `**Wanted** to say *hi*` |
27+
| 3 | `removePhrasesInAsterisks` | Removes text surrounded by single or double asterisks. | `**Wanted** to say *hi*` | ` to say` |
28+
| 4 | `replaceNewLinesWithPeriods` | Converts new lines (`\n`) to periods for smoother speech. | `Hello world\n to say\nWe have NASA` | `Hello world . to say . We have NASA` |
29+
| 5 | `replaceColonsWithPeriods` | Replaces `:` with `.` for better phrasing. | `price: $42.50` | `price. $42.50` |
30+
| 6 | `formatAcronyms` | Converts known acronyms to lowercase (e.g., NASA → nasa) or spaces out unknown all-caps words unless they contain vowels. | `NASA and .NET` | `nasa and .net` |
31+
| 7 | `formatDollarAmounts` | Converts currency amounts to spoken words. | `$42.50` | `forty two dollars and fifty cents` |
32+
| 8 | `formatEmails` | Replaces `@` with "at" and `.` with "dot" in emails. | `JOHN.DOE@example.COM` | `JOHN dot DOE at example dot COM` |
33+
| 9 | `formatDates` | Converts date strings into spoken date format. | `2023 05 10` | `Wednesday, May 10, 2023` |
34+
| 10 | `formatTimes` | Expands or simplifies time expressions. | `14:00` | `14` |
35+
| 11 | `formatDistances`, `formatUnits`, `formatPercentages`, `formatPhoneNumbers` | Converts units, distances, percentages, and phone numbers into spoken words. | `5km`, `43 lb`, `50%`, `123-456-7890` | `5 kilometers`, `forty three pounds`, `50 percent`, `1 2 3 4 5 6 7 8 9 0` |
36+
| 12 | `formatNumbers` | Formats general numbers: years read as digits, large numbers spelled out, negative and decimal numbers clarified. | `-9`, `2.5`, `2023` | `minus nine`, `two point five`, `2023` |
37+
| 13 | `Applying Replacements` | Applies user-defined final replacements like expanding street abbreviations. | `320 ST 21 RD` | `320 STREET 21 ROAD` |
14938

15039
---
15140

0 commit comments

Comments
 (0)