Skip to content

Commit e685a32

Browse files
m-odsa-dinoto
andauthored
feat: scroll to highlighted lines in code blocks (#201)
* add custom js * test with ald * add custom js * add highlights to pre-recorded audio * add highlight to transcript-status/php * add highlight to select-speech-model/python * add highlights to select-speech-model * add highlight to select-language/c# * add highlights to speaker labels * more highlighting fixes * fix: add missing highlights in some code snippets * fix: minor adjustment to detecting low confidence words cookbook which was adjusted in cookbook repo --------- Co-authored-by: Amanda DiNoto <[email protected]>
1 parent fae94d3 commit e685a32

27 files changed

+221
-186
lines changed

cookbook-master/core-transcription/detecting-low-confidence-words.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const client = new AssemblyAI({
2323
Next create the transcript with your audio file, either via local audio file or URL (AssemblyAI's servers need to be able to access the URL, make sure the URL links to a downloadable file).
2424

2525
```javascript
26-
const transcript = await client.transcripts.create({
26+
const transcript = await client.transcripts.transcribe({
2727
audio_url: './sample.mp4',
2828
})
2929
```

fern/docs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ js:
88
strategy: beforeInteractive
99
- path: ./pre-recorded-audio-redirect.js
1010
strategy: beforeInteractive
11+
- path: ./scroll-highlighted-lines.js
12+
strategy: afterInteractive
1113
announcement:
1214
message: '🗝️ Multiple API keys and Projects are now available 🎉 (<a href="/docs/deployment/account-management" target="_blank" style="color: white;">Learn more</a>)'
1315
title: AssemblyAI | Documentation

fern/pages/02-speech-to-text/pre-recorded-audio/automatic-language-detection.mdx

+21-23
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To reliably identify the dominant language, the file must contain **at least 50
88

99
<CodeBlocks>
1010

11-
```python title="Python SDK"
11+
```python title="Python SDK" highlight={8,13} maxLines=15
1212
import assemblyai as aai
1313

1414
aai.settings.api_key = "<YOUR_API_KEY>"
@@ -24,7 +24,7 @@ print(transcript.text)
2424
print(transcript.json_response["language_code"])
2525
```
2626

27-
```python title="Python"
27+
```python title="Python" highlight={19} maxLines=15
2828
import requests
2929
import time
3030

@@ -69,7 +69,7 @@ while True:
6969

7070
```
7171

72-
```ts title="TypeScript SDK"
72+
```ts title="TypeScript SDK" highlight={13} maxLines=15
7373
import { AssemblyAI } from 'assemblyai'
7474

7575
const client = new AssemblyAI({
@@ -95,7 +95,7 @@ const run = async () => {
9595
run()
9696
```
9797

98-
```ts title="TypeScript"
98+
```ts title="TypeScript" highlight={19} maxLines=15
9999
import axios from 'axios'
100100
import fs from 'fs-extra'
101101

@@ -142,7 +142,7 @@ while (true) {
142142

143143
```
144144

145-
```csharp title="C#"
145+
```csharp title="C#" highlight={39} maxLines=15
146146
using System;
147147
using System.IO;
148148
using System.Net.Http;
@@ -229,7 +229,7 @@ using (var httpClient = new HttpClient())
229229
}
230230
```
231231

232-
```ruby title="Ruby"
232+
```ruby title="Ruby" highlight={23} maxLines=15
233233
require 'net/http'
234234
require 'json'
235235

@@ -295,7 +295,7 @@ while true
295295
end
296296
```
297297

298-
```php title="PHP"
298+
```php title="PHP" highlight={30} maxLines=15
299299
<?php
300300
$ch = curl_init();
301301
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -380,7 +380,7 @@ If language detection is enabled, the API returns a confidence score for the det
380380

381381
<CodeBlocks>
382382

383-
```python title="Python SDK"
383+
```python title="Python SDK" highlight={8,13} maxLines=15
384384
import assemblyai as aai
385385

386386
aai.settings.api_key = "<YOUR_API_KEY>"
@@ -396,7 +396,7 @@ print(transcript.text)
396396
print(transcript.json_response["language_confidence"])
397397
```
398398

399-
```python title="Python"
399+
```python title="Python" highlight={33} maxLines=15
400400
import requests
401401
import time
402402

@@ -441,7 +441,7 @@ while True:
441441

442442
```
443443

444-
```ts title="TypeScript SDK"
444+
```ts title="TypeScript SDK" highlight={20} maxLines=15
445445
import { AssemblyAI } from 'assemblyai'
446446

447447
const client = new AssemblyAI({
@@ -467,7 +467,7 @@ const run = async () => {
467467
run()
468468
```
469469

470-
```ts title="TypeScript"
470+
```ts title="TypeScript" highlight={36} maxLines=15
471471
import axios from 'axios'
472472
import fs from 'fs-extra'
473473

@@ -514,7 +514,7 @@ while (true) {
514514

515515
```
516516

517-
```csharp title="C#"
517+
```csharp title="C#" highlight={83} maxLines=15
518518
using System;
519519
using System.IO;
520520
using System.Net.Http;
@@ -601,7 +601,7 @@ using (var httpClient = new HttpClient())
601601
}
602602
```
603603

604-
```ruby title="Ruby"
604+
```ruby title="Ruby" highlight={55} maxLines=15
605605
require 'net/http'
606606
require 'json'
607607

@@ -667,7 +667,7 @@ while true
667667
end
668668
```
669669

670-
```php title="PHP"
670+
```php title="PHP" highlight={62} maxLines=15
671671
<?php
672672
$ch = curl_init();
673673
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -749,7 +749,7 @@ if the language confidence is below this threshold. Valid values are in the rang
749749

750750
<CodeBlocks>
751751

752-
```python title="Python SDK"
752+
```python title="Python SDK" highlight={8,13} maxLines=15
753753
import assemblyai as aai
754754

755755
aai.settings.api_key = "<YOUR_API_KEY>"
@@ -763,11 +763,9 @@ transcript = aai.Transcriber(config=config).transcribe(audio_file)
763763

764764
if transcript.status == "error":
765765
raise RuntimeError(f"Transcription failed: {transcript.error}")
766-
767-
print(transcript.text)
768766
```
769767

770-
```python title="Python"
768+
```python title="Python" highlight={20} maxLines=15
771769
import requests
772770
import time
773771

@@ -812,7 +810,7 @@ while True:
812810

813811
```
814812

815-
```ts title="TypeScript SDK"
813+
```ts title="TypeScript SDK" highlight={14} maxLines=15
816814
import { AssemblyAI } from 'assemblyai'
817815

818816
const client = new AssemblyAI({
@@ -843,7 +841,7 @@ const run = async () => {
843841
run()
844842
```
845843

846-
```ts title="TypeScript"
844+
```ts title="TypeScript" highlight={20} maxLines=15
847845
import axios from 'axios'
848846
import fs from 'fs-extra'
849847

@@ -891,7 +889,7 @@ while (true) {
891889

892890
```
893891

894-
```csharp title="C#"
892+
```csharp title="C#" highlight={39} maxLines=15
895893
using System;
896894
using System.IO;
897895
using System.Net.Http;
@@ -978,7 +976,7 @@ using (var httpClient = new HttpClient())
978976
}
979977
```
980978

981-
```ruby title="Ruby"
979+
```ruby title="Ruby" highlight={24} maxLines=15
982980
require 'net/http'
983981
require 'json'
984982

@@ -1045,7 +1043,7 @@ while true
10451043
end
10461044
```
10471045

1048-
```php title="PHP"
1046+
```php title="PHP" highlight={31} maxLines=15
10491047
<?php
10501048
$ch = curl_init();
10511049
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

fern/pages/02-speech-to-text/pre-recorded-audio/automatic-punctuation-and-casing.mdx

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You can disable this behavior by setting `punctuate` and `format_text` to `False
88

99
<Tabs>
1010
<Tab language="python-sdk" title="Python SDK" default>
11-
```python
11+
```python highlight={8} maxLines=15
1212
import assemblyai as aai
1313

1414
aai.settings.api_key = "<YOUR_API_KEY>"
@@ -27,7 +27,7 @@ print(transcript.text)
2727
```
2828
</Tab>
2929
<Tab language="python" title="Python">
30-
```python
30+
```python highlight={19-20} maxLines=15
3131
import requests
3232
import time
3333

@@ -72,7 +72,7 @@ while True:
7272
```
7373
</Tab>
7474
<Tab language="typescript-sdk" title="TypeScript SDK" default>
75-
```ts
75+
```ts highlight={13-14} maxLines=15
7676
import { AssemblyAI } from 'assemblyai'
7777

7878
const client = new AssemblyAI({
@@ -99,7 +99,7 @@ run()
9999
```
100100
</Tab>
101101
<Tab language="typescript" title="TypeScript">
102-
```ts
102+
```ts highlight={19-20} maxLines=15
103103
import axios from 'axios'
104104
import fs from 'fs-extra'
105105

@@ -147,7 +147,7 @@ while (true) {
147147
```
148148
</Tab>
149149
<Tab language="csharp" title="C#">
150-
```csharp
150+
```csharp highlight={37} maxLines=15
151151
using System;
152152
using System.IO;
153153
using System.Net.Http;
@@ -233,7 +233,7 @@ using (var httpClient = new HttpClient())
233233
```
234234
</Tab>
235235
<Tab language="ruby" title="Ruby">
236-
```ruby
236+
```ruby highlight={23-24} maxLines=15
237237
require 'net/http'
238238
require 'json'
239239

@@ -300,7 +300,7 @@ end
300300
```
301301
</Tab>
302302
<Tab language="php" title="PHP">
303-
```php
303+
```php highlight={30-31} maxLines=15
304304
<?php
305305
$ch = curl_init();
306306
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

fern/pages/02-speech-to-text/pre-recorded-audio/custom-spelling.mdx

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Custom Spelling lets you customize how words are spelled or formatted in the tra
88
<Tab language="python-sdk" title="Python SDK" default>
99
To use Custom Spelling, pass a dictionary to `set_custom_spelling()` on the transcription config. Each key-value pair specifies a mapping from a word or phrase to a new spelling or format. The key specifies the new spelling or format, and the corresponding value is the word or phrase you want to replace.
1010

11-
```python
11+
```python highlight={9-14} maxLines=15
1212
import assemblyai as aai
1313

1414
aai.settings.api_key = "<YOUR_API_KEY>"
@@ -36,7 +36,7 @@ print(transcript.text)
3636
<Tab language="python" title="Python">
3737
To use Custom Spelling, include `custom_spelling` in your transcription parameters. The parameter should be a list of dictionaries, with each dictionary specifying a mapping from a word or phrase to a new spelling or format.
3838

39-
```python
39+
```python highlight={19-28} maxLines=15
4040
import requests
4141
import time
4242

@@ -91,7 +91,7 @@ while True:
9191
<Tab language="typescript-sdk" title="TypeScript SDK" default>
9292
To use Custom Spelling, include `custom_spelling` in your transcription parameters. The parameter should be an array of objects, with each object specifying a mapping from a word or phrase to a new spelling or format.
9393

94-
```ts
94+
```ts highlight={13-22} maxLines=15
9595
import { AssemblyAI } from 'assemblyai'
9696

9797
const client = new AssemblyAI({
@@ -128,7 +128,7 @@ run()
128128
</Tab>
129129
<Tab language="typescript" title="TypeScript">
130130
To use Custom Spelling, include `custom_spelling` in your transcription parameters. The parameter should be an array of objects, with each object specifying a mapping from a word or phrase to a new spelling or format.
131-
```ts
131+
```ts highlight={19-28} maxLines=15
132132
import axios from 'axios'
133133
import fs from 'fs-extra'
134134

@@ -186,7 +186,7 @@ while (true) {
186186
</Tab>
187187
<Tab language="csharp" title="C#">
188188
To use Custom Spelling, include `custom_spelling` in your transcription request. The parameter should be an array of objects, with each object specifying a mapping from a word or phrase to a new spelling or format.
189-
```csharp
189+
```csharp highlight={37-46} maxLines=15
190190
using System;
191191
using System.IO;
192192
using System.Net.Http;
@@ -282,7 +282,7 @@ using (var httpClient = new HttpClient())
282282
</Tab>
283283
<Tab language="ruby" title="Ruby">
284284
To use Custom Spelling, include `custom_spelling` in your transcription parameters. The parameter should be an array of hashes, with each hash specifying a mapping from a word or phrase to a new spelling or format.
285-
```ruby
285+
```ruby highlight={23-32} maxLines=15
286286
require 'net/http'
287287
require 'json'
288288

@@ -358,7 +358,7 @@ end
358358
</Tab>
359359
<Tab language="php" title="PHP">
360360
To use Custom Spelling, include `custom_spelling` in your transcription parameters. The parameter should be an array of arrays, with each inner array specifying a mapping from a word or phrase to a new spelling or format.
361-
```php
361+
```php highlight={30-39} maxLines=15
362362
<?php
363363
$ch = curl_init();
364364
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

fern/pages/02-speech-to-text/pre-recorded-audio/custom-vocabulary.mdx

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can also control how much weight to apply to each keyword or phrase. Include
1414

1515
<CodeBlocks>
1616

17-
```python title="Python SDK"
17+
```python title="Python SDK" highlight={9-10} maxLines=15
1818
import assemblyai as aai
1919

2020
aai.settings.api_key = "<YOUR_API_KEY>"
@@ -35,7 +35,7 @@ if transcript.status == "error":
3535
print(transcript.text)
3636
```
3737

38-
```python title="Python"
38+
```python title="Python" highlight={19,20} maxLines=15
3939
import requests
4040
import time
4141

@@ -79,7 +79,7 @@ while True:
7979

8080
```
8181

82-
```ts title="TypeScript SDK"
82+
```ts title="TypeScript SDK" highlight={13-14} maxLines=15
8383
import { AssemblyAI } from 'assemblyai'
8484

8585
const client = new AssemblyAI({
@@ -105,7 +105,7 @@ const run = async () => {
105105
run()
106106
```
107107

108-
```ts title="TypeScript"
108+
```ts title="TypeScript" highlight={19-20} maxLines=15
109109
import axios from 'axios'
110110
import fs from 'fs-extra'
111111

@@ -152,7 +152,7 @@ while (true) {
152152

153153
```
154154

155-
```csharp title="C#"
155+
```csharp title="C#" highlight={37} maxLines=15
156156
using System;
157157
using System.IO;
158158
using System.Net.Http;
@@ -236,7 +236,7 @@ using (var httpClient = new HttpClient())
236236
}
237237
```
238238

239-
```ruby title="Ruby"
239+
```ruby title="Ruby" highlight={23-24} maxLines=15
240240
require 'net/http'
241241
require 'json'
242242

@@ -302,7 +302,7 @@ while true
302302
end
303303
```
304304

305-
```php title="PHP"
305+
```php title="PHP" highlight={30-31} maxLines=15
306306
<?php
307307
$ch = curl_init();
308308
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

0 commit comments

Comments
 (0)