skrutable 2.9.3__tar.gz → 2.10.1__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 (31) hide show
  1. {skrutable-2.9.3 → skrutable-2.10.1}/PKG-INFO +27 -3
  2. {skrutable-2.9.3 → skrutable-2.10.1}/README.md +10 -0
  3. skrutable-2.10.1/src/skrutable/__init__.py +1 -0
  4. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/manual.md +5 -1
  5. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/splitting.py +8 -2
  6. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/transliteration.py +20 -0
  7. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable.egg-info/PKG-INFO +27 -3
  8. skrutable-2.9.3/src/skrutable/__init__.py +0 -1
  9. {skrutable-2.9.3 → skrutable-2.10.1}/LICENSE.md +0 -0
  10. {skrutable-2.9.3 → skrutable-2.10.1}/setup.cfg +0 -0
  11. {skrutable-2.9.3 → skrutable-2.10.1}/setup.py +0 -0
  12. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/config.json +0 -0
  13. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/config.py +0 -0
  14. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/generate_scheme_vectors.py +0 -0
  15. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/impossible_bigrams.json +0 -0
  16. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/meter_identification.py +0 -0
  17. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/meter_patterns.py +0 -0
  18. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/phonemes.py +0 -0
  19. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/profiling_runner.py +0 -0
  20. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/run_examples.py +0 -0
  21. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/scansion.py +0 -0
  22. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/scheme_detection.py +0 -0
  23. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/scheme_maps.py +0 -0
  24. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/scheme_vectors.json +0 -0
  25. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/scheme_vectors_mbh.py +0 -0
  26. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/utils.py +0 -0
  27. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable/virAma_avoidance.py +0 -0
  28. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable.egg-info/SOURCES.txt +0 -0
  29. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable.egg-info/dependency_links.txt +0 -0
  30. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable.egg-info/requires.txt +0 -0
  31. {skrutable-2.9.3 → skrutable-2.10.1}/src/skrutable.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: skrutable
3
- Version: 2.9.3
3
+ Version: 2.10.1
4
4
  Summary: skrutable library for working with Sanskrit text
5
5
  Home-page: https://github.com/tylergneill/skrutable
6
6
  Author: Tyler Neill
@@ -8,8 +8,22 @@ Author-email: tyler.g.neill@gmail.com
8
8
  License: CC BY-SA 4.0
9
9
  Keywords: Sanskrit text transliteration scansion meter identification sandhi compound splitting
10
10
  Description-Content-Type: text/markdown
11
- Provides-Extra: testing
12
11
  License-File: LICENSE.md
12
+ Requires-Dist: numpy
13
+ Requires-Dist: requests
14
+ Provides-Extra: testing
15
+ Requires-Dist: pytest; extra == "testing"
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: keywords
22
+ Dynamic: license
23
+ Dynamic: license-file
24
+ Dynamic: provides-extra
25
+ Dynamic: requires-dist
26
+ Dynamic: summary
13
27
 
14
28
  # skrutable
15
29
 
@@ -28,9 +42,19 @@ pip install -e .
28
42
  ```
29
43
 
30
44
  This ensures tests and scripts use the local source instead of any installed version.
45
+ Run the tests with `make test-python`.
31
46
 
32
47
  See [manual.md](https://github.com/tylergneill/skrutable/blob/main/src/skrutable/manual.md) for instructions.
33
48
 
49
+ A JavaScript port of the library ([npm](https://www.npmjs.com/package/skrutable-js) package `skrutable-js`)
50
+ also lives here, in [js/](https://github.com/tylergneill/skrutable/tree/main/js). It follows the Python library
51
+ and may lag behind its latest release.
52
+ `make test` runs both test suites.
53
+
54
+ A browser extension for Chrome and Firefox, built on the JavaScript port, offers the same tools
55
+ (transliteration, scansion, meter identification and splitting) in a side panel on any web page, from the toolbar icon or by right-clicking selected text.
56
+ It lives with the web app in [skrutable_front_end](https://github.com/tylergneill/skrutable_front_end).
57
+
34
58
  Feedback welcome!
35
59
  My name is Tyler
36
60
  ([Academia](https://uni-leipzig1.academia.edu/TylerNeill),
@@ -15,9 +15,19 @@ pip install -e .
15
15
  ```
16
16
 
17
17
  This ensures tests and scripts use the local source instead of any installed version.
18
+ Run the tests with `make test-python`.
18
19
 
