pycaption 2.2.15__tar.gz → 2.2.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. {pycaption-2.2.15 → pycaption-2.2.17}/LICENSE +1 -1
  2. {pycaption-2.2.15 → pycaption-2.2.17}/MANIFEST.in +0 -1
  3. {pycaption-2.2.15/pycaption.egg-info → pycaption-2.2.17}/PKG-INFO +15 -5
  4. {pycaption-2.2.15 → pycaption-2.2.17}/README.rst +2 -2
  5. pycaption-2.2.17/pycaption/transcript.py +33 -0
  6. {pycaption-2.2.15 → pycaption-2.2.17/pycaption.egg-info}/PKG-INFO +15 -5
  7. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption.egg-info/SOURCES.txt +0 -1
  8. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption.egg-info/requires.txt +1 -1
  9. {pycaption-2.2.15 → pycaption-2.2.17}/setup.py +2 -2
  10. pycaption-2.2.15/pycaption/english.pickle +0 -61702
  11. pycaption-2.2.15/pycaption/transcript.py +0 -35
  12. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/__init__.py +0 -0
  13. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/base.py +0 -0
  14. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/dfxp/__init__.py +0 -0
  15. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/dfxp/base.py +0 -0
  16. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/dfxp/extras.py +0 -0
  17. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/exceptions.py +0 -0
  18. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/geometry.py +0 -0
  19. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/microdvd.py +0 -0
  20. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/sami.py +0 -0
  21. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/scc/__init__.py +0 -0
  22. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/scc/constants.py +0 -0
  23. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/scc/specialized_collections.py +0 -0
  24. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/scc/state_machines.py +0 -0
  25. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/scc/translator.py +0 -0
  26. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/srt.py +0 -0
  27. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/utils.py +0 -0
  28. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption/webvtt.py +0 -0
  29. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption.egg-info/dependency_links.txt +0 -0
  30. {pycaption-2.2.15 → pycaption-2.2.17}/pycaption.egg-info/top_level.txt +0 -0
  31. {pycaption-2.2.15 → pycaption-2.2.17}/setup.cfg +0 -0
  32. {pycaption-2.2.15 → pycaption-2.2.17}/tests/__init__.py +0 -0
  33. {pycaption-2.2.15 → pycaption-2.2.17}/tests/conftest.py +0 -0
  34. {pycaption-2.2.15 → pycaption-2.2.17}/tests/fixtures/__init__.py +0 -0
  35. {pycaption-2.2.15 → pycaption-2.2.17}/tests/fixtures/dfxp.py +0 -0
  36. {pycaption-2.2.15 → pycaption-2.2.17}/tests/fixtures/microdvd.py +0 -0
  37. {pycaption-2.2.15 → pycaption-2.2.17}/tests/fixtures/sami.py +0 -0
  38. {pycaption-2.2.15 → pycaption-2.2.17}/tests/fixtures/scc.py +0 -0
  39. {pycaption-2.2.15 → pycaption-2.2.17}/tests/fixtures/srt.py +0 -0
  40. {pycaption-2.2.15 → pycaption-2.2.17}/tests/fixtures/translated_scc.py +0 -0
  41. {pycaption-2.2.15 → pycaption-2.2.17}/tests/fixtures/webvtt.py +0 -0
  42. {pycaption-2.2.15 → pycaption-2.2.17}/tests/mixins.py +0 -0
  43. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_base.py +0 -0
  44. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_dfxp.py +0 -0
  45. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_dfxp_conversion.py +0 -0
  46. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_dfxp_extras.py +0 -0
  47. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_functions.py +0 -0
  48. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_geometry.py +0 -0
  49. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_microdvd.py +0 -0
  50. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_microdvd_conversion.py +0 -0
  51. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_sami.py +0 -0
  52. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_sami_conversion.py +0 -0
  53. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_scc.py +0 -0
  54. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_scc_conversion.py +0 -0
  55. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_scc_translator.py +0 -0
  56. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_srt.py +0 -0
  57. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_srt_conversion.py +0 -0
  58. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_webvtt.py +0 -0
  59. {pycaption-2.2.15 → pycaption-2.2.17}/tests/test_webvtt_conversion.py +0 -0
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright (c) 2012-2024 PBS.org
189
+ Copyright (c) 2012-2025 PBS.org
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,3 +1,2 @@
1
- include pycaption/english.pickle
2
1
  recursive-include tests *
