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

Transcript semantic parsing #6852

Merged

Conversation

tonytamsf
Copy link
Member

@tonytamsf tonytamsf commented Jan 2, 2024

fix #4935 Parsing of podcast:transcript with a simple unit test. After this is merged, my next PR will be able to display 2 lines of transcript in the CoverFragment

@ByteHamster let me know if you wanted more unit tests

Copy link
Member

@ByteHamster ByteHamster left a comment

Choose a reason for hiding this comment

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

Thanks! I added some comments below

@tonytamsf tonytamsf added the Area: Podcast Index / Podcasting 2.0 Anything related to PodcastIndex.org and/or Podcasting 2.0 label Jan 6, 2024
@tonytamsf tonytamsf mentioned this pull request Jan 6, 2024
3 tasks
Copy link
Member

@ByteHamster ByteHamster left a comment

Choose a reason for hiding this comment

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

Sorry for the late reply. I'm currently on a business trip that is quite packed with things to do. Finally found a bit of time. Comments below :)

@tonytamsf
Copy link
Member Author

Sorry for the late reply. I'm currently on a business trip that is quite packed with things to do. Finally found a bit of time. Comments below :)

No worries, enjoy your trip.

@ByteHamster
Copy link
Member

Looking at the code again, I think we should make the properties of TranscriptSegment final. That prevents later "misuse" by other developers. As it currently is, developers could bring the Transcript object into an invalid state by adding a transcript and then modifying its properties. If a segment is not modifiable, this can't happen. What do you think?

@tonytamsf
Copy link
Member Author

Looking at the code again, I think we should make the properties of TranscriptSegment final. That prevents later "misuse" by other developers. As it currently is, developers could bring the Transcript object into an invalid state by adding a transcript and then modifying its properties. If a segment is not modifiable, this can't happen. What do you think?

I assume you mean these properties below? In order for a future PR to dynamically display transcripts, I will need to modify the contents of TranscriptSegment

public class TranscriptSegment {
    private long startTime;
    private long endTime;
    private String words;
    private String speaker;
    private Boolean trimmed;

Here is a future PR

https://github.com/tonytamsf/AntennaPod/pull/6/files#diff-14d98525c5df8d24fa975f628614e462438e8ccb86a08dab5f5bafabb2ef09cfR411

  1. Depending on the screen size, I will need to break up segments using setWords() and setStartTime()
  2. When a user scrubs the audio, they might land in the middle of a segment and I will need to redo the segments.

@ByteHamster
Copy link
Member

Instead of modifying the existing transcript specifically for the UI, I would rather create a copy with the new line breaks. That way we ensure that the broken-up transcript doesn't somehow end up in the other UI pages where it needs to be broken up differently.

@tonytamsf
Copy link
Member Author

Making a copy seems very wasteful of memory and execution time.

As I dig into the details of displaying transcripts and supporting users scrubbing to random locations, I end up needing to dynamically chunk up the transcript segments.

Another way I could do this is probably with a cursor that walks the transcript segments for display.

I will give that a try

@ByteHamster
Copy link
Member

Don't we need a copy anyway because we need to re-layout on screen size changes? There we probably want to start fresh instead of keeping to modify the same transcript on subsequent size changes/rotations, which would otherwise look different every time and probably even degenerate at some point.

How large are these objects? Is having them twice really such a big problem?

@tonytamsf
Copy link
Member Author

How large are these objects? Is having them twice really such a big problem?

I'll start implementing without a copy and see if I can solve it with a cursor instead. I'm not sure why I personally cannot visualize how to solve it by copying since the transcript segments will need to be layout more than once since the user can scrub the time, fast forward, rewind and rotate the screen any time. Doesn't seem to make sense to copy and redo the layout for the entire Transcript when only the current and next N segment of text needs to be rearranged.

@tonytamsf
Copy link
Member Author

Looking at the code again, I think we should make the properties of TranscriptSegment final.

This is done, the values are final in TranscriptSegment

@tonytamsf
Copy link
Member Author

@ByteHamster What do you think of merging?

- Remove logging, this floods the logs with a lot of stuff that is usually not as important for debugging
- Rename to remove "PodcastIndex", as this is Podcasting 2.0, not PodcastIndex. Also, transcripts are not necessarily
  something specific to Podcasting 2.0
@ByteHamster
Copy link
Member

I did a few changes, let me know what you think :)

About displaying, I think we need to discuss a bit again. In my opinion, most users don't need the live transcript, just the full one for search/sharing/etc. So displaying it on the main cover screen by default adds quite some complexity and "movement" for everyone while helping just a few users. Maybe we can discuss this at the community call next Saturday.

@tonytamsf
Copy link
Member Author

I did a few changes, let me know what you think :)

looks good, thanks!

@ByteHamster ByteHamster merged commit d3120ee into AntennaPod:transcript Feb 4, 2024
7 checks passed
@ByteHamster
Copy link
Member

Thanks!

ByteHamster pushed a commit that referenced this pull request Apr 15, 2024
ByteHamster pushed a commit that referenced this pull request May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Podcast Index / Podcasting 2.0 Anything related to PodcastIndex.org and/or Podcasting 2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants