Add integration docs and synthetic command examples
This commit is contained in:
61
examples/README.md
Normal file
61
examples/README.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Examples
|
||||
|
||||
These are small synthetic, copyable example assets for the implemented CLI
|
||||
commands.
|
||||
This directory is the canonical examples home for documentation.
|
||||
|
||||
## Merge example
|
||||
|
||||
Inputs:
|
||||
|
||||
- `minimal-merge/input-alice.json`
|
||||
- `minimal-merge/input-bob.json`
|
||||
- `minimal-merge/speakers.yml`
|
||||
|
||||
Run:
|
||||
|
||||
```sh
|
||||
go run ./cmd/seriatim merge \
|
||||
--input-file examples/minimal-merge/input-alice.json \
|
||||
--input-file examples/minimal-merge/input-bob.json \
|
||||
--speakers examples/minimal-merge/speakers.yml \
|
||||
--output-file /tmp/seriatim-example-merge.json
|
||||
```
|
||||
|
||||
## Normalize examples
|
||||
|
||||
Object-with-segments input:
|
||||
|
||||
```sh
|
||||
go run ./cmd/seriatim normalize \
|
||||
--input-file examples/normalize/object-with-segments.json \
|
||||
--output-file /tmp/seriatim-example-normalize-object.json
|
||||
```
|
||||
|
||||
Bare-array input:
|
||||
|
||||
```sh
|
||||
go run ./cmd/seriatim normalize \
|
||||
--input-file examples/normalize/bare-segments-array.json \
|
||||
--output-file /tmp/seriatim-example-normalize-array.json
|
||||
```
|
||||
|
||||
## Trim example
|
||||
|
||||
Input artifact:
|
||||
|
||||
- `trim/input-full.json`
|
||||
|
||||
Run:
|
||||
|
||||
```sh
|
||||
go run ./cmd/seriatim trim \
|
||||
--input-file examples/trim/input-full.json \
|
||||
--output-file /tmp/seriatim-example-trim.json \
|
||||
--keep "1-2"
|
||||
```
|
||||
|
||||
## YAML rule examples
|
||||
|
||||
- `speakers.yml`
|
||||
- `autocorrect.yml`
|
||||
8
examples/autocorrect.yml
Normal file
8
examples/autocorrect.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
autocorrect:
|
||||
- target: "General Kenobi"
|
||||
match:
|
||||
- "General Kenobi."
|
||||
|
||||
- target: "Okay"
|
||||
match:
|
||||
- "Okay."
|
||||
14
examples/minimal-merge/input-alice.json
Normal file
14
examples/minimal-merge/input-alice.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"segments": [
|
||||
{
|
||||
"start": 0.0,
|
||||
"end": 1.2,
|
||||
"text": " Hello there. "
|
||||
},
|
||||
{
|
||||
"start": 2.6,
|
||||
"end": 3.1,
|
||||
"text": "Okay."
|
||||
}
|
||||
]
|
||||
}
|
||||
9
examples/minimal-merge/input-bob.json
Normal file
9
examples/minimal-merge/input-bob.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"segments": [
|
||||
{
|
||||
"start": 1.3,
|
||||
"end": 2.4,
|
||||
"text": "General Kenobi."
|
||||
}
|
||||
]
|
||||
}
|
||||
8
examples/minimal-merge/speakers.yml
Normal file
8
examples/minimal-merge/speakers.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
match:
|
||||
- speaker: "Alice Example"
|
||||
match:
|
||||
- "alice"
|
||||
|
||||
- speaker: "Bob Example"
|
||||
match:
|
||||
- "bob"
|
||||
13
examples/normalize/bare-segments-array.json
Normal file
13
examples/normalize/bare-segments-array.json
Normal file
@@ -0,0 +1,13 @@
|
||||
[
|
||||
{
|
||||
"start": 2.5,
|
||||
"end": 3.0,
|
||||
"speaker": "Bob",
|
||||
"text": "later"
|
||||
},
|
||||
{
|
||||
"end": 2.0,
|
||||
"speaker": "",
|
||||
"text": "no start uses end"
|
||||
}
|
||||
]
|
||||
19
examples/normalize/object-with-segments.json
Normal file
19
examples/normalize/object-with-segments.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"segments": [
|
||||
{
|
||||
"id": 7,
|
||||
"start": 2.0,
|
||||
"end": 2.5,
|
||||
"speaker": "Bob",
|
||||
"text": "second"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"start": 1.0,
|
||||
"end": 1.3,
|
||||
"speaker": "Alice",
|
||||
"text": "first",
|
||||
"categories": ["backchannel"]
|
||||
}
|
||||
]
|
||||
}
|
||||
8
examples/speakers.yml
Normal file
8
examples/speakers.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
match:
|
||||
- speaker: "Alice Example"
|
||||
match:
|
||||
- "alice"
|
||||
|
||||
- speaker: "Bob Example"
|
||||
match:
|
||||
- "bob"
|
||||
64
examples/trim/input-full.json
Normal file
64
examples/trim/input-full.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"metadata": {
|
||||
"application": "seriatim",
|
||||
"version": "dev",
|
||||
"input_reader": "json-files",
|
||||
"input_files": [
|
||||
"examples/minimal-merge/input-alice.json",
|
||||
"examples/minimal-merge/input-bob.json"
|
||||
],
|
||||
"preprocessing_modules": [
|
||||
"validate-raw",
|
||||
"normalize-speakers",
|
||||
"trim-text"
|
||||
],
|
||||
"postprocessing_modules": [
|
||||
"detect-overlaps",
|
||||
"resolve-overlaps",
|
||||
"backchannel",
|
||||
"filler",
|
||||
"resolve-danglers",
|
||||
"coalesce",
|
||||
"detect-overlaps",
|
||||
"autocorrect",
|
||||
"assign-ids",
|
||||
"validate-output"
|
||||
],
|
||||
"output_modules": [
|
||||
"json"
|
||||
]
|
||||
},
|
||||
"segments": [
|
||||
{
|
||||
"id": 1,
|
||||
"source": "examples/minimal-merge/input-alice.json",
|
||||
"source_segment_index": 0,
|
||||
"speaker": "Alice Example",
|
||||
"start": 0,
|
||||
"end": 1.2,
|
||||
"text": "Hello there."
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"source": "examples/minimal-merge/input-bob.json",
|
||||
"source_segment_index": 0,
|
||||
"speaker": "Bob Example",
|
||||
"start": 1.3,
|
||||
"end": 2.4,
|
||||
"text": "General Kenobi."
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"source": "examples/minimal-merge/input-alice.json",
|
||||
"source_segment_index": 1,
|
||||
"speaker": "Alice Example",
|
||||
"start": 2.6,
|
||||
"end": 3.1,
|
||||
"text": "Okay.",
|
||||
"categories": [
|
||||
"backchannel"
|
||||
]
|
||||
}
|
||||
],
|
||||
"overlap_groups": []
|
||||
}
|
||||
Reference in New Issue
Block a user