Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add paragraphs query options #65

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/transcription/prerecorded/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ pub struct Options {
search: Vec<String>,
replace: Vec<Replace>,
keywords: Vec<Keyword>,
filler_words: bool,
smart_format: bool,
paragraphs: Option<bool>,
Comment on lines +27 to +29
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change filler_words and smart_format to Option<bool>, so they don't get serialized unless the user requests them?

keyword_boost_legacy: bool,
utterances: Option<Utterances>,
tags: Vec<String>,
Expand Down Expand Up @@ -280,6 +283,9 @@ impl OptionsBuilder {
search: Vec::new(),
replace: Vec::new(),
keywords: Vec::new(),
filler_words: false,
smart_format: false,
paragraphs: None,
keyword_boost_legacy: false,
utterances: None,
tags: Vec::new(),
Expand Down Expand Up @@ -1074,6 +1080,27 @@ impl OptionsBuilder {

self
}

#[allow(missing_docs)]
pub fn smart_format(mut self, smart_format: bool) -> Self {
self.0.smart_format = smart_format;

self
}

#[allow(missing_docs)]
pub fn filler_words(mut self, filler_words: bool) -> Self {
self.0.filler_words = filler_words;

self
}

#[allow(missing_docs)]
pub fn paragraphs(mut self, paragraphs: bool) -> Self {
self.0.paragraphs = Some(paragraphs);

self
}
/// Finish building the [`Options`] object.
pub fn build(self) -> Options {
self.0
Expand Down Expand Up @@ -1110,6 +1137,9 @@ impl Serialize for SerializableOptions<'_> {
search,
replace,
keywords,
filler_words,
smart_format,
paragraphs,
keyword_boost_legacy,
utterances,
tags,
Expand Down Expand Up @@ -1211,6 +1241,13 @@ impl Serialize for SerializableOptions<'_> {
seq.serialize_element(&("keyword_boost", "legacy"))?;
}

seq.serialize_element(&("filler_words", filler_words))?;
seq.serialize_element(&("smart_format", smart_format))?;

if let Some(paragraphs) = paragraphs {
seq.serialize_element(&("paragraphs", paragraphs))?;
}

match utterances {
Some(Utterances::Disabled) => seq.serialize_element(&("utterances", false))?,
Some(Utterances::Enabled { utt_split }) => {
Expand Down
Loading