3
2
  include README.rst
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pycaption
3
- Version: 2.2.15
3
+ Version: 2.2.17
4
4
  Summary: Closed caption converter
5
5
  Author: Joe Norton
6
6
  Author-email: joey@nortoncrew.com
@@ -29,7 +29,17 @@ Provides-Extra: dev
29
29
  Requires-Dist: pytest; extra == "dev"
30
30
  Requires-Dist: pytest-lazy-fixture; extra == "dev"
31
31
  Provides-Extra: transcript
32
- Requires-Dist: nltk==3.8.0; extra == "transcript"
32
+ Requires-Dist: nltk==3.9.1; extra == "transcript"
33
+ Dynamic: author
34
+ Dynamic: author-email
35
+ Dynamic: classifier
36
+ Dynamic: description
37
+ Dynamic: license-file
38
+ Dynamic: project-url
39
+ Dynamic: provides-extra
40
+ Dynamic: requires-dist
41
+ Dynamic: requires-python
42
+ Dynamic: summary
33
43
 
34
44
  py-caption
35
45
  ==========
@@ -40,7 +50,7 @@ py-caption
40
50
  to read content into a CaptionSet object, and then use one of the Writers to
41
51
  output the CaptionSet into captions of your desired format.
42
52
 
43
- Tested with Python versions 3.6, 3.7, 3.8, 3.9, 3.10 and 3.11.
53
+ Tested with Python versions 3.8, 3.9, 3.10, 3.11 and 3.12.
44
54
  (for Python 2 use pycaption < 1.0.0)
45
55
 
46
56
  For details, see the `documentation <http://pycaption.readthedocs.org>`__.
@@ -48,7 +58,7 @@ For details, see the `documentation <http://pycaption.readthedocs.org>`__.
48
58
  License
49
59
  -------
50
60
 
51
- This module is Copyright (c) 2012-2024 PBS.org and is available under the `Apache
61
+ This module is Copyright (c) 2012-2025 PBS.org and is available under the `Apache
52
62
  License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`__.
53
63
 
54
64
  .. |Build Status| image:: https://github.com/pbs/pycaption/actions/workflows/unit_tests.yml/badge.svg
@@ -7,7 +7,7 @@ py-caption
7
7
  to read content into a CaptionSet object, and then use one of the Writers to
8
8
  output the CaptionSet into captions of your desired format.
9
9
 
10
- Tested with Python versions 3.6, 3.7, 3.8, 3.9, 3.10 and 3.11.
10
+ Tested with Python versions 3.8, 3.9, 3.10, 3.11 and 3.12.
11
11
  (for Python 2 use pycaption < 1.0.0)
12
12
 
13
13
  For details, see the `documentation <http://pycaption.readthedocs.org>`__.
@@ -15,7 +15,7 @@ For details, see the `documentation <http://pycaption.readthedocs.org>`__.
15
15
  License
16
16
  -------
17
17
 
