verso-ru 0.1.39__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 (311) hide show
  1. verso_ru-0.1.39/LICENSE +201 -0
  2. verso_ru-0.1.39/NOTICE +20 -0
  3. verso_ru-0.1.39/PKG-INFO +38 -0
  4. verso_ru-0.1.39/README.md +7 -0
  5. verso_ru-0.1.39/pyproject.toml +72 -0
  6. verso_ru-0.1.39/setup.cfg +4 -0
  7. verso_ru-0.1.39/src/verso/ru/__init__.py +1 -0
  8. verso_ru-0.1.39/src/verso/ru/ages.py +299 -0
  9. verso_ru-0.1.39/src/verso/ru/archives/__init__.py +1 -0
  10. verso_ru-0.1.39/src/verso/ru/archives/kaisa.py +491 -0
  11. verso_ru-0.1.39/src/verso/ru/census_revisions.py +61 -0
  12. verso_ru-0.1.39/src/verso/ru/church_calendar/__init__.py +14 -0
  13. verso_ru-0.1.39/src/verso/ru/church_calendar/church_slavonic.py +225 -0
  14. verso_ru-0.1.39/src/verso/ru/church_calendar/data/LICENSE.svyatcy +35 -0
  15. verso_ru-0.1.39/src/verso/ru/church_calendar/data/svyatcy_1906.tsv +1065 -0
  16. verso_ru-0.1.39/src/verso/ru/church_calendar/julian.py +97 -0
  17. verso_ru-0.1.39/src/verso/ru/church_calendar/paschalion.py +129 -0
  18. verso_ru-0.1.39/src/verso/ru/church_calendar/svyatcy.py +221 -0
  19. verso_ru-0.1.39/src/verso/ru/cli/__init__.py +0 -0
  20. verso_ru-0.1.39/src/verso/ru/cli/all_persons.py +524 -0
  21. verso_ru-0.1.39/src/verso/ru/cli/canonicalize_legacy_tf.py +570 -0
  22. verso_ru-0.1.39/src/verso/ru/cli/echz.py +160 -0
  23. verso_ru-0.1.39/src/verso/ru/cli/export_csv.py +106 -0
  24. verso_ru-0.1.39/src/verso/ru/cli/export_records.py +47 -0
  25. verso_ru-0.1.39/src/verso/ru/cli/facts.py +1166 -0
  26. verso_ru-0.1.39/src/verso/ru/cli/facts_snapshot.py +176 -0
  27. verso_ru-0.1.39/src/verso/ru/cli/familio_spravochnik.py +177 -0
  28. verso_ru-0.1.39/src/verso/ru/cli/fetch_record.py +235 -0
  29. verso_ru-0.1.39/src/verso/ru/cli/find_person.py +173 -0
  30. verso_ru-0.1.39/src/verso/ru/cli/fix_combined_name_patronymic.py +111 -0
  31. verso_ru-0.1.39/src/verso/ru/cli/fix_ich_patronymics.py +120 -0
  32. verso_ru-0.1.39/src/verso/ru/cli/generate_familio_tf.py +131 -0
  33. verso_ru-0.1.39/src/verso/ru/cli/generate_tf.py +416 -0
  34. verso_ru-0.1.39/src/verso/ru/cli/generate_timeline.py +92 -0
  35. verso_ru-0.1.39/src/verso/ru/cli/migrate_statuses.py +125 -0
  36. verso_ru-0.1.39/src/verso/ru/cli/names.py +425 -0
  37. verso_ru-0.1.39/src/verso/ru/cli/remove_duplicates.py +281 -0
  38. verso_ru-0.1.39/src/verso/ru/cli/review_ratchet.py +276 -0
  39. verso_ru-0.1.39/src/verso/ru/cli/show_record.py +99 -0
  40. verso_ru-0.1.39/src/verso/ru/cli/stale.py +346 -0
  41. verso_ru-0.1.39/src/verso/ru/cli/statuses_toml.py +45 -0
  42. verso_ru-0.1.39/src/verso/ru/cli/svyatcy.py +176 -0
  43. verso_ru-0.1.39/src/verso/ru/cli/translit.py +117 -0
  44. verso_ru-0.1.39/src/verso/ru/cli/upgrade_dsl.py +64 -0
  45. verso_ru-0.1.39/src/verso/ru/consolidation/__init__.py +1 -0
  46. verso_ru-0.1.39/src/verso/ru/consolidation/age_conflicts.py +290 -0
  47. verso_ru-0.1.39/src/verso/ru/consolidation/apply_converge.py +223 -0
  48. verso_ru-0.1.39/src/verso/ru/consolidation/batches/__init__.py +1 -0
  49. verso_ru-0.1.39/src/verso/ru/consolidation/batches/audit_matches.py +97 -0
  50. verso_ru-0.1.39/src/verso/ru/consolidation/batches/audit_unions.py +91 -0
  51. verso_ru-0.1.39/src/verso/ru/consolidation/batches/build.py +807 -0
  52. verso_ru-0.1.39/src/verso/ru/consolidation/batches/verify.py +163 -0
  53. verso_ru-0.1.39/src/verso/ru/consolidation/candidates.py +1823 -0
  54. verso_ru-0.1.39/src/verso/ru/consolidation/conflict_capture.py +512 -0
  55. verso_ru-0.1.39/src/verso/ru/consolidation/date_order.py +186 -0
  56. verso_ru-0.1.39/src/verso/ru/consolidation/death_age.py +441 -0
  57. verso_ru-0.1.39/src/verso/ru/consolidation/detector.py +1134 -0
  58. verso_ru-0.1.39/src/verso/ru/consolidation/document_sync.py +181 -0
  59. verso_ru-0.1.39/src/verso/ru/consolidation/drift.py +132 -0
  60. verso_ru-0.1.39/src/verso/ru/consolidation/estate_conflicts.py +325 -0
  61. verso_ru-0.1.39/src/verso/ru/consolidation/lint_config.py +838 -0
  62. verso_ru-0.1.39/src/verso/ru/consolidation/merge_plan.py +1042 -0
  63. verso_ru-0.1.39/src/verso/ru/consolidation/moved_blocks.py +329 -0
  64. verso_ru-0.1.39/src/verso/ru/consolidation/name_variants.py +143 -0
  65. verso_ru-0.1.39/src/verso/ru/consolidation/plan.py +71 -0
  66. verso_ru-0.1.39/src/verso/ru/consolidation/profile_reading.py +105 -0
  67. verso_ru-0.1.39/src/verso/ru/consolidation/reconcile.py +255 -0
  68. verso_ru-0.1.39/src/verso/ru/consolidation/sibling_spacing.py +308 -0
  69. verso_ru-0.1.39/src/verso/ru/consolidation/split_couples.py +366 -0
  70. verso_ru-0.1.39/src/verso/ru/consolidation/stale_claims.py +304 -0
  71. verso_ru-0.1.39/src/verso/ru/consolidation/stale_moved.py +319 -0
  72. verso_ru-0.1.39/src/verso/ru/consolidation/stale_stubs.py +359 -0
  73. verso_ru-0.1.39/src/verso/ru/consolidation/strip_dead_overrides.py +161 -0
  74. verso_ru-0.1.39/src/verso/ru/consolidation/tree_conflicts.py +821 -0
  75. verso_ru-0.1.39/src/verso/ru/consolidation/triage_unions.py +235 -0
  76. verso_ru-0.1.39/src/verso/ru/consolidation/union_duplicates.py +409 -0
  77. verso_ru-0.1.39/src/verso/ru/consolidation/verify_plan.py +381 -0
  78. verso_ru-0.1.39/src/verso/ru/corpus_data.py +310 -0
  79. verso_ru-0.1.39/src/verso/ru/domain/__init__.py +33 -0
  80. verso_ru-0.1.39/src/verso/ru/domain/cause_of_death.py +15 -0
  81. verso_ru-0.1.39/src/verso/ru/domain/causes_of_death.py +136 -0
  82. verso_ru-0.1.39/src/verso/ru/domain/estates.py +80 -0
  83. verso_ru-0.1.39/src/verso/ru/domain/event_date.py +50 -0
  84. verso_ru-0.1.39/src/verso/ru/domain/factories.py +127 -0
  85. verso_ru-0.1.39/src/verso/ru/domain/marital_status.py +24 -0
  86. verso_ru-0.1.39/src/verso/ru/domain/person.py +171 -0
  87. verso_ru-0.1.39/src/verso/ru/domain/record_defaults.py +165 -0
  88. verso_ru-0.1.39/src/verso/ru/domain/side.py +14 -0
  89. verso_ru-0.1.39/src/verso/ru/domain/status.py +51 -0
  90. verso_ru-0.1.39/src/verso/ru/domain/statuses.py +547 -0
  91. verso_ru-0.1.39/src/verso/ru/dsl/__init__.py +44 -0
  92. verso_ru-0.1.39/src/verso/ru/dsl/api-v1.json +3030 -0
  93. verso_ru-0.1.39/src/verso/ru/dsl/calls.py +27 -0
  94. verso_ru-0.1.39/src/verso/ru/dsl/causes_of_death.py +28 -0
  95. verso_ru-0.1.39/src/verso/ru/dsl/describe.py +236 -0
  96. verso_ru-0.1.39/src/verso/ru/dsl/kinds.py +134 -0
  97. verso_ru-0.1.39/src/verso/ru/dsl/marital_status.py +10 -0
  98. verso_ru-0.1.39/src/verso/ru/dsl/notes.py +573 -0
  99. verso_ru-0.1.39/src/verso/ru/dsl/order.py +229 -0
  100. verso_ru-0.1.39/src/verso/ru/dsl/paths.py +508 -0
  101. verso_ru-0.1.39/src/verso/ru/dsl/records/__init__.py +0 -0
  102. verso_ru-0.1.39/src/verso/ru/dsl/records/births.py +550 -0
  103. verso_ru-0.1.39/src/verso/ru/dsl/records/census.py +691 -0
  104. verso_ru-0.1.39/src/verso/ru/dsl/records/deaths.py +402 -0
  105. verso_ru-0.1.39/src/verso/ru/dsl/records/divorces.py +144 -0
  106. verso_ru-0.1.39/src/verso/ru/dsl/records/external_sources.py +612 -0
  107. verso_ru-0.1.39/src/verso/ru/dsl/records/marriages.py +404 -0
  108. verso_ru-0.1.39/src/verso/ru/dsl/records/name_lists.py +153 -0
  109. verso_ru-0.1.39/src/verso/ru/dsl/records/reviewed.py +47 -0
  110. verso_ru-0.1.39/src/verso/ru/dsl/signatures.py +21 -0
  111. verso_ru-0.1.39/src/verso/ru/dsl/source.py +1785 -0
  112. verso_ru-0.1.39/src/verso/ru/dsl/statuses.py +76 -0
  113. verso_ru-0.1.39/src/verso/ru/dsl/surface.py +166 -0
  114. verso_ru-0.1.39/src/verso/ru/dsl/upgrade.py +201 -0
  115. verso_ru-0.1.39/src/verso/ru/dsl/view.py +201 -0
  116. verso_ru-0.1.39/src/verso/ru/exporters/__init__.py +0 -0
  117. verso_ru-0.1.39/src/verso/ru/exporters/base.py +37 -0
  118. verso_ru-0.1.39/src/verso/ru/exporters/csv.py +388 -0
  119. verso_ru-0.1.39/src/verso/ru/exporters/csv_familio.py +812 -0
  120. verso_ru-0.1.39/src/verso/ru/exporters/familio_spravochnik.py +585 -0
  121. verso_ru-0.1.39/src/verso/ru/exporters/familio_template.py +109 -0
  122. verso_ru-0.1.39/src/verso/ru/exporters/table.py +32 -0
  123. verso_ru-0.1.39/src/verso/ru/facts/__init__.py +29 -0
  124. verso_ru-0.1.39/src/verso/ru/facts/checks/__init__.py +30 -0
  125. verso_ru-0.1.39/src/verso/ru/facts/checks/births.py +202 -0
  126. verso_ru-0.1.39/src/verso/ru/facts/checks/dates.py +165 -0
  127. verso_ru-0.1.39/src/verso/ru/facts/checks/deaths.py +127 -0
  128. verso_ru-0.1.39/src/verso/ru/facts/checks/estates.py +32 -0
  129. verso_ru-0.1.39/src/verso/ru/facts/checks/fathers.py +211 -0
  130. verso_ru-0.1.39/src/verso/ru/facts/checks/lags.py +95 -0
  131. verso_ru-0.1.39/src/verso/ru/facts/checks/lives.py +181 -0
  132. verso_ru-0.1.39/src/verso/ru/facts/checks/name_days.py +167 -0
  133. verso_ru-0.1.39/src/verso/ru/facts/checks/neighbours.py +169 -0
  134. verso_ru-0.1.39/src/verso/ru/facts/checks/parenthood.py +155 -0
  135. verso_ru-0.1.39/src/verso/ru/facts/checks/reach.py +95 -0
  136. verso_ru-0.1.39/src/verso/ru/facts/checks/reconcile.py +878 -0
  137. verso_ru-0.1.39/src/verso/ru/facts/checks/stated_age.py +60 -0
  138. verso_ru-0.1.39/src/verso/ru/facts/checks/wedding_ages.py +102 -0
  139. verso_ru-0.1.39/src/verso/ru/facts/checks/wedding_calendar.py +131 -0
  140. verso_ru-0.1.39/src/verso/ru/facts/extract/__init__.py +1 -0
  141. verso_ru-0.1.39/src/verso/ru/facts/extract/births.py +173 -0
  142. verso_ru-0.1.39/src/verso/ru/facts/extract/census.py +512 -0
  143. verso_ru-0.1.39/src/verso/ru/facts/extract/common.py +287 -0
  144. verso_ru-0.1.39/src/verso/ru/facts/extract/deaths.py +139 -0
  145. verso_ru-0.1.39/src/verso/ru/facts/extract/external_sources.py +84 -0
  146. verso_ru-0.1.39/src/verso/ru/facts/extract/marriages.py +138 -0
  147. verso_ru-0.1.39/src/verso/ru/facts/extract/name_lists.py +80 -0
  148. verso_ru-0.1.39/src/verso/ru/facts/identity.py +188 -0
  149. verso_ru-0.1.39/src/verso/ru/facts/model.py +702 -0
  150. verso_ru-0.1.39/src/verso/ru/facts/projection.py +171 -0
  151. verso_ru-0.1.39/src/verso/ru/facts/rules/__init__.py +1 -0
  152. verso_ru-0.1.39/src/verso/ru/facts/rules/cooccurrence.py +90 -0
  153. verso_ru-0.1.39/src/verso/ru/facts/rules/disagreement.py +115 -0
  154. verso_ru-0.1.39/src/verso/ru/facts/rules/separation.py +95 -0
  155. verso_ru-0.1.39/src/verso/ru/facts/rules/stated_age.py +180 -0
  156. verso_ru-0.1.39/src/verso/ru/familio/__init__.py +15 -0
  157. verso_ru-0.1.39/src/verso/ru/familio/lint_kin.py +135 -0
  158. verso_ru-0.1.39/src/verso/ru/familio/model.py +236 -0
  159. verso_ru-0.1.39/src/verso/ru/familio/projection.py +566 -0
  160. verso_ru-0.1.39/src/verso/ru/familio/sources.py +145 -0
  161. verso_ru-0.1.39/src/verso/ru/gender.py +6 -0
  162. verso_ru-0.1.39/src/verso/ru/importers/__init__.py +0 -0
  163. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/__init__.py +209 -0
  164. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/__main__.py +114 -0
  165. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/births.py +258 -0
  166. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/cells.py +114 -0
  167. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/columns.py +257 -0
  168. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/deaths.py +383 -0
  169. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/dsl_emit.py +137 -0
  170. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/formats.py +317 -0
  171. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/marriages.py +353 -0
  172. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/names.py +285 -0
  173. verso_ru-0.1.39/src/verso/ru/importers/google_sheets/sheets.py +47 -0
  174. verso_ru-0.1.39/src/verso/ru/importers/validation.py +1841 -0
  175. verso_ru-0.1.39/src/verso/ru/linters/__init__.py +0 -0
  176. verso_ru-0.1.39/src/verso/ru/linters/baseline.py +185 -0
  177. verso_ru-0.1.39/src/verso/ru/linters/checks/__init__.py +0 -0
  178. verso_ru-0.1.39/src/verso/ru/linters/checks/ages.py +304 -0
  179. verso_ru-0.1.39/src/verso/ru/linters/checks/birth_redundancy.py +283 -0
  180. verso_ru-0.1.39/src/verso/ru/linters/checks/census_age.py +507 -0
  181. verso_ru-0.1.39/src/verso/ru/linters/checks/census_member_lines.py +101 -0
  182. verso_ru-0.1.39/src/verso/ru/linters/checks/census_parent_link.py +1091 -0
  183. verso_ru-0.1.39/src/verso/ru/linters/checks/census_redundancy.py +554 -0
  184. verso_ru-0.1.39/src/verso/ru/linters/checks/census_status_redundancy.py +201 -0
  185. verso_ru-0.1.39/src/verso/ru/linters/checks/civil_register.py +330 -0
  186. verso_ru-0.1.39/src/verso/ru/linters/checks/deaths_burial_date.py +297 -0
  187. verso_ru-0.1.39/src/verso/ru/linters/checks/deaths_relatives.py +118 -0
  188. verso_ru-0.1.39/src/verso/ru/linters/checks/deaths_residence.py +248 -0
  189. verso_ru-0.1.39/src/verso/ru/linters/checks/dsl_imports.py +75 -0
  190. verso_ru-0.1.39/src/verso/ru/linters/checks/external_sources.py +188 -0
  191. verso_ru-0.1.39/src/verso/ru/linters/checks/file_bindings.py +73 -0
  192. verso_ru-0.1.39/src/verso/ru/linters/checks/genders.py +290 -0
  193. verso_ru-0.1.39/src/verso/ru/linters/checks/hidden_flag.py +110 -0
  194. verso_ru-0.1.39/src/verso/ru/linters/checks/lexicon.py +257 -0
  195. verso_ru-0.1.39/src/verso/ru/linters/checks/marital_status.py +104 -0
  196. verso_ru-0.1.39/src/verso/ru/linters/checks/marriage_residence.py +192 -0
  197. verso_ru-0.1.39/src/verso/ru/linters/checks/name_gender_agreement.py +156 -0
  198. verso_ru-0.1.39/src/verso/ru/linters/checks/name_lists.py +89 -0
  199. verso_ru-0.1.39/src/verso/ru/linters/checks/names.py +204 -0
  200. verso_ru-0.1.39/src/verso/ru/linters/checks/newborn_status.py +143 -0
  201. verso_ru-0.1.39/src/verso/ru/linters/checks/parent_member.py +196 -0
  202. verso_ru-0.1.39/src/verso/ru/linters/checks/parent_status.py +885 -0
  203. verso_ru-0.1.39/src/verso/ru/linters/checks/patronymic_form.py +253 -0
  204. verso_ru-0.1.39/src/verso/ru/linters/checks/relationship_ref.py +181 -0
  205. verso_ru-0.1.39/src/verso/ru/linters/checks/relative_attachment.py +334 -0
  206. verso_ru-0.1.39/src/verso/ru/linters/checks/residence_title.py +594 -0
  207. verso_ru-0.1.39/src/verso/ru/linters/checks/retractions.py +133 -0
  208. verso_ru-0.1.39/src/verso/ru/linters/checks/reviewed_redundancy.py +169 -0
  209. verso_ru-0.1.39/src/verso/ru/linters/checks/shared_ast.py +113 -0
  210. verso_ru-0.1.39/src/verso/ru/linters/checks/single_line_calls.py +388 -0
  211. verso_ru-0.1.39/src/verso/ru/linters/checks/status_orthography.py +155 -0
  212. verso_ru-0.1.39/src/verso/ru/linters/checks/status_redundancy.py +253 -0
  213. verso_ru-0.1.39/src/verso/ru/linters/checks/status_words.py +260 -0
  214. verso_ru-0.1.39/src/verso/ru/linters/checks/translit.py +62 -0
  215. verso_ru-0.1.39/src/verso/ru/linters/checks/unmapped_location.py +231 -0
  216. verso_ru-0.1.39/src/verso/ru/linters/checks/witness_side.py +246 -0
  217. verso_ru-0.1.39/src/verso/ru/linters/codes.py +67 -0
  218. verso_ru-0.1.39/src/verso/ru/linters/dead_code.py +282 -0
  219. verso_ru-0.1.39/src/verso/ru/linters/dsllint.py +416 -0
  220. verso_ru-0.1.39/src/verso/ru/linters/findings.py +110 -0
  221. verso_ru-0.1.39/src/verso/ru/linters/fixes.py +134 -0
  222. verso_ru-0.1.39/src/verso/ru/linters/hosted.py +113 -0
  223. verso_ru-0.1.39/src/verso/ru/linters/hosted.toml +715 -0
  224. verso_ru-0.1.39/src/verso/ru/linters/issue.py +106 -0
  225. verso_ru-0.1.39/src/verso/ru/linters/names_csv.py +209 -0
  226. verso_ru-0.1.39/src/verso/ru/linters/names_layer.py +184 -0
  227. verso_ru-0.1.39/src/verso/ru/linters/on_json/__init__.py +205 -0
  228. verso_ru-0.1.39/src/verso/ru/linters/on_json/census.py +392 -0
  229. verso_ru-0.1.39/src/verso/ru/linters/on_json/common.py +314 -0
  230. verso_ru-0.1.39/src/verso/ru/linters/on_json/estates.py +889 -0
  231. verso_ru-0.1.39/src/verso/ru/linters/on_json/events.py +299 -0
  232. verso_ru-0.1.39/src/verso/ru/linters/on_json/names.py +471 -0
  233. verso_ru-0.1.39/src/verso/ru/linters/on_json/places.py +58 -0
  234. verso_ru-0.1.39/src/verso/ru/linters/on_json/redundancy.py +738 -0
  235. verso_ru-0.1.39/src/verso/ru/linters/on_json/walk.py +416 -0
  236. verso_ru-0.1.39/src/verso/ru/linters/translit_layer.py +199 -0
  237. verso_ru-0.1.39/src/verso/ru/locales/en.toml +1729 -0
  238. verso_ru-0.1.39/src/verso/ru/locales/ru.toml +1646 -0
  239. verso_ru-0.1.39/src/verso/ru/messages.py +18 -0
  240. verso_ru-0.1.39/src/verso/ru/naming/__init__.py +42 -0
  241. verso_ru-0.1.39/src/verso/ru/naming/data/base/SOURCES.md +84 -0
  242. verso_ru-0.1.39/src/verso/ru/naming/data/base/forms.tsv +76 -0
  243. verso_ru-0.1.39/src/verso/ru/naming/data/base/names.tsv +9648 -0
  244. verso_ru-0.1.39/src/verso/ru/naming/data/base/patronymics.tsv +3 -0
  245. verso_ru-0.1.39/src/verso/ru/naming/data/translit/ru-v2.toml +80 -0
  246. verso_ru-0.1.39/src/verso/ru/naming/derived.py +201 -0
  247. verso_ru-0.1.39/src/verso/ru/naming/fathers.py +86 -0
  248. verso_ru-0.1.39/src/verso/ru/naming/forms.py +104 -0
  249. verso_ru-0.1.39/src/verso/ru/naming/gender_inference.py +36 -0
  250. verso_ru-0.1.39/src/verso/ru/naming/genitive.py +84 -0
  251. verso_ru-0.1.39/src/verso/ru/naming/layer_diff.py +515 -0
  252. verso_ru-0.1.39/src/verso/ru/naming/layer_files.py +307 -0
  253. verso_ru-0.1.39/src/verso/ru/naming/layers.py +122 -0
  254. verso_ru-0.1.39/src/verso/ru/naming/legacy.py +298 -0
  255. verso_ru-0.1.39/src/verso/ru/naming/lexicon.py +586 -0
  256. verso_ru-0.1.39/src/verso/ru/naming/matching.py +50 -0
  257. verso_ru-0.1.39/src/verso/ru/naming/names_registry.py +443 -0
  258. verso_ru-0.1.39/src/verso/ru/naming/names_table.py +117 -0
  259. verso_ru-0.1.39/src/verso/ru/naming/oracle.py +153 -0
  260. verso_ru-0.1.39/src/verso/ru/naming/orthography.py +122 -0
  261. verso_ru-0.1.39/src/verso/ru/naming/patronymics.py +79 -0
  262. verso_ru-0.1.39/src/verso/ru/naming/surnames.py +89 -0
  263. verso_ru-0.1.39/src/verso/ru/naming/translit_layers.py +256 -0
  264. verso_ru-0.1.39/src/verso/ru/naming/transliteration.py +464 -0
  265. verso_ru-0.1.39/src/verso/ru/naming/usage.py +70 -0
  266. verso_ru-0.1.39/src/verso/ru/naming/validation.py +47 -0
  267. verso_ru-0.1.39/src/verso/ru/notes/__init__.py +3 -0
  268. verso_ru-0.1.39/src/verso/ru/notes/stale_notes.py +1073 -0
  269. verso_ru-0.1.39/src/verso/ru/persons/__init__.py +4 -0
  270. verso_ru-0.1.39/src/verso/ru/persons/corpus.py +65 -0
  271. verso_ru-0.1.39/src/verso/ru/persons/lives.py +411 -0
  272. verso_ru-0.1.39/src/verso/ru/persons/people.py +422 -0
  273. verso_ru-0.1.39/src/verso/ru/pipeline/__init__.py +1 -0
  274. verso_ru-0.1.39/src/verso/ru/pipeline/facts.py +89 -0
  275. verso_ru-0.1.39/src/verso/ru/pipeline/translate.py +201 -0
  276. verso_ru-0.1.39/src/verso/ru/plugin.py +159 -0
  277. verso_ru-0.1.39/src/verso/ru/py.typed +0 -0
  278. verso_ru-0.1.39/src/verso/ru/records/__init__.py +2 -0
  279. verso_ru-0.1.39/src/verso/ru/records/blank.py +119 -0
  280. verso_ru-0.1.39/src/verso/ru/records/cite.py +130 -0
  281. verso_ru-0.1.39/src/verso/ru/records/records-v1.json +5956 -0
  282. verso_ru-0.1.39/src/verso/ru/records/ui-hints.toml +653 -0
  283. verso_ru-0.1.39/src/verso/ru/records/ui-v1.json +2570 -0
  284. verso_ru-0.1.39/src/verso/ru/records/vocabulary.py +258 -0
  285. verso_ru-0.1.39/src/verso/ru/relationship.py +65 -0
  286. verso_ru-0.1.39/src/verso/ru/search.py +131 -0
  287. verso_ru-0.1.39/src/verso/ru/targets/__init__.py +1 -0
  288. verso_ru-0.1.39/src/verso/ru/targets/geni/__init__.py +1 -0
  289. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/__init__.py +46 -0
  290. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/about_sections.py +208 -0
  291. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/birth_estimates.py +122 -0
  292. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/census_resolvers.py +343 -0
  293. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/comments.py +182 -0
  294. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/consolidation.py +218 -0
  295. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/generator.py +6865 -0
  296. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/member_birth.py +115 -0
  297. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/res_names.py +117 -0
  298. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/resources.py +99 -0
  299. verso_ru-0.1.39/src/verso/ru/targets/geni/translator/sorting.py +120 -0
  300. verso_ru-0.1.39/src/verso/ru/timeline/__init__.py +13 -0
  301. verso_ru-0.1.39/src/verso/ru/timeline/history.py +58 -0
  302. verso_ru-0.1.39/src/verso/ru/timeline/layout.py +484 -0
  303. verso_ru-0.1.39/src/verso/ru/timeline/model.py +148 -0
  304. verso_ru-0.1.39/src/verso/ru/timeline/projection.py +555 -0
  305. verso_ru-0.1.39/src/verso/ru/timeline/render.py +657 -0
  306. verso_ru-0.1.39/src/verso_ru.egg-info/PKG-INFO +38 -0
  307. verso_ru-0.1.39/src/verso_ru.egg-info/SOURCES.txt +309 -0
  308. verso_ru-0.1.39/src/verso_ru.egg-info/dependency_links.txt +1 -0
  309. verso_ru-0.1.39/src/verso_ru.egg-info/entry_points.txt +2 -0
  310. verso_ru-0.1.39/src/verso_ru.egg-info/requires.txt +12 -0
  311. verso_ru-0.1.39/src/verso_ru.egg-info/top_level.txt +1 -0
