oatschema-adapters 0.1.0__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 (324) hide show
  1. oatschema_adapters-0.1.0/.gitattributes +6 -0
  2. oatschema_adapters-0.1.0/.gitignore +219 -0
  3. oatschema_adapters-0.1.0/AUTHORS +4 -0
  4. oatschema_adapters-0.1.0/CHANGELOG.md +10 -0
  5. oatschema_adapters-0.1.0/CONTRIBUTING.md +44 -0
  6. oatschema_adapters-0.1.0/LICENSE +201 -0
  7. oatschema_adapters-0.1.0/PKG-INFO +186 -0
  8. oatschema_adapters-0.1.0/README.md +160 -0
  9. oatschema_adapters-0.1.0/codecov.yml +15 -0
  10. oatschema_adapters-0.1.0/pyproject.toml +81 -0
  11. oatschema_adapters-0.1.0/scripts/check.sh +14 -0
  12. oatschema_adapters-0.1.0/scripts/record_043_outputs.py +68 -0
  13. oatschema_adapters-0.1.0/scripts/smoke.py +48 -0
  14. oatschema_adapters-0.1.0/src/oatschema_adapters/__init__.py +28 -0
  15. oatschema_adapters-0.1.0/src/oatschema_adapters/_builtin.py +44 -0
  16. oatschema_adapters-0.1.0/src/oatschema_adapters/_frontmatter.py +47 -0
  17. oatschema_adapters-0.1.0/src/oatschema_adapters/_options.py +144 -0
  18. oatschema_adapters-0.1.0/src/oatschema_adapters/_registry.py +254 -0
  19. oatschema_adapters-0.1.0/src/oatschema_adapters/_tsv.py +66 -0
  20. oatschema_adapters-0.1.0/src/oatschema_adapters/_validation.py +30 -0
  21. oatschema_adapters-0.1.0/src/oatschema_adapters/audio/__init__.py +54 -0
  22. oatschema_adapters-0.1.0/src/oatschema_adapters/audio/_md.py +181 -0
  23. oatschema_adapters-0.1.0/src/oatschema_adapters/audio/_srt.py +95 -0
  24. oatschema_adapters-0.1.0/src/oatschema_adapters/audio/_time.py +42 -0
  25. oatschema_adapters-0.1.0/src/oatschema_adapters/audio/_tsv.py +105 -0
  26. oatschema_adapters-0.1.0/src/oatschema_adapters/audio/_txt.py +67 -0
  27. oatschema_adapters-0.1.0/src/oatschema_adapters/audio/_vtt.py +115 -0
  28. oatschema_adapters-0.1.0/src/oatschema_adapters/document/__init__.py +50 -0
  29. oatschema_adapters-0.1.0/src/oatschema_adapters/document/_hocr.py +360 -0
  30. oatschema_adapters-0.1.0/src/oatschema_adapters/document/_html.py +181 -0
  31. oatschema_adapters-0.1.0/src/oatschema_adapters/document/_layout.py +333 -0
  32. oatschema_adapters-0.1.0/src/oatschema_adapters/document/_md.py +110 -0
  33. oatschema_adapters-0.1.0/src/oatschema_adapters/document/_render.py +64 -0
  34. oatschema_adapters-0.1.0/src/oatschema_adapters/document/_styles.py +67 -0
  35. oatschema_adapters-0.1.0/src/oatschema_adapters/document/_tsv.py +118 -0
  36. oatschema_adapters-0.1.0/src/oatschema_adapters/document/_txt.py +104 -0
  37. oatschema_adapters-0.1.0/src/oatschema_adapters/py.typed +0 -0
  38. oatschema_adapters-0.1.0/tests/audio/test_audio_md.py +156 -0
  39. oatschema_adapters-0.1.0/tests/audio/test_audio_srt.py +94 -0
  40. oatschema_adapters-0.1.0/tests/audio/test_audio_tsv.py +88 -0
  41. oatschema_adapters-0.1.0/tests/audio/test_audio_txt.py +64 -0
  42. oatschema_adapters-0.1.0/tests/audio/test_audio_vtt.py +105 -0
  43. oatschema_adapters-0.1.0/tests/conftest.py +51 -0
  44. oatschema_adapters-0.1.0/tests/data/audio-transcription-1.json +63 -0
  45. oatschema_adapters-0.1.0/tests/data/audio-transcription-2.json +54 -0
  46. oatschema_adapters-0.1.0/tests/data/audio-transcription-formulas.json +60 -0
  47. oatschema_adapters-0.1.0/tests/data/audio-transcription-legacy-ids.json +63 -0
  48. oatschema_adapters-0.1.0/tests/data/audio-transcription-text-only.json +4 -0
  49. oatschema_adapters-0.1.0/tests/data/document-extraction-1.json +68 -0
  50. oatschema_adapters-0.1.0/tests/data/document-extraction-2.json +78 -0
  51. oatschema_adapters-0.1.0/tests/data/document-extraction-3.json +155 -0
  52. oatschema_adapters-0.1.0/tests/data/document-extraction-formulas.json +98 -0
  53. oatschema_adapters-0.1.0/tests/data/document-extraction-hostile.json +62 -0
  54. oatschema_adapters-0.1.0/tests/data/document-extraction-normalized.json +62 -0
  55. oatschema_adapters-0.1.0/tests/data/document-extraction-per-mille.json +41 -0
  56. oatschema_adapters-0.1.0/tests/data/document-extraction-text-only.json +10 -0
  57. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.md.0.md +20 -0
  58. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.md.0.parsed.json +47 -0
  59. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.md.1.md +20 -0
  60. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.md.1.parsed.json +47 -0
  61. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.md.2.md +15 -0
  62. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.md.2.parsed.json +47 -0
  63. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.md.3.md +24 -0
  64. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.md.3.parsed.json +47 -0
  65. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.srt.0.parsed.json +31 -0
  66. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.srt.0.srt +20 -0
  67. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.srt.1.parsed.json +31 -0
  68. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.srt.1.srt +20 -0
  69. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.tsv.0.parsed.json +31 -0
  70. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.tsv.0.tsv +6 -0
  71. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.tsv.1.parsed.json +51 -0
  72. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.tsv.1.tsv +6 -0
  73. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.txt.0.parsed.json +4 -0
  74. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.txt.0.txt +1 -0
  75. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.vtt.0.parsed.json +31 -0
  76. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.vtt.0.vtt +16 -0
  77. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.vtt.1.parsed.json +51 -0
  78. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-1.vtt.1.vtt +16 -0
  79. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.md.0.md +24 -0
  80. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.md.0.parsed.json +30 -0
  81. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.md.1.md +24 -0
  82. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.md.1.parsed.json +30 -0
  83. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.md.2.md +10 -0
  84. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.md.2.parsed.json +30 -0
  85. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.md.3.md +25 -0
  86. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.md.3.parsed.json +30 -0
  87. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.srt.0.parsed.json +21 -0
  88. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.srt.0.srt +12 -0
  89. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.srt.1.parsed.json +21 -0
  90. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.srt.1.srt +12 -0
  91. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.tsv.0.parsed.json +26 -0
  92. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.tsv.0.tsv +5 -0
  93. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.tsv.1.parsed.json +34 -0
  94. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.tsv.1.tsv +5 -0
  95. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.txt.0.parsed.json +4 -0
  96. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-2.txt.0.txt +1 -0
  97. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.md.0.md +21 -0
  98. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.md.0.parsed.json +46 -0
  99. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.md.1.md +21 -0
  100. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.md.1.parsed.json +46 -0
  101. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.md.2.md +17 -0
  102. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.md.2.parsed.json +46 -0
  103. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.md.3.md +21 -0
  104. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.md.3.parsed.json +46 -0
  105. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.srt.0.parsed.json +46 -0
  106. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.srt.0.srt +32 -0
  107. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.srt.1.parsed.json +46 -0
  108. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.srt.1.srt +32 -0
  109. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.tsv.0.parsed.json +46 -0
  110. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.tsv.0.tsv +9 -0
  111. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.tsv.1.tsv +9 -0
  112. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.txt.0.parsed.json +4 -0
  113. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.txt.0.txt +1 -0
  114. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.vtt.0.parsed.json +46 -0
  115. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.vtt.0.vtt +25 -0
  116. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.vtt.1.parsed.json +58 -0
  117. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-formulas.vtt.1.vtt +25 -0
  118. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.md.0.md +20 -0
  119. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.md.0.parsed.json +47 -0
  120. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.md.1.md +20 -0
  121. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.md.1.parsed.json +47 -0
  122. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.md.2.md +15 -0
  123. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.md.2.parsed.json +47 -0
  124. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.md.3.md +24 -0
  125. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.md.3.parsed.json +47 -0
  126. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.srt.0.parsed.json +31 -0
  127. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.srt.0.srt +20 -0
  128. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.srt.1.parsed.json +31 -0
  129. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.srt.1.srt +20 -0
  130. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.tsv.0.parsed.json +31 -0
  131. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.tsv.0.tsv +6 -0
  132. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.tsv.1.parsed.json +51 -0
  133. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.tsv.1.tsv +6 -0
  134. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.txt.0.parsed.json +4 -0
  135. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.txt.0.txt +1 -0
  136. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.vtt.0.parsed.json +31 -0
  137. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.vtt.0.vtt +16 -0
  138. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.vtt.1.parsed.json +51 -0
  139. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-legacy-ids.vtt.1.vtt +16 -0
  140. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.md.0.md +7 -0
  141. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.md.0.parsed.json +11 -0
  142. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.md.1.md +7 -0
  143. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.md.1.parsed.json +11 -0
  144. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.md.2.md +3 -0
  145. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.md.2.parsed.json +11 -0
  146. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.md.3.md +7 -0
  147. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.md.3.parsed.json +11 -0
  148. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.txt.0.parsed.json +4 -0
  149. oatschema_adapters-0.1.0/tests/data/expected/audio-transcription-text-only.txt.0.txt +1 -0
  150. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.hocr.0.hocr.html +19 -0
  151. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.hocr.0.parsed.json +115 -0
  152. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.html.0.html +59 -0
  153. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.html.1.html +54 -0
  154. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.html.2.html +54 -0
  155. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.html.3.html +59 -0
  156. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.html.4.html +31 -0
  157. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.html.5.html +7 -0
  158. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.html.6.html +15 -0
  159. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.html.8.html +59 -0
  160. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.md.0.md +14 -0
  161. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.md.1.md +9 -0
  162. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.md.2.md +14 -0
  163. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.tsv.0.parsed.json +39 -0
  164. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.tsv.0.tsv +5 -0
  165. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.txt.0.parsed.json +10 -0
  166. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.txt.0.txt +7 -0
  167. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.txt.1.parsed.json +10 -0
  168. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-1.txt.1.txt +7 -0
  169. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.hocr.0.hocr.html +17 -0
  170. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.hocr.0.parsed.json +34 -0
  171. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.html.0.html +58 -0
  172. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.html.1.html +54 -0
  173. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.html.2.html +54 -0
  174. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.html.3.html +58 -0
  175. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.html.4.html +31 -0
  176. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.html.5.html +7 -0
  177. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.html.6.html +14 -0
  178. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.html.8.html +58 -0
  179. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.md.0.md +12 -0
  180. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.md.1.md +7 -0
  181. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.md.2.md +12 -0
  182. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.tsv.0.parsed.json +23 -0
  183. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.tsv.0.tsv +3 -0
  184. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.txt.0.parsed.json +10 -0
  185. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.txt.0.txt +1 -0
  186. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.txt.1.parsed.json +10 -0
  187. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-2.txt.1.txt +1 -0
  188. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.hocr.0.hocr.html +26 -0
  189. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.hocr.0.parsed.json +176 -0
  190. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.html.0.html +64 -0
  191. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.html.1.html +54 -0
  192. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.html.2.html +59 -0
  193. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.html.3.html +64 -0
  194. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.html.4.html +31 -0
  195. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.html.5.html +12 -0
  196. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.html.6.html +20 -0
  197. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.html.8.html +66 -0
  198. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.md.0.md +32 -0
  199. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.md.1.md +21 -0
  200. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.md.2.md +34 -0
  201. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.tsv.0.parsed.json +122 -0
  202. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.tsv.0.tsv +12 -0
  203. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.txt.0.parsed.json +10 -0
  204. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.txt.0.txt +15 -0
  205. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.txt.1.parsed.json +10 -0
  206. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-3.txt.1.txt +17 -0
  207. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.hocr.0.hocr.html +25 -0
  208. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.hocr.0.parsed.json +135 -0
  209. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.html.0.html +60 -0
  210. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.html.1.html +54 -0
  211. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.html.2.html +54 -0
  212. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.html.3.html +60 -0
  213. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.html.4.html +31 -0
  214. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.html.5.html +7 -0
  215. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.html.6.html +16 -0
  216. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.html.8.html +65 -0
  217. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.md.0.md +17 -0
  218. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.md.1.md +11 -0
  219. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.md.2.md +22 -0
  220. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.tsv.0.parsed.json +99 -0
  221. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.tsv.0.tsv +11 -0
  222. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.txt.0.parsed.json +10 -0
  223. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.txt.0.txt +7 -0
  224. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.txt.1.parsed.json +10 -0
  225. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-formulas.txt.1.txt +12 -0
  226. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.hocr.0.hocr.html +18 -0
  227. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.hocr.0.parsed.json +63 -0
  228. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.html.0.html +59 -0
  229. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.html.1.html +54 -0
  230. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.html.2.html +55 -0
  231. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.html.3.html +59 -0
  232. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.html.4.html +31 -0
  233. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.html.5.html +8 -0
  234. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.html.6.html +15 -0
  235. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.html.8.html +59 -0
  236. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.md.0.md +18 -0
  237. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.md.1.md +10 -0
  238. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.md.2.md +18 -0
  239. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.tsv.0.parsed.json +34 -0
  240. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.tsv.0.tsv +4 -0
  241. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.txt.0.parsed.json +10 -0
  242. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.txt.0.txt +5 -0
  243. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.txt.1.parsed.json +10 -0
  244. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-hostile.txt.1.txt +5 -0
  245. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.hocr.0.hocr.html +17 -0
  246. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.hocr.0.parsed.json +94 -0
  247. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.html.0.html +55 -0
  248. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.html.1.html +50 -0
  249. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.html.2.html +53 -0
  250. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.html.3.html +55 -0
  251. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.html.4.html +27 -0
  252. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.html.5.html +6 -0
  253. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.html.6.html +11 -0
  254. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.html.8.html +55 -0
  255. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.md.0.md +15 -0
  256. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.md.1.md +9 -0
  257. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.md.2.md +16 -0
  258. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.tsv.0.parsed.json +45 -0
  259. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.tsv.0.tsv +5 -0
  260. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.txt.0.parsed.json +10 -0
  261. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.txt.0.txt +7 -0
  262. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.txt.1.parsed.json +10 -0
  263. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-normalized.txt.1.txt +7 -0
  264. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.hocr.0.hocr.html +18 -0
  265. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.hocr.0.parsed.json +78 -0
  266. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.html.0.html +59 -0
  267. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.html.1.html +54 -0
  268. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.html.2.html +55 -0
  269. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.html.3.html +59 -0
  270. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.html.4.html +31 -0
  271. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.html.5.html +8 -0
  272. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.html.6.html +15 -0
  273. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.html.8.html +59 -0
  274. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.md.0.md +16 -0
  275. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.md.1.md +10 -0
  276. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.md.2.md +16 -0
  277. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.tsv.0.parsed.json +40 -0
  278. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.tsv.0.tsv +4 -0
  279. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.txt.0.parsed.json +10 -0
  280. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.txt.0.txt +7 -0
  281. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.txt.1.parsed.json +10 -0
  282. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-per-mille.txt.1.txt +7 -0
  283. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.hocr.0.hocr.html +16 -0
  284. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.hocr.0.parsed.json +31 -0
  285. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.html.0.html +54 -0
  286. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.html.1.html +52 -0
  287. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.html.2.html +49 -0
  288. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.html.3.html +54 -0
  289. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.html.4.html +29 -0
  290. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.html.5.html +2 -0
  291. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.html.6.html +10 -0
  292. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.html.8.html +54 -0
  293. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.md.0.md +10 -0
  294. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.md.1.md +5 -0
  295. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.md.2.md +10 -0
  296. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.tsv.0.parsed.json +11 -0
  297. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.tsv.0.tsv +4 -0
  298. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.txt.0.parsed.json +10 -0
  299. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.txt.0.txt +3 -0
  300. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.txt.1.parsed.json +10 -0
  301. oatschema_adapters-0.1.0/tests/data/expected/document-extraction-text-only.txt.1.txt +3 -0
  302. oatschema_adapters-0.1.0/tests/data/expected/index.json +805 -0
  303. oatschema_adapters-0.1.0/tests/data/invalid-audio-transcription-bad-language-code.json +4 -0
  304. oatschema_adapters-0.1.0/tests/data/invalid-audio-transcription-invalid-segment.json +13 -0
  305. oatschema_adapters-0.1.0/tests/data/invalid-audio-transcription-missing-content.json +4 -0
  306. oatschema_adapters-0.1.0/tests/data/invalid-document-extraction-bad-missing-text.json +10 -0
  307. oatschema_adapters-0.1.0/tests/data/invalid-document-extraction-bad-multipolygon-norm.json +17 -0
  308. oatschema_adapters-0.1.0/tests/document/test_document_helpers.py +276 -0
  309. oatschema_adapters-0.1.0/tests/document/test_document_hocr.py +337 -0
  310. oatschema_adapters-0.1.0/tests/document/test_document_html_exporter.py +333 -0
  311. oatschema_adapters-0.1.0/tests/document/test_document_html_render.py +64 -0
  312. oatschema_adapters-0.1.0/tests/document/test_document_md.py +71 -0
  313. oatschema_adapters-0.1.0/tests/document/test_document_tsv.py +79 -0
  314. oatschema_adapters-0.1.0/tests/document/test_document_txt.py +55 -0
  315. oatschema_adapters-0.1.0/tests/golden_cases.py +73 -0
  316. oatschema_adapters-0.1.0/tests/test_escaping.py +171 -0
  317. oatschema_adapters-0.1.0/tests/test_fixes.py +314 -0
  318. oatschema_adapters-0.1.0/tests/test_golden.py +155 -0
  319. oatschema_adapters-0.1.0/tests/test_licensing.py +58 -0
  320. oatschema_adapters-0.1.0/tests/test_options.py +229 -0
  321. oatschema_adapters-0.1.0/tests/test_packaging.py +156 -0
  322. oatschema_adapters-0.1.0/tests/test_registry.py +301 -0
  323. oatschema_adapters-0.1.0/tests/test_tsv_formulas.py +195 -0
  324. oatschema_adapters-0.1.0/tests/test_versions.py +169 -0