19
20
  See [manual.md](https://github.com/tylergneill/skrutable/blob/main/src/skrutable/manual.md) for instructions.
20
21
 
22
+ A JavaScript port of the library ([npm](https://www.npmjs.com/package/skrutable-js) package `skrutable-js`)
23
+ also lives here, in [js/](https://github.com/tylergneill/skrutable/tree/main/js). It follows the Python library
24
+ and may lag behind its latest release.
25
+ `make test` runs both test suites.
26
+
27
+ A browser extension for Chrome and Firefox, built on the JavaScript port, offers the same tools
28
+ (transliteration, scansion, meter identification and splitting) in a side panel on any web page, from the toolbar icon or by right-clicking selected text.
29
+ It lives with the web app in [skrutable_front_end](https://github.com/tylergneill/skrutable_front_end).
30
+
21
31
  Feedback welcome!
22
32
  My name is Tyler
23
33
  ([Academia](https://uni-leipzig1.academia.edu/TylerNeill),
@@ -0,0 +1 @@
1
+ __version__ = "2.10.1"
@@ -13,7 +13,11 @@ The online web app at [skrutable.info](https://www.skrutable.info/) provides eas
13
13
 
14
14
  See [skrutable.info/help](https://www.skrutable.info/help) for more instructions.
15
15
 
16
- For Python programmers, `skrutable` is also importable as a library. Just `pip install skrutable` and see [below](#using-the-code).
16
+ For Python programmers, `skrutable` is also importable as a library. Just `pip install skrutable` and see [below](#python-library).
17
+
18
+ There is also a JavaScript port of the library (npm package `skrutable-js`), which follows the Python library and may lag behind its latest release. See [js/README.md](https://github.com/tylergneill/skrutable/blob/main/js/README.md).
19
+
20
+ A browser extension for Chrome and Firefox, built on the JavaScript port, offers the same tools (transliteration, scansion, meter identification and splitting) in a side panel on any web page, from the toolbar icon or by right-clicking selected text. It lives with the web app in [skrutable_front_end](https://github.com/tylergneill/skrutable_front_end).
17
21
 
18
22
  Programmers in any language can also query API endpoints. See [below](#using-the-api).
19
23
 
@@ -234,6 +234,7 @@ class Splitter(object):
234
234
  splitter_model: str='dharmamitra_2024_sept',
235
235
  preserve_compound_hyphens: bool = PRESERVE_COMPOUND_HYPHENS_DEFAULT,
236
236
  preserve_punctuation: bool=PRESERVE_PUNCTUATION_DEFAULT,
237
+ preserve_dandas: bool = False,
237
238
  ) -> str:
238
239
  """
239
240
  Splits sandhi and compounds of multi-line Sanskrit string,
@@ -243,12 +244,17 @@ class Splitter(object):
243
244
  from_scheme: input transliteration scheme (None = auto-detect).
244
245
  to_scheme: output transliteration scheme (None = IAST, the hub scheme).
245
246
  Processing always happens in IAST; transliteration wraps the call if needed.
247
+ preserve_dandas: passed to the output transliteration when to_scheme is set,
248
+ so roman output gets | and || unless True (Indic output keeps । and ॥).
249
+ Dandas are always kept through splitting itself,
250
+ so with to_scheme None the output keeps whatever dandas came in.
246
251
  """
247
252
 
248
253
  # transliterate input to IAST (auto-detects if from_scheme is None)
249
254
  # anunāsika flattened to anusvāra, which the splitter model expects
255
+ # dandas kept as is (handled as punctuation below)
250
256
  T = Transliterator()
251
- text = T.transliterate(text, from_scheme=from_scheme, to_scheme='IAST', preserve_anunasika=False)
257
+ text = T.transliterate(text, from_scheme=from_scheme, to_scheme='IAST', preserve_anunasika=False, preserve_dandas=True)
252
258
 
253
259
  # save original punctuation
254
260
  sentences: List[str]
@@ -297,6 +303,6 @@ class Splitter(object):
297
303
 
298
304
  # transliterate output from IAST if requested
299
305
  if to_scheme is not None and to_scheme.upper() != 'IAST':
300
- final_results = T.transliterate(final_results, from_scheme='IAST', to_scheme=to_scheme)
306
+ final_results = T.transliterate(final_results, from_scheme='IAST', to_scheme=to_scheme, preserve_dandas=preserve_dandas)
301
307
 
302
308
  return final_results
@@ -161,6 +161,17 @@ class Transliterator():
161
161
  if to_scheme == 'IASTREDUCED' or not preserve_anunasika:
162
162
  self.contents = self.contents.replace('~', 'M')
163
163
 
164
+ def normalize_dandas(self, to_scheme, preserve_dandas):
165
+ """
166
+ Internal method.
167
+
168
+ Converts Unicode dandas (। U+0964, ॥ U+0965) to | and ||
169
+ for non-Indic (roman) output schemes, unless preserve_dandas is True.
170
+ """
171
+ if to_scheme in scheme_maps.indic_schemes or preserve_dandas:
172
+ return
173
+ self.contents = self.contents.replace('\u0965', '||').replace('\u0964', '|')
174
+
164
175
  def transliterate(
165
176
  self,
166
177
  cntnts,
@@ -169,6 +180,7 @@ class Transliterator():
169
180
  avoid_virama_indic_scripts: bool = AVOID_VIRAMA_INDIC_SCRIPTS_DEFAULT,
170
181
  avoid_virama_non_indic_scripts: bool = AVOID_VIRAMA_NON_INDIC_SCRIPTS_DEFAULT,
171
182
  preserve_anunasika: bool = True,
183
+ preserve_dandas: bool = False,
172
184
  ):
173
185
  """
174
186
  User-facing method.
@@ -193,6 +205,11 @@ class Transliterator():
193
205
  and a sign given on the semivowel itself
194
206
  (devāl̃loke, devālm̐loke, strict SLP devAl~loke) is moved there.
195
207
 
208
+ Dandas: for non-Indic (roman) output, Unicode । and ॥
209
+ are converted to | and || by default,
210
+ or left as is if preserve_dandas is True.
211
+ Indic-script output always keeps them as is.
212
+
196
213
  Result returned via updated self.contents
197
214
  and also directly as string.
198
215
  """
@@ -236,4 +253,7 @@ class Transliterator():
236
253
  self.linear_preprocessing('SLP', self.scheme_out)
237
254
  self.map_replace('SLP', self.scheme_out)
238
255
 
256
+ # convert Unicode dandas to ASCII pipes for roman output unless preserving
257
+ self.normalize_dandas(self.scheme_out, preserve_dandas)
258
+
239
259
  return self.contents
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: skrutable
3
- Version: 2.9.3
3
+ Version: 2.10.1
4
4
  Summary: skrutable library for working with Sanskrit text
5
5
  Home-page: https://github.com/tylergneill/skrutable
6
6
  Author: Tyler Neill
@@ -8,8 +8,22 @@ Author-email: tyler.g.neill@gmail.com
8
8
  License: CC BY-SA 4.0
9
9
  Keywords: Sanskrit text transliteration scansion meter identification sandhi compound splitting
10
10
  Description-Content-Type: text/markdown
11
- Provides-Extra: testing
12
11
  License-File: LICENSE.md
12
+ Requires-Dist: numpy
13
+ Requires-Dist: requests
14
+ Provides-Extra: testing
15
+ Requires-Dist: pytest; extra == "testing"
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: keywords
22
+ Dynamic: license
23
+ Dynamic: license-file
24
+ Dynamic: provides-extra
25
+ Dynamic: requires-dist
26
+ Dynamic: summary
13
27
 
14
28
  # skrutable
15
29
 
@@ -28,9 +42,19 @@ pip install -e .
28
42
  ```
29
43
 
30
44
  This ensures tests and scripts use the local source instead of any installed version.
45
+ Run the tests with `make test-python`.
31
46
 
32
47
  See [manual.md](https://github.com/tylergneill/skrutable/blob/main/src/skrutable/manual.md) for instructions.
33
48
 
49
+ A JavaScript port of the library ([npm](https://www.npmjs.com/package/skrutable-js) package `skrutable-js`)
50
+ also lives here, in [js/](https://github.com/tylergneill/skrutable/tree/main/js). It follows the Python library
51
+ and may lag behind its latest release.
52
+ `make test` runs both test suites.
53
+
54
+ A browser extension for Chrome and Firefox, built on the JavaScript port, offers the same tools
55
+ (transliteration, scansion, meter identification and splitting) in a side panel on any web page, from the toolbar icon or by right-clicking selected text.
56
+ It lives with the web app in [skrutable_front_end](https://github.com/tylergneill/skrutable_front_end).
57
+
34
58
  Feedback welcome!
35
59
  My name is Tyler
36
60
  ([Academia](https://uni-leipzig1.academia.edu/TylerNeill),
@@ -1 +0,0 @@
1
- __version__ = "2.9.3"
File without changes
File without changes
File without changes