@@ -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.
verso_ru-0.1.39/NOTICE ADDED
@@ -0,0 +1,20 @@
1
+ Verso
2
+ Copyright 2026 Dmitry Malchikov
3
+
4
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ verso-ru includes verso/ru/church_calendar/data/svyatcy_1906.tsv, derived from the
7
+ «Алфавитъ именъ всѣхъ святыхъ» of the 1906 Требник as digitised in
8
+ https://github.com/slavonic/cu-md-sandbox — Copyright (c) 2018 Slavonic Computing
9
+ Initiative, MIT License; the full text is in verso/ru/church_calendar/data/LICENSE.svyatcy.
10
+ The names base (verso/ru/naming/data/base/) takes its canonical names from that table.
11
+
12
+ The names base also takes given names and their «said to be the same as» links from Wikidata
13
+ (https://www.wikidata.org), whose data is CC0 — no attribution is required; it is given as a
14
+ courtesy. Its other rows are the maintainer's own: the spellings the metric books write, paired
15
+ with their bases (a name and its base — no record is carried), and the forms written as grammar.
16
+ The sources of each row: verso/ru/naming/data/base/SOURCES.md.
17
+
18
+ verso-app includes icons from Lucide (https://lucide.dev) — Copyright (c) Lucide Icons and
19
+ Contributors, ISC License; the icons derived from Feather, Copyright (c) Cole Bemis, MIT License;
20
+ the full text is in verso/app/static/LICENSE.lucide.
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.4
2
+ Name: verso-ru
3
+ Version: 0.1.39
4
+ Summary: verso's plugin for records written in Russian: DSL, naming, linters, facts, translator
5
+ Author: Dmitry Malchikov
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://github.com/verso-genealogy/verso
8
+ Project-URL: Issues, https://github.com/verso-genealogy/verso/issues
9
+ Keywords: genealogy,metric books,revision lists,russian empire,geni
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Natural Language :: Russian
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Topic :: Sociology :: Genealogy
17
+ Requires-Python: >=3.14
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ License-File: NOTICE
21
+ Requires-Dist: verso-core==0.1.39
22
+ Requires-Dist: python-dateutil==4.0.0
23
+ Provides-Extra: xlsx
24
+ Requires-Dist: openpyxl==3.1.5; extra == "xlsx"
25
+ Provides-Extra: dsl-tools
26
+ Requires-Dist: libcst==1.9.0; extra == "dsl-tools"
27
+ Provides-Extra: sheets
28
+ Requires-Dist: verso-ru[dsl-tools]; extra == "sheets"
29
+ Requires-Dist: gspread>=6.0; extra == "sheets"
30
+ Dynamic: license-file
31
+
32
+ # verso-ru
33
+
34
+ The verso plugin for Russian metric books, revision lists and confession lists: the DSL the
35
+ records are written in, its linters, the translator to Geni's Terraform, the facts layer and
36
+ the consolidation checks.
37
+
38
+ Part of verso — https://github.com/verso-genealogy/verso
@@ -0,0 +1,7 @@
1
+ # verso-ru
2
+
3
+ The verso plugin for Russian metric books, revision lists and confession lists: the DSL the
4
+ records are written in, its linters, the translator to Geni's Terraform, the facts layer and
5
+ the consolidation checks.
6
+
7
+ Part of verso — https://github.com/verso-genealogy/verso
@@ -0,0 +1,72 @@
1
+ # verso-ru: the Russian books' plugin — the DSL and its kinds, the domain, naming, facts,
2
+ # consolidation, linters, exporters, importers, the translator, the CLI's modules.
3
+ [build-system]
4
+ requires = ["setuptools>=77"]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "verso-ru"
9
+ version = "0.1.39"
10
+ description = "verso's plugin for records written in Russian: DSL, naming, linters, facts, translator"
11
+ requires-python = ">=3.14"
12
+ license = "Apache-2.0"
13
+ license-files = ["LICENSE", "NOTICE"]
14
+ authors = [{ name = "Dmitry Malchikov" }]
15
+ readme = "README.md"
16
+ keywords = ["genealogy", "metric books", "revision lists", "russian empire", "geni"]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Intended Audience :: Science/Research",
20
+ "Natural Language :: Russian",
21
+ "Operating System :: OS Independent",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Programming Language :: Python :: 3.14",
24
+ "Topic :: Sociology :: Genealogy",
25
+ ]
26
+ # Pinned EXACTLY: their bytes reach what the corpus produces. python-dateutil does the
27
+ # translator's date and age arithmetic; openpyxl writes the Familio справочник; libcst writes
28
+ # Verso's edits back into the DSL and runs the codemods. There is no uv.lock (see `bootstrap` in
29
+ # the root Makefile), so this is the only place the version is held, and a bump arrives as a
30
+ # Dependabot PR: Lint and Test's staleness guards fail one that moves the generated tree or a
31
+ # committed CSV, and a corpus's own byte-for-byte comparison covers the rest of its
32
+ # output; openpyxl and libcst are held by their own tests. tests/test_output_pins.py keeps them
33
+ # exact. The res_names' transliteration is no package since 0.1.0: the profile ru-v1, our own table
34
+ # frozen by its hash (verso.ru.naming.transliteration).
35
+ dependencies = [
36
+ "verso-core==0.1.39",
37
+ "python-dateutil==4.0.0",
38
+ ]
39
+
40
+ [project.urls]
41
+ Repository = "https://github.com/verso-genealogy/verso"
42
+ Issues = "https://github.com/verso-genealogy/verso/issues"
43
+
44
+ [project.optional-dependencies]
45
+ # The Familio справочник (verso familio-spravochnik).
46
+ xlsx = ["openpyxl==3.1.5"]
47
+ # What edits the DSL: verso upgrade-dsl, the DSL's source primitives Verso writes through.
48
+ dsl-tools = ["libcst==1.9.0"]
49
+ # The Google Sheets importer: it writes DSL, so it takes the DSL's tools too.
50
+ sheets = ["verso-ru[dsl-tools]", "gspread>=6.0"]
51
+
52
+ # The plugins the core's registry finds (verso.core.plugins); a workspace enables one by
53
+ # name (`plugins = ["ru"]` in verso.toml). After a change here, `make bootstrap`: an entry point
54
+ # is the venv's metadata.
55
+ [project.entry-points."verso.plugins"]
56
+ ru = "verso.ru.plugin:PLUGIN"
57
+
58
+ [tool.setuptools.packages.find]
59
+ where = ["src"]
60
+ include = ["verso.ru*"]
61
+
62
+ # The official Familio МК submission template, the святцы table (with its upstream licence)
63
+ # the church-calendar checks read, the names base (its three tables and their sources), the
64
+ # records v1 JSON Schema of the plugin's vocabulary, and the DSL's surface — all read through
65
+ # importlib.resources.
66
+ [tool.setuptools.package-data]
67
+ "verso.ru" = ["locales/*.toml", "py.typed"]
68
+ "verso.ru.church_calendar" = ["data/*.tsv", "data/LICENSE*"]
69
+ "verso.ru.naming" = ["data/base/*.tsv", "data/base/SOURCES.md", "data/translit/*.toml"]
70
+ "verso.ru.records" = ["*.json", "*.toml"]
71
+ "verso.ru.dsl" = ["api-v*.json"]
72
+ "verso.ru.linters" = ["hosted.toml"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ """The «Российская империя» plugin: everything else of the library until 0.1.0 cuts the mixed packages."""
@@ -0,0 +1,299 @@
1
+ """Age tokenizer and renderer for metric-book age strings.
2
+
3
+ `split_age` is the single age parser shared by the CSV exporters
4
+ (`verso.ru.exporters.csv_familio`), the census birth-date resolvers
5
+ (`verso.ru.targets.geni.translator.census_resolvers`) and the consolidation
6
+ candidate finder (`verso.ru.consolidation.candidates`). It produces the four
7
+ tabular slots (Лет, Месяцев, Недель, Дней) and is deliberately NOT changed by
8
+ the prose renderer below — CSV columns never carry prose.
9
+
10
+ `age_bounds` reads a stated age as the DAY INTERVAL it asserts — the arithmetic
11
+ every cross-record check shares (`death-age-check`, `sibling-spacing`,
12
+ `birth-claims`, the sweep's infant matcher), built on `split_age` so a change
13
+ to age syntax cannot make a check and the exported columns disagree.
14
+
15
+ `format_age` is the single renderer for READER-FACING text: the `Возраст:` line
16
+ of a profile's `about`, the death document's `Умерший:` line, the name-list
17
+ roster. Before it existed, nine separate f-strings in the Terraform translator
18
+ each formatted the raw DSL value their own way, appending a fixed " лет" that
19
+ ignored Russian numeral agreement («3 лет», «1 лет») and doubled the unit when
20
+ the value already carried one («полгода лет», «6 недель лет»).
21
+ """
22
+
23
+ import re
24
+
25
+ _AGE_UNIT_TO_SLOT = {
26
+ # 0=years, 1=months, 2=weeks, 3=days
27
+ "г": 0, "л": 0, "лет": 0, "год": 0, "года": 0, "годов": 0,
28
+ "м": 1, "мес": 1, "месяц": 1, "месяца": 1, "месяцев": 1,
29
+ "н": 2, "нед": 2, "неделя": 2, "недели": 2, "недель": 2,
30
+ "д": 3, "дн": 3, "день": 3, "дня": 3, "дней": 3,
31
+ }
32
+
33
+ _AGE_TOKEN_RE = re.compile(r'(\d+)\s*([а-яё]+)\.?', re.IGNORECASE)
34
+
35
+ # Common pre-formal Russian idioms used by old metric books — pre-expanded
36
+ # so authors don't have to migrate, and `split_age` produces the same
37
+ # tabular CSV output as the formal grammar would.
38
+ _AGE_IDIOMS = {
39
+ "полгода": ("", "6", "", ""),
40
+ "пол года": ("", "6", "", ""),
41
+ "полу года": ("", "6", "", ""),
42
+ "полтора года": ("1", "6", "", ""),
43
+ }
44
+
45
+
46
+ def split_age(age):
47
+ """Split age into (Лет, Месяцев, Недель, Дней) tuple.
48
+
49
+ Accepts:
50
+ - None → all empty
51
+ - int / float → goes into Лет
52
+ - bare digit string → goes into Лет
53
+ - compound string like "19 лет 6 мес", "6 м", "1 н" → parsed by unit
54
+ - unparseable string → placed verbatim into Лет
55
+ """
56
+ if age is None:
57
+ return ("", "", "", "")
58
+ if isinstance(age, (int, float)):
59
+ return (str(age), "", "", "")
60
+ s = str(age).strip()
61
+ if not s:
62
+ return ("", "", "", "")
63
+ if s.isdigit():
64
+ return (s, "", "", "")
65
+ idiom = _AGE_IDIOMS.get(s.lower())
66
+ if idiom is not None:
67
+ return idiom
68
+ slots = ["", "", "", ""]
69
+ pos = 0
70
+ matched_any = False
71
+ for m in _AGE_TOKEN_RE.finditer(s):
72
+ # Reject if there's non-whitespace junk between tokens.
73
+ if s[pos:m.start()].strip():
74
+ return (s, "", "", "")
75
+ unit = m.group(2).lower().rstrip(".")
76
+ slot = _AGE_UNIT_TO_SLOT.get(unit)
77
+ if slot is None:
78
+ return (s, "", "", "")
79
+ if slots[slot]:
80
+ return (s, "", "", "")
81
+ slots[slot] = m.group(1)
82
+ pos = m.end()
83
+ matched_any = True
84
+ if not matched_any or s[pos:].strip():
85
+ return (s, "", "", "")
86
+ return tuple(slots)
87
+
88
+
89
+ # --------------------------------------------------------------------------- #
90
+ # Whole years #
91
+ # --------------------------------------------------------------------------- #
92
+
93
+ #: The record calls and keywords whose age the DSL writes as an integer when it
94
+ #: is a whole number of years (AGE001, `verso.ru.linters.checks.ages`). An edit
95
+ #: of the page writes such an age by the same rule (`verso.ru.dsl.paths`).
96
+ AGE_CALLS = ("death", "marriage", "criminal_record", "wwi_record", "wwii_record")
97
+ AGE_KWARGS = ("age", "groom_age", "bride_age")
98
+
99
+ _YEAR_UNITS = frozenset(u for u, slot in _AGE_UNIT_TO_SLOT.items() if slot == 0)
100
+ _BARE_DIGITS_RE = re.compile(r'^\s*(\d+)\s*$')
101
+ _ONE_TOKEN_RE = re.compile(r'^\s*(\d+)\s*([а-яё]+)\.?\s*$', re.IGNORECASE)
102
+
103
+
104
+ def whole_years(s: str) -> str | None:
105
+ """The digits of `s` when it spells a WHOLE number of years, else None.
106
+
107
+ Matches a bare number ("70") and a single <number><year-unit> token
108
+ ("1 год", "5 лет", "1 г"). Idioms carry a months component the integer
109
+ cannot express, so they are excluded up front; compound and sub-year ages
110
+ never match the single-token shape. `split_age` reads the integer and the
111
+ string alike, so writing the integer moves no output.
112
+ """
113
+ if s.strip().lower() in _AGE_IDIOMS:
114
+ return None
115
+ m = _BARE_DIGITS_RE.match(s)
116
+ if m:
117
+ return m.group(1)
118
+ m = _ONE_TOKEN_RE.match(s)
119
+ if m and m.group(2).lower().rstrip(".") in _YEAR_UNITS:
120
+ return m.group(1)
121
+ return None
122
+
123
+
124
+ # --------------------------------------------------------------------------- #
125
+ # Prose rendering #
126
+ # --------------------------------------------------------------------------- #
127
+
128
+ # Values that mean "age not recorded". Callers already guard on these before
129
+ # emitting a `Возраст:` line; `format_age` returns None so they can keep doing so.
130
+ _AGE_ABSENT = (None, "", "?", "-")
131
+
132
+
133
+ def age_recorded(age) -> bool:
134
+ """Whether a DSL age states a figure at all.
135
+
136
+ `None`, `""`, `"?"` and `"-"` are the transcriber's «не записано». This is
137
+ NOT `format_age(age) is not None`, though the two agree almost everywhere:
138
+ `format_age` also returns None for a figure it has no words for — 0.02 of a
139
+ year, a week-old infant — and a reader asking «did the book give an age?»
140
+ must not lose those.
141
+ """
142
+ if isinstance(age, bool): # bool is an int subclass — never an age
143
+ return False
144
+ if isinstance(age, str):
145
+ age = age.strip()
146
+ return age not in _AGE_ABSENT
147
+
148
+ # A bare decimal age string, e.g. "2.5" / "34,5" (mirrors census_age._BARE_NUMBER_RE).
149
+ _DECIMAL_AGE_RE = re.compile(r'^(\d+[.,]\d+)$')
150
+
151
+ # (one, few, many) per slot, in split_age order.
152
+ _SLOT_FORMS = (
153
+ ("год", "года", "лет"),
154
+ ("месяц", "месяца", "месяцев"),
155
+ ("неделя", "недели", "недель"),
156
+ ("день", "дня", "дней"),
157
+ )
158
+
159
+
160
+ def agree(n, one, few, many):
161
+ """Pick the Russian form agreeing with `n`: 1 год / 3 года / 5 лет.
162
+
163
+ 11–14 take the `many` form despite ending in 1–4 («11 лет», «12 лет»).
164
+ """
165
+ n = abs(int(n))
166
+ if n % 100 in (11, 12, 13, 14):
167
+ return many
168
+ last = n % 10
169
+ if last == 1:
170
+ return one
171
+ if last in (2, 3, 4):
172
+ return few
173
+ return many
174
+
175
+
176
+ def _render_slots(slots):
177
+ """Join non-empty split_age slots into agreeing prose, or None if all empty."""
178
+ parts = []
179
+ for value, (one, few, many) in zip(slots, _SLOT_FORMS, strict=True):
180
+ if not value:
181
+ continue
182
+ try:
183
+ n = int(value)
184
+ except (TypeError, ValueError):
185
+ # Non-numeric in a slot means split_age fell back to dumping the
186
+ # whole unparseable string into Лет — hand it back verbatim.
187
+ return str(value)
188
+ parts.append(f"{n} {agree(n, one, few, many)}")
189
+ return " ".join(parts) if parts else None
190
+
191
+
192
+ def _split_fractional_years(value):
193
+ """(years, months) for a fractional year count, carrying 12 months up.
194
+
195
+ Census revisions record half-years as `56.5`, which reads as data rather
196
+ than prose; this turns the fraction into whole months.
197
+ """
198
+ years = int(value)
199
+ months = round((float(value) - years) * 12)
200
+ if months >= 12:
201
+ years += 1
202
+ months = 0
203
+ return years, months
204
+
205
+
206
+ def format_age(age):
207
+ """Render a DSL age as reader-facing Russian prose, or None if absent.
208
+
209
+ 45 → «45 лет»; 1 → «1 год»; 3 → «3 года»; 0.5 → «полгода»;
210
+ 1.5 → «1 год 6 месяцев»; "6 мес" → «6 месяцев»; "3 нед" → «3 недели»;
211
+ "19 лет 6 мес" → «19 лет 6 месяцев».
212
+
213
+ An idiom is returned verbatim — it is already prose, and re-deriving it
214
+ from the parsed slots would silently rewrite `age="6 мес"` as «полгода».
215
+ An age the tokenizer cannot parse (the source-literal «году», «с годом»
216
+ of the 1719 revisions) is likewise passed through untouched: it is a
217
+ faithful transcription, not a formatting error.
218
+ """
219
+ if age in _AGE_ABSENT:
220
+ return None
221
+ if isinstance(age, bool): # bool is an int subclass — never an age
222
+ return None
223
+
224
+ if isinstance(age, str):
225
+ s = age.strip()
226
+ if not s:
227
+ return None
228
+ if s.lower() in _AGE_IDIOMS:
229
+ return s
230
+ # Census revisions write half-years as a bare decimal — "2.5", and in
231
+ # the Маниловка 1858 list "34,5". split_age has no token for it and would
232
+ # hand the string back verbatim, so convert to the float path here.
233
+ m = _DECIMAL_AGE_RE.match(s)
234
+ if m:
235
+ age = float(m.group(1).replace(",", "."))
236
+ if isinstance(age, float):
237
+ if age.is_integer():
238
+ # split_age would stringify 45.0 as "45.0", which no slot can parse
239
+ # and which would then fall through to the verbatim path.
240
+ age = int(age)
241
+ else:
242
+ years, months = _split_fractional_years(age)
243
+ if years == 0 and months == 6:
244
+ return "полгода"
245
+ slots = (str(years) if years else "",
246
+ str(months) if months else "", "", "")
247
+ return _render_slots(slots)
248
+
249
+ return _render_slots(split_age(age))
250
+
251
+
252
+ # Calendar-free conversions. The sources give ages in whole units a clerk
253
+ # rounded by hand, so a day-exact calendar would add precision the input never
254
+ # had; these are good to a couple of days over a human lifetime.
255
+ DAYS_PER_YEAR = 365.25
256
+ DAYS_PER_MONTH = 30.44
257
+ DAYS_PER_WEEK = 7.0
258
+
259
+
260
+ def age_bounds(age) -> tuple[float, float] | None:
261
+ """Stated age → the DAY INTERVAL it actually asserts, or None if unstated.
262
+
263
+ **A stated age is a floor, not a measurement.** A clerk writing «1 годъ»
264
+ means "has completed one year", so the child is anywhere in [1, 2) years —
265
+ an interval a whole year wide. Comparing the midpoint, or the floor, against
266
+ an elapsed time turns every ordinary truncation into a finding: on Горюхино
267
+ that alone produced a hundred and thirty of them, all of them correct
268
+ records. The interval is what the source claims, so the interval is what
269
+ gets compared.
270
+
271
+ Width comes from the SMALLEST unit written: «1 г 9 мес» is precise to the
272
+ month, «6 нед» to the week, a bare «1» only to the year. A fractional value
273
+ («5½ мѣс», «2¼») is a clerk being deliberate, and is treated as exact.
274
+
275
+ Parsing is delegated to `split_age`, the same tabular parser the CSV
276
+ exporters use, so a change to age syntax cannot make this check and the
277
+ exported columns disagree. Verbatim idioms the tokenizer passes through
278
+ («полгода», «с годом») yield no numbers and are skipped rather than guessed.
279
+ """
280
+ if age is None or str(age).strip() in ("", "?", "-"):
281
+ return None
282
+ parts = zip(split_age(age), (DAYS_PER_YEAR, DAYS_PER_MONTH, DAYS_PER_WEEK, 1.0),
283
+ strict=True)
284
+ total = 0.0
285
+ granularity = 0.0
286
+ seen = False
287
+ for value, factor in parts:
288
+ if not value:
289
+ continue
290
+ try:
291
+ number = float(str(value).replace(",", "."))
292
+ except ValueError:
293
+ return None
294
+ total += number * factor
295
+ # The last (smallest) unit written sets the width; a fraction in it
296
+ # means the clerk was not truncating.
297
+ granularity = 0.0 if number != int(number) else factor
298
+ seen = True
299
+ return (total, total + granularity) if seen else None
@@ -0,0 +1 @@
1
+ """Clients for external archive systems (reading rooms, catalogs)."""