18
- This module is Copyright (c) 2012-2024 PBS.org and is available under the `Apache
18
+ This module is Copyright (c) 2012-2025 PBS.org and is available under the `Apache
19
19
  License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`__.
20
20
 
21
21
  .. |Build Status| image:: https://github.com/pbs/pycaption/actions/workflows/unit_tests.yml/badge.svg
@@ -0,0 +1,33 @@
1
+ from pycaption.base import BaseWriter, CaptionNode
2
+
3
+
4
+ class TranscriptWriter(BaseWriter):
5
+ def __init__(self, *args, **kw):
6
+ try:
7
+ from nltk import PunktSentenceTokenizer
8
+
9
+ self.tokenizer = PunktSentenceTokenizer()
10
+ except ModuleNotFoundError as exc:
11
+ raise ModuleNotFoundError(
12
+ "Missing Dependency: You must install nltk"
13
+ ) from exc
14
+
15
+ def write(self, captions):
16
+ transcripts = []
17
+
18
+ for lang in captions.get_languages():
19
+ lang_transcript = ""
20
+
21
+ for caption in captions.get_captions(lang):
22
+ lang_transcript = self._strip_text(caption.nodes, lang_transcript)
23
+
24
+ lang_transcript = "\n".join(self.tokenizer.tokenize(lang_transcript))
25
+ transcripts.append(lang_transcript)
26
+
27
+ return "\n".join(transcripts)
28
+
29
+ def _strip_text(self, elements, lang_transcript):
30
+ return " ".join(
31
+ [lang_transcript]
32
+ + [el.content for el in elements if el.type_ == CaptionNode.TEXT]
33
+ )
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: pycaption
3
- Version: 2.2.15
3
+ Version: 2.2.17
4
4
  Summary: Closed caption converter
5
5
  Author: Joe Norton
6
6
  Author-email: joey@nortoncrew.com
@@ -29,7 +29,17 @@ Provides-Extra: dev
29
29
  Requires-Dist: pytest; extra == "dev"
30
30
  Requires-Dist: pytest-lazy-fixture; extra == "dev"
31
31
  Provides-Extra: transcript
32
- Requires-Dist: nltk==3.8.0; extra == "transcript"
32
+ Requires-Dist: nltk==3.9.1; extra == "transcript"
33
+ Dynamic: author
34
+ Dynamic: author-email
35
+ Dynamic: classifier
36
+ Dynamic: description
37
+ Dynamic: license-file
38
+ Dynamic: project-url
39
+ Dynamic: provides-extra
40
+ Dynamic: requires-dist
41
+ Dynamic: requires-python
42
+ Dynamic: summary
33
43
 
34
44
  py-caption
35
45
  ==========
@@ -40,7 +50,7 @@ py-caption
40
50
  to read content into a CaptionSet object, and then use one of the Writers to
41
51
  output the CaptionSet into captions of your desired format.
42
52
 
43
- Tested with Python versions 3.6, 3.7, 3.8, 3.9, 3.10 and 3.11.
53
+ Tested with Python versions 3.8, 3.9, 3.10, 3.11 and 3.12.
44
54
  (for Python 2 use pycaption < 1.0.0)
45
55
 
46
56
  For details, see the `documentation <http://pycaption.readthedocs.org>`__.
@@ -48,7 +58,7 @@ For details, see the `documentation <http://pycaption.readthedocs.org>`__.
48
58
  License
49
59
  -------
50
60
 
51
- This module is Copyright (c) 2012-2024 PBS.org and is available under the `Apache
61
+ This module is Copyright (c) 2012-2025 PBS.org and is available under the `Apache
52
62
  License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`__.
53
63
 
54
64
  .. |Build Status| image:: https://github.com/pbs/pycaption/actions/workflows/unit_tests.yml/badge.svg
@@ -4,7 +4,6 @@ README.rst
4
4
  setup.py
5
5
  pycaption/__init__.py
6
6
  pycaption/base.py
7
- pycaption/english.pickle
8
7
  pycaption/exceptions.py
9
8
  pycaption/geometry.py
10
9
  pycaption/microdvd.py
@@ -7,4 +7,4 @@ pytest
7
7
  pytest-lazy-fixture
8
8
 
9
9
  [transcript]
10
- nltk==3.8.0
10
+ nltk==3.9.1
@@ -16,11 +16,11 @@ dependencies = [
16
16
 
17
17
  dev_dependencies = ["pytest", "pytest-lazy-fixture"]
18
18
 
19
- transcript_dependencies = ["nltk==3.8.0"]
19
+ transcript_dependencies = ["nltk==3.9.1"]
20
20
 
21
21
  setup(
22
22
  name="pycaption",
23
- version="2.2.15",
23
+ version="2.2.17",
24
24
  description="Closed caption converter",
25
25
  long_description=open(README_PATH).read(),
26
26
  author="Joe Norton",