@@ -29,26 +29,20 @@ The method parse requires the following parameters:
2929 * ` fps ` : framerate (only used by ` sub ` files), ` 23.976 ` by default.
3030
3131``` python
32- from pysubparser import parsers
32+ from pysubparser import parser
3333
34- subtitles = parsers .parse(' ./files/space-jam.srt' )
34+ subtitles = parser .parse(' ./files/space-jam.srt' )
3535
3636for subtitle in subtitles:
3737 print (subtitle)
3838```
3939
4040Output:
41- ```
41+ ``` text
42420 > [BALL BOUNCING]
43431 > Michael?
44442 > What are you doing out here, son? It's after midnight.
45453 > MICHAEL: Couldn't sleep, Pops.
46- 4 > Well, neither can we, with all that noise you're making.
47- 5 > Come on, let's go inside.
48- 6 > Just one more shot?
49- 7 > [CHUCKLES]
50- 8 > All right. Just one.
51- 9 > Yeah.
5246```
5347
5448___
@@ -70,7 +64,7 @@ for subtitle in subtitles:
7064```
7165
7266Output:
73- ```
67+ ``` text
746800:00:36.328000 > 00:00:38.329000
7569[BALL BOUNCING]
7670
@@ -82,22 +76,37 @@ What are you doing out here, son? It's after midnight.
8276
837700:01:11.572000 > 00:01:13.072000
8478MICHAEL: Couldn't sleep, Pops.
79+ ```
8580
86- 00:01:13.240000 > 00:01:16.200000
87- Well, neither can we, with all that noise you're making.
81+ ### Cleaners
8882
89- 00:01:16.368000 > 00:01:17.577000
90- Come on, let's go inside.
83+ Currently, 4 cleaners are provided:
84+
85+ * ` ascii ` will translate every unicode character to its ascii equivalent.
86+ * ` brackets ` will remove anything between them (e.g., ` [BALL BOUNCING] ` )
87+ * ` formatting ` will remove formatting keys like ` <i> ` and ` </i> ` .
88+ * ` lower_case ` will lower case all text.
89+
90+ ``` python
91+ from pysubparser.cleaners import ascii , brackets, formatting, lower_case
9192
92- 00:01:18.203000 > 00:01:20.163000
93- Just one more shot?
93+ subtitles = brackets.clean(
94+ lower_case.clean(
95+ subtitles
96+ )
97+ )
9498
95- 00:01:20.330000 > 00:01:21.789000
96- [CHUCKLES]
99+ for subtitle in subtitles:
100+ print (subtitle)
101+ ```
102+
103+ ``` text
104+ 0 >
105+ 1 > michael?
106+ 2 > what are you doing out here, son? it's after midnight.
107+ 3 > michael: couldn't sleep, pops.
108+ ```
97109
98- 00:01:21.957000 > 00:01:24.167000
99- All right. Just one.
110+ ### Writers
100111
101- 00:01:24.334000 > 00:01:25.835000
102- Yeah.
103- ```
112+ Given any list of ` Subtitle ` and a path it will output those subtitles in a ` srt ` format.
0 commit comments