cdown/srt

Using your library

Closed this issue · 2 comments

Hi, I'm Alberto, I know a little bit of coding but it takes me a lot of time to code something, I had an idea to improve my learning English method using subtitles.

I use to watch series and films in English to learn. In my actual point for me is very easy to watch a movie with English subtitles but hard to watch it without subtitles. I got and idea to make an intermediate point between those two methods.

We can make a simple software to spoil the .srt (subtitles file), the software change random words to a lines rows.

For example:

1 00:02:12,087 --> 00:02:13,964 - Jump! - What are you doing?

2 00:02:24,727 --> 00:02:26,718 - Oh, my God! - What are you doing?

3 00:02:28,527 --> 00:02:29,721 Help me!

Can turn to:

1 00:02:12,087 --> 00:02:13,964 - Jump! - What ___ you doing?

2 00:02:24,727 --> 00:02:26,718 - Oh, __ God! - What ___ you _____?

3 00:02:28,527 --> 00:02:29,721 ____ me!

We can set in the code a rate like (0.55) the code is going to point every word in the text avoiding the numbers and the arrow "-->", after pointing a word the code is going to cast a random function to change the word for a lines row like: "What" for "____".

What do you think? It seems easy with your library.

Thanks

cdown commented

Hey there! Sorry for the delay.

This can be done with srt process. Here's one way to do it (not randomly, but you get the idea):

% cat /tmp/th.srt 
1
00:00:35,300 --> 00:00:39,980
Predators give us a dramatic health check on our planet's wild places.

2
00:00:41,580 --> 00:00:43,540
They are the top of the food chain

3
00:00:43,540 --> 00:00:47,300
and need an abundance of prey and vast territories for hunting.

% srt process -i /tmp/th.srt -f 'lambda content: " ".join(str(x) if i % 3 else "_" * len(x) for i, x in enumerate(content.split()))'
1
00:00:35,300 --> 00:00:39,980
_________ give us _ dramatic health _____ on our ________ wild places.

2
00:00:41,580 --> 00:00:43,540
____ are the ___ of the ____ chain

3
00:00:43,540 --> 00:00:47,300
___ need an _________ of prey ___ vast territories ___ hunting.

cdown commented

Closing, as I believe this is answered.