@@ -0,0 +1,6 @@
1
+ # SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ * text=auto eol=lf
5
+
6
+ tests/data/expected/** -text
@@ -0,0 +1,219 @@
1
+ # SPDX-FileCopyrightText: 2026 The OATS Authors
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[codz]
7
+ *$py.class
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py.cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ #Pipfile.lock
99
+
100
+ # UV
101
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ #uv.lock
105
+
106
+ # poetry
107
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
108
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
109
+ # commonly ignored for libraries.
110
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
111
+ #poetry.lock
112
+ #poetry.toml
113
+
114
+ # pdm
115
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
116
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
117
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
118
+ #pdm.lock
119
+ #pdm.toml
120
+ .pdm-python
121
+ .pdm-build/
122
+
123
+ # pixi
124
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
125
+ #pixi.lock
126
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
127
+ # in the .venv directory. It is recommended not to include this directory in version control.
128
+ .pixi
129
+
130
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
131
+ __pypackages__/
132
+
133
+ # Celery stuff
134
+ celerybeat-schedule
135
+ celerybeat.pid
136
+
137
+ # SageMath parsed files
138
+ *.sage.py
139
+
140
+ # Environments
141
+ .env
142
+ .envrc
143
+ .venv
144
+ env/
145
+ venv/
146
+ ENV/
147
+ env.bak/
148
+ venv.bak/
149
+
150
+ # Spyder project settings
151
+ .spyderproject
152
+ .spyproject
153
+
154
+ # Rope project settings
155
+ .ropeproject
156
+
157
+ # mkdocs documentation
158
+ /site
159
+
160
+ # mypy
161
+ .mypy_cache/
162
+ .dmypy.json
163
+ dmypy.json
164
+
165
+ # Pyre type checker
166
+ .pyre/
167
+
168
+ # pytype static type analyzer
169
+ .pytype/
170
+
171
+ # Cython debug symbols
172
+ cython_debug/
173
+
174
+ # PyCharm
175
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
176
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
177
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
178
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
179
+ #.idea/
180
+
181
+ # Abstra
182
+ # Abstra is an AI-powered process automation framework.
183
+ # Ignore directories containing user credentials, local state, and settings.
184
+ # Learn more at https://abstra.io/docs
185
+ .abstra/
186
+
187
+ # Visual Studio Code
188
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
189
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
190
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
191
+ # you could uncomment the following to ignore the entire vscode folder
192
+ # .vscode/
193
+
194
+ # Ruff stuff:
195
+ .ruff_cache/
196
+
197
+ # PyPI configuration file
198
+ .pypirc
199
+
200
+ # Cursor
201
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
202
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
203
+ # refer to https://docs.cursor.com/context/ignore-files
204
+ .cursorignore
205
+ .cursorindexingignore
206
+
207
+ # Marimo
208
+ marimo/_static/
209
+ marimo/_lsp/
210
+ __marimo__/
211
+
212
+ # Claude
213
+ CLAUDE.md
214
+ CLAUDE.local.md
215
+ .claude/
216
+
217
+ # Antigravity
218
+ .antigravity/
219
+ .antigravity.md
@@ -0,0 +1,4 @@
1
+ The OATS Authors are the copyright holders of OATS. This file lists them.
2
+ Individuals and organisations may add themselves when they contribute.
3
+
4
+ Dorsal Hub LTD
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-10-31)
4
+
5
+ First release.
6
+
7
+ - Exporters for `audio-transcription` (SRT, WebVTT, Markdown, plain text and TSV) and `document-extraction` (HTML, hOCR, Markdown, plain text and TSV) records, with parsers for every format except document HTML and Markdown.
8
+ - Records are validated with `oatschema`, against the newest bundled schema version or the one passed as `schema_version`.
9
+ - `register_adapter` adds adapters for other schemas and formats to the same registry.
10
+ - Carries over the OATS adapters of `dorsalhub-adapters` 0.4.3, with bare schema names (no `open/` prefix), keyword-only options, and fixes to TSV, WebVTT, Markdown and hOCR output and parsing.
@@ -0,0 +1,44 @@
1
+ # Contributing
2
+
3
+ The schemas themselves are maintained in [oatschema/oats](https://github.com/oatschema/oats), and bundled for Python by [oatschema](https://github.com/oatschema/oatschema-py). This repository holds the adapters that convert records to and from other formats. Bug reports and pull requests are welcome.
4
+
5
+ ## Development
6
+
7
+ ```
8
+ uv sync
9
+ uv run pytest
10
+ uv run ruff check . && uv run ruff format --check .
11
+ uv run mypy src tests scripts
12
+ ```
13
+
14
+ `scripts/check.sh` runs all of these, with the tests on every supported Python version.
15
+
16
+ ## Tests
17
+
18
+ - Every rule an adapter follows has tests on every path it applies to: export and parse, validated and unvalidated, and Python values and command-line strings.
19
+ - `tests/test_golden.py` compares every export, and the parse of each export, with the output recorded from `dorsalhub-adapters` 0.4.3, the package this one replaced, in `tests/data/expected/`. A case may differ only if it's listed in `CHANGED` with its reason. To add cases, edit `tests/golden_cases.py` and record them again in a throwaway environment:
20
+
21
+ ```
22
+ uv run --isolated --no-project --with dorsalhub-adapters==0.4.3 python scripts/record_043_outputs.py
23
+ ```
24
+
25
+ - Fixtures in `tests/data/` are named `<schema>-<description>.json`, and invalid ones start with `invalid-`. Each adapter needs at least one fixture valid at every schema version `oatschema` bundles; `tests/test_versions.py` checks this.
26
+ - Coverage must stay at or above 80% overall, and 90% on each pull request's changed lines.
27
+
28
+ ## Versions
29
+
30
+ The package version follows [semantic versioning](https://semver.org), independently of the schema versions. Until 1.0, a minor release may change the API and a patch release won't. Every release has a CHANGELOG entry saying what changed, and whether anything breaks.
31
+
32
+ ## Licensing and sign-off
33
+
34
+ - The adapters are licensed under Apache-2.0, and contributions are accepted under the same licence. There is no CLA.
35
+ - Contributors keep the copyright in their contributions. Copyright is held by The OATS Authors, and you may add yourself or your employer to `AUTHORS`.
36
+ - Every commit needs a [Developer Certificate of Origin](https://developercertificate.org/) sign-off: commit with `git commit -s`.
37
+ - Every new source file (`.py`, `.toml`, `.yml`, `.sh`) starts with this header, which the tests check:
38
+
39
+ ```
40
+ # SPDX-FileCopyrightText: 2026 The OATS Authors
41
+ # SPDX-License-Identifier: Apache-2.0
42
+ ```
43
+
44
+ Keep the year as it is in new files; it is the year the project started, not the current year.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.5
2
+ Name: oatschema-adapters
3
+ Version: 0.1.0
4
+ Summary: Export OATS (Open Annotation Task Schemas) records to standard formats, and parse them back.
5
+ Project-URL: Homepage, https://oatschema.org
6
+ Project-URL: Repository, https://github.com/oatschema/oatschema-adapters-py
7
+ Project-URL: Changelog, https://github.com/oatschema/oatschema-adapters-py/blob/main/CHANGELOG.md
8
+ Author-email: OATS maintainers <maintainers@oatschema.org>
9
+ License-Expression: Apache-2.0
10
+ License-File: AUTHORS
11
+ License-File: LICENSE
12
+ Keywords: annotation,hocr,json-schema,oats,ocr,srt,transcription,webvtt
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.11
22
+ Requires-Dist: oatschema[validate]<0.9,>=0.8.0.2
23
+ Requires-Dist: srt>=3.5.3
24
+ Requires-Dist: webvtt-py>=0.5.1
25
+ Description-Content-Type: text/markdown
26
+
27
+ # oatschema-adapters
28
+
29
+ [![PyPI](https://img.shields.io/pypi/v/oatschema-adapters.svg)](https://pypi.org/project/oatschema-adapters/)
30
+ [![Python versions](https://img.shields.io/pypi/pyversions/oatschema-adapters.svg)](https://pypi.org/project/oatschema-adapters/)
31
+ [![CI](https://github.com/oatschema/oatschema-adapters-py/actions/workflows/ci.yml/badge.svg)](https://github.com/oatschema/oatschema-adapters-py/actions/workflows/ci.yml)
32
+ [![Coverage](https://codecov.io/gh/oatschema/oatschema-adapters-py/graph/badge.svg)](https://codecov.io/gh/oatschema/oatschema-adapters-py)
33
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/oatschema/oatschema-adapters-py/blob/main/LICENSE)
34
+
35
+ Export [OATS](https://oatschema.org) (Open Annotation Task Schemas) records to standard formats, and parse those formats back into records.
36
+
37
+ - **`audio-transcription`** records become SRT or WebVTT subtitles, Markdown, plain text or a TSV table, and each of those parses back.
38
+ - **`document-extraction`** records become HTML, hOCR, Markdown, plain text or a TSV table. hOCR, plain text and TSV parse back.
39
+ - **Validated.** Records are validated with [oatschema](https://pypi.org/project/oatschema/) before export and after parsing, against the schema version you name.
40
+ - **Safe with untrusted records.** Every value is escaped in HTML and hOCR, whether or not the record was validated, and no TSV cell runs as a spreadsheet formula.
41
+ - **Typed.** Ships `py.typed`.
42
+
43
+ ## Quick start
44
+
45
+ ```
46
+ pip install oatschema-adapters
47
+ ```
48
+
49
+ ```python
50
+ from oatschema_adapters import get_adapter
51
+
52
+ record = {
53
+ "language": "eng",
54
+ "segments": [
55
+ {"text": "Welcome back.", "start_time": 0.5, "end_time": 2.25, "speaker": {"id": "s1", "name": "Maria"}},
56
+ {"text": "Thank you.", "start_time": 2.5, "end_time": 3.0, "speaker": {"id": "s2", "name": "Jean"}},
57
+ ],
58
+ }
59
+
60
+ vtt = get_adapter("audio-transcription", "vtt")
61
+ captions = vtt.export(record, include_speakers=True)
62
+ # WEBVTT
63
+ #
64
+ # 00:00:00.500 --> 00:00:02.250
65
+ # <v Maria>Welcome back.
66
+ # ...
67
+
68
+ parsed = vtt.parse(captions) # an audio-transcription record, validated
69
+ ```
70
+
71
+ Requires Python 3.11 or later.
72
+
73
+ ## Formats
74
+
75
+ | Schema | Format | Aliases | Extension | Parses |
76
+ | :--- | :--- | :--- | :--- | :--- |
77
+ | `audio-transcription` | `srt` | | `srt` | yes |
78
+ | | `vtt` | `webvtt` | `vtt` | yes |
79
+ | | `md` | `markdown` | `md` | yes |
80
+ | | `txt` | | `txt` | yes |
81
+ | | `tsv` | | `tsv` | yes |
82
+ | `document-extraction` | `html` | | `html` | no |
83
+ | | `hocr` | `hocr.html` | `hocr.html` | yes |
84
+ | | `md` | `markdown` | `md` | no |
85
+ | | `txt` | | `txt` | yes |
86
+ | | `tsv` | | `tsv` | yes |
87
+
88
+ `list_schemas()` and `list_formats(schema)` list them at run time, and `format_aliases(schema)` maps each alias to its format.
89
+
90
+ ```python
91
+ from oatschema_adapters import get_adapter, list_formats
92
+
93
+ list_formats("document-extraction")
94
+ # [('hocr', 'hOCR (.html) - ...'), ('html', 'Semantic HTML (.html) - ...'), ...]
95
+
96
+ adapter = get_adapter("document-extraction", "markdown")
97
+ adapter.format_name # 'md'
98
+ adapter.extension # 'md'
99
+ adapter.can_parse # False
100
+ ```
101
+
102
+ An `Adapter` has `export(record, **options)` and `parse(content, **options)`, and `export_file` and `parse_file` for file objects. `export` takes a dict, or a JSON object as `str` or `bytes`.
103
+
104
+ ## Options
105
+
106
+ Every exporter and parser takes `validate` (default `True`) and `schema_version` (default `None`, the newest version `oatschema` bundles). Parsers also take `producer`, the parsed record's `producer`.
107
+
108
+ | Schema | Format | Export options |
109
+ | :--- | :--- | :--- |
110
+ | `audio-transcription` | `srt`, `vtt`, `tsv` | `include_speakers=False` |
111
+ | | `md` | `include_timestamps=True`, `include_milliseconds=False`, `include_speakers=False`, `include_frontmatter=True`, `low_confidence_threshold=0.8` |
112
+ | `document-extraction` | `html` | `layout="col"` (`"col"`, `"grid"` or `"wireframe"`), `style="default"` (`"default"`, `"dark"` or `"none"`), `style_path=None`, `footer=None`, `fragment=False`, `gap_x=-1.0`, `gap_y=-1.0`, and the layout options below |
113
+ | | `md` | `include_frontmatter=True`, `low_confidence_threshold=0.8`, and the layout options below |
114
+ | | `txt` | the layout options below |
115
+
116
+ The layout options decide how blocks are joined into lines and paragraphs: `strict=False`, `line_tolerance=5.0`, `paragraph_margin=20.0`, `column_jump=-10.0` and `scale=None`. The document `tsv` parser takes `unit="px"`, and the `hocr` parser takes `target_class="ocr_line"`.
117
+
118
+ Options are keyword arguments. A value given as a string, as from a command line, is converted to the option's type: `"false"`, `"no"`, `"off"` and `"0"` are false, and `"0.5"` is a number. A value that can't be converted, or an option the adapter doesn't have, raises an error naming it:
119
+
120
+ ```python
121
+ adapter.export(record, include_speakers="maybe")
122
+ # ValueError: to_vtt() option 'include_speakers' must be true or false, not 'maybe'
123
+ adapter.export(record, include_speaker=True)
124
+ # TypeError: to_vtt() got unknown option(s) 'include_speaker'; options: validate, schema_version, include_speakers
125
+ ```
126
+
127
+ You can also call the functions directly, from `oatschema_adapters.audio` and `oatschema_adapters.document`:
128
+
129
+ ```python
130
+ from oatschema_adapters.document import to_html
131
+
132
+ fragment = to_html(document_record, layout="wireframe", fragment=True)
133
+ ```
134
+
135
+ ## Validation
136
+
137
+ Records are validated before they're exported, and parsed records before they're returned. A record that doesn't conform raises `oatschema.ValidationError`, which says where and why without quoting the record's values:
138
+
139
+ ```python
140
+ import oatschema
141
+
142
+ try:
143
+ get_adapter("audio-transcription", "srt").export({"segments": [{"text": "hi", "start_time": -1, "end_time": 1}]})
144
+ except oatschema.ValidationError as error:
145
+ print(error) # audio-transcription 0.8.0 at /segments/0/start_time: … is less than the minimum of 0
146
+ print(error.keyword) # minimum
147
+ ```
148
+
149
+ Pass `schema_version="0.6.0"` to validate against an older version, such as the one a stored record was written for; any version from 0.4.0 that `oatschema` bundles works. An unbundled version raises `LookupError`. Pass `validate=False` to skip validation.
150
+
151
+ Output is escaped whether or not the record was validated, so `validate=False` is safe for untrusted records: every value is escaped in HTML and hOCR, a `style` value is only ever a theme name, never a file to read, and a stylesheet from `style_path` can't close its `<style>` element.
152
+
153
+ ## TSV and spreadsheets
154
+
155
+ A TSV cell that starts with `=`, `+`, `-`, `@`, a tab or a carriage return gets a leading `'`, unless the whole cell is a number, so Excel, LibreOffice Calc and Google Sheets show it as text instead of running it as a formula. A cell that already starts with `'` followed by one of those characters gets another `'`. The TSV parsers remove exactly one, so exporting and parsing gives back the original text. The one exception is the audio exporter, which, as before, replaces tabs in a segment's text with spaces and trims surrounding whitespace.
156
+
157
+ ## Adding adapters
158
+
159
+ `register_adapter` adds an adapter to the same registry, for another schema or another format of an OATS schema. Give the functions as `"module:function"` strings, so they're imported only when used:
160
+
161
+ ```python
162
+ from oatschema_adapters import get_adapter, register_adapter
163
+
164
+ register_adapter(
165
+ "example/citation",
166
+ "bibtex",
167
+ description="BibTeX (.bib) - A bibliographic reference format.",
168
+ extension="bib",
169
+ export="my_package.bibtex:to_bibtex",
170
+ aliases=["bib"],
171
+ )
172
+
173
+ get_adapter("example/citation", "bib").export(record)
174
+ ```
175
+
176
+ The export function takes the record first and its options as keyword arguments; a parse function takes the content first. Registering a format that already exists raises `ValueError` unless you pass `replace=True`. Validating records of schemas other than OATS is up to your functions.
177
+
178
+ ## Versions
179
+
180
+ `oatschema-adapters` uses [semantic versioning](https://semver.org), independently of the OATS schema versions. Until 1.0, a minor release (0.2.0) may change the API, and a patch release (0.1.1) won't. Pin with `oatschema-adapters>=0.1,<0.2`. It depends on `oatschema[validate]>=0.8.0.2,<0.9`.
181
+
182
+ See the [CHANGELOG](https://github.com/oatschema/oatschema-adapters-py/blob/main/CHANGELOG.md) for what changed in each release.
183
+
184
+ ## License
185
+
186
+ Apache-2.0. Copyright The OATS Authors; see [AUTHORS](https://github.com/oatschema/oatschema-adapters-py/blob/main/AUTHORS).