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

[HOLD] add language tag from cocina to sqs message #1428

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

peetucket
Copy link
Member

@peetucket peetucket commented Nov 26, 2024

Why was this change made? 🤔

Fixes #1427 - adds the languageTag from cocina to the SQS message for the object so it can be passed through to Whisper. The languageTag can be set in pre-assembly via the file manifest.

Note that this change must be coordinated with work done for sul-dlss/speech-to-text#51 . Since the format of the message has changed, the whisper container needs to know how to process and deal with this new format.

How was this change tested? 🤨

Specs


def stt
@stt ||= Dor::TextExtraction::SpeechToText.new(cocina_object:)
end
Copy link
Member Author

Choose a reason for hiding this comment

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

cache this in the object so it can be used in our updated media method without re-instantiating it.

@@ -45,7 +45,7 @@

context 'when the object has no files that can be STTed' do
let(:first_fileset_structural) { instance_double(Cocina::Models::FileSetStructural, contains: [text_file]) }
let(:second_fileset_structural) { instance_double(Cocina::Models::FileSetStructural, contains: [text_file, text_file]) }
let(:second_fileset_structural) { instance_double(Cocina::Models::FileSetStructural, contains: [text_file, text_file2]) }
Copy link
Member Author

Choose a reason for hiding this comment

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

small typo from a previous PR, turned out to have no impact on the test, but just fixing because

@@ -71,6 +71,11 @@ def output_location
"#{job_id}/output"
end

# look in resource structural metadata for a given filename and return it's cocina language (or nil if no language is set)
def language_tag(filename)
stt_files.find { |file| file.filename == filename }&.languageTag
Copy link
Member Author

Choose a reason for hiding this comment

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

question ... do we want the default value to pass to whisper to be nil or en ? this makes it nil, but we could make it en

Copy link
Contributor

Choose a reason for hiding this comment

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

Preferably there would be no language parameter passed to the service if it is not known.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me see if I can make that adjustment.

Copy link
Member Author

Choose a reason for hiding this comment

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

changed - so ready for testing when the new container is ready

@@ -71,6 +71,11 @@ def output_location
"#{job_id}/output"
end

# look in resource structural metadata for a given filename and return it's cocina language (or nil if no language is set)
def language_tag(filename)
stt_files.find { |file| file.filename == filename }&.languageTag
Copy link
Contributor

Choose a reason for hiding this comment

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

Preferably there would be no language parameter passed to the service if it is not known.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants