Class: MeetingBuddy::Transcriber
- Inherits:
-
Object
- Object
- MeetingBuddy::Transcriber
- Defined in:
- lib/meeting_buddy/transcriber.rb
Overview
Manages the transcript of the meeting
Defined Under Namespace
Classes: Line
Instance Attribute Summary collapse
-
#full_transcript ⇒ String
readonly
Full transcript of the meeting.
Instance Method Summary collapse
-
#initialize ⇒ Transcriber
constructor
A new instance of Transcriber.
-
#latest(limit = 200) ⇒ String
Get the latest portion of the transcript.
-
#process(line) ⇒ String
Process new transcription text.
Constructor Details
#initialize ⇒ Transcriber
Returns a new instance of Transcriber.
11 12 13 14 |
# File 'lib/meeting_buddy/transcriber.rb', line 11 def initialize @full_transcript = "" @last_timestamp = 0 end |
Instance Attribute Details
#full_transcript ⇒ String (readonly)
Returns full transcript of the meeting.
7 8 9 |
# File 'lib/meeting_buddy/transcriber.rb', line 7 def full_transcript @full_transcript end |
Instance Method Details
#latest(limit = 200) ⇒ String
Get the latest portion of the transcript
32 33 34 |
# File 'lib/meeting_buddy/transcriber.rb', line 32 def latest(limit = 200) @full_transcript[[@full_transcript.length - limit, 0].max, limit] || raise(ArgumentError, "negative limit") end |
#process(line) ⇒ String
Process new transcription text
19 20 21 22 23 24 25 26 27 |
# File 'lib/meeting_buddy/transcriber.rb', line 19 def process(line) , text = parse_line(line) return Line.new(text: "", timestamp: Time.now) if text.empty? @full_transcript += text @last_timestamp = Line.new(text: format_transcription(text), timestamp: @last_timestamp) end |