process-sanskrit 1.0.3__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.
- process_sanskrit-1.0.3/LICENSE.md +157 -0
- process_sanskrit-1.0.3/MANIFEST.in +21 -0
- process_sanskrit-1.0.3/PKG-INFO +261 -0
- process_sanskrit-1.0.3/README.md +236 -0
- process_sanskrit-1.0.3/process_sanskrit/__init__.py +56 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/SQLiteFind.py +252 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/__init__.py +8 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/cleanResults.py +173 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/compoundAnalysis.py +402 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/dictionaryLookup.py +195 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/hybridSplitter.py +92 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/inflect.py +87 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/model_inference.py +145 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/process.py +260 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/processBYT5.py +104 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/rootAnyWord.py +214 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/sandhiSplitScorer.py +119 -0
- process_sanskrit-1.0.3/process_sanskrit/functions/sandhiSplitter.py +110 -0
- process_sanskrit-1.0.3/process_sanskrit/resources/MWKeysOnly.json +1 -0
- process_sanskrit-1.0.3/process_sanskrit/resources/__init__.py +2 -0
- process_sanskrit-1.0.3/process_sanskrit/resources/dictionary_references.json +807933 -0
- process_sanskrit-1.0.3/process_sanskrit/resources/stopwords.csv +969 -0
- process_sanskrit-1.0.3/process_sanskrit/resources/type_map.tsv +301 -0
- process_sanskrit-1.0.3/process_sanskrit/setup/updateDB.py +127 -0
- process_sanskrit-1.0.3/process_sanskrit/utils/__init__.py +4 -0
- process_sanskrit-1.0.3/process_sanskrit/utils/databaseSetup.py +319 -0
- process_sanskrit-1.0.3/process_sanskrit/utils/detectTransliteration.py +119 -0
- process_sanskrit-1.0.3/process_sanskrit/utils/dictionary_references.py +246983 -0
- process_sanskrit-1.0.3/process_sanskrit/utils/lexicalResources.py +258 -0
- process_sanskrit-1.0.3/process_sanskrit/utils/loadResources.py +38 -0
- process_sanskrit-1.0.3/process_sanskrit/utils/processAPI.py +146 -0
- process_sanskrit-1.0.3/process_sanskrit/utils/stopwordsRemoval.py +47 -0
- process_sanskrit-1.0.3/process_sanskrit/utils/transliterationUtils.py +50 -0
- process_sanskrit-1.0.3/process_sanskrit.egg-info/PKG-INFO +261 -0
- process_sanskrit-1.0.3/process_sanskrit.egg-info/SOURCES.txt +59 -0
- process_sanskrit-1.0.3/process_sanskrit.egg-info/dependency_links.txt +1 -0
- process_sanskrit-1.0.3/process_sanskrit.egg-info/entry_points.txt +2 -0
- process_sanskrit-1.0.3/process_sanskrit.egg-info/requires.txt +16 -0
- process_sanskrit-1.0.3/process_sanskrit.egg-info/top_level.txt +1 -0
- process_sanskrit-1.0.3/pyproject.toml +46 -0
- process_sanskrit-1.0.3/setup.cfg +4 -0
- process_sanskrit-1.0.3/setup.py +3 -0
- process_sanskrit-1.0.3/tests/BYT5test.py +150 -0
- process_sanskrit-1.0.3/tests/Removable/benchmarkTesting.py +423 -0
- process_sanskrit-1.0.3/tests/Removable/dbTest.py +45 -0
- process_sanskrit-1.0.3/tests/__init__.py +0 -0
- process_sanskrit-1.0.3/tests/datasets/sanskrit_compounds_benchmark.json +1630 -0
- process_sanskrit-1.0.3/tests/datasets/sanskrit_compounds_benchmark2.json +1225 -0
- process_sanskrit-1.0.3/tests/datasets/testCases.py +124 -0
- process_sanskrit-1.0.3/tests/datasets/yogaSutra.py +199 -0
- process_sanskrit-1.0.3/tests/gretilTesting.py +133 -0
- process_sanskrit-1.0.3/tests/processCompounds.py +71 -0
- process_sanskrit-1.0.3/tests/results/compound_processing_results copy.txt +1809 -0
- process_sanskrit-1.0.3/tests/results/compound_processing_results.txt +9363 -0
- process_sanskrit-1.0.3/tests/results/compound_processing_resultsGrouped.txt +115 -0
- process_sanskrit-1.0.3/tests/results/sanskrit_benchmark_results.txt +159 -0
- process_sanskrit-1.0.3/tests/results/standard_benchmark_results.txt +159 -0
- process_sanskrit-1.0.3/tests/results/yoga_sutra_analysis.txt +6651 -0
- process_sanskrit-1.0.3/tests/results/~$mpound_processing_results.txt +0 -0
- process_sanskrit-1.0.3/tests/runBenchmarks.py +340 -0
- process_sanskrit-1.0.3/tests/ysTest.py +305 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Attribution-NonCommercial-NoDerivatives 4.0 International
|
|
2
|
+
|
|
3
|
+
> *Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.*
|
|
4
|
+
>
|
|
5
|
+
> ### Using Creative Commons Public Licenses
|
|
6
|
+
>
|
|
7
|
+
> Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
|
|
8
|
+
>
|
|
9
|
+
> * __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
|
|
10
|
+
>
|
|
11
|
+
> * __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
|
|
12
|
+
|
|
13
|
+
## Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License
|
|
14
|
+
|
|
15
|
+
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
|
16
|
+
|
|
17
|
+
### Section 1 – Definitions.
|
|
18
|
+
|
|
19
|
+
a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
|
20
|
+
|
|
21
|
+
b. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
|
22
|
+
|
|
23
|
+
e. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
|
24
|
+
|
|
25
|
+
f. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
|
26
|
+
|
|
27
|
+
h. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
|
28
|
+
|
|
29
|
+
i. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
|
30
|
+
|
|
31
|
+
h. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
|
|
32
|
+
|
|
33
|
+
i. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
|
|
34
|
+
|
|
35
|
+
j. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
|
36
|
+
|
|
37
|
+
k. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
|
38
|
+
|
|
39
|
+
l. __You__ means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
|
|
40
|
+
|
|
41
|
+
### Section 2 – Scope.
|
|
42
|
+
|
|
43
|
+
a. ___License grant.___
|
|
44
|
+
|
|
45
|
+
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
|
46
|
+
|
|
47
|
+
A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
|
|
48
|
+
|
|
49
|
+
B. produce and reproduce, but not Share, Adapted Material for NonCommercial purposes only.
|
|
50
|
+
|
|
51
|
+
2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
|
52
|
+
|
|
53
|
+
3. __Term.__ The term of this Public License is specified in Section 6(a).
|
|
54
|
+
|
|
55
|
+
4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
|
56
|
+
|
|
57
|
+
5. __Downstream recipients.__
|
|
58
|
+
|
|
59
|
+
A. __Offer from the Licensor – Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
|
60
|
+
|
|
61
|
+
B. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
|
62
|
+
|
|
63
|
+
6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
|
64
|
+
|
|
65
|
+
b. ___Other rights.___
|
|
66
|
+
|
|
67
|
+
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
|
68
|
+
|
|
69
|
+
2. Patent and trademark rights are not licensed under this Public License.
|
|
70
|
+
|
|
71
|
+
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
|
|
72
|
+
|
|
73
|
+
### Section 3 – License Conditions.
|
|
74
|
+
|
|
75
|
+
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
|
76
|
+
|
|
77
|
+
a. ___Attribution.___
|
|
78
|
+
|
|
79
|
+
1. If You Share the Licensed Material, You must:
|
|
80
|
+
|
|
81
|
+
A. retain the following if it is supplied by the Licensor with the Licensed Material:
|
|
82
|
+
|
|
83
|
+
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
|
|
84
|
+
|
|
85
|
+
ii. a copyright notice;
|
|
86
|
+
|
|
87
|
+
iii. a notice that refers to this Public License;
|
|
88
|
+
|
|
89
|
+
iv. a notice that refers to the disclaimer of warranties;
|
|
90
|
+
|
|
91
|
+
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
|
92
|
+
|
|
93
|
+
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
|
|
94
|
+
|
|
95
|
+
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
|
|
96
|
+
|
|
97
|
+
For the avoidance of doubt, You do not have permission under this Public License to Share Adapted Material.
|
|
98
|
+
|
|
99
|
+
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
|
|
100
|
+
|
|
101
|
+
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
|
|
102
|
+
|
|
103
|
+
### Section 4 – Sui Generis Database Rights.
|
|
104
|
+
|
|
105
|
+
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
|
106
|
+
|
|
107
|
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only and provided You do not Share Adapted Material;
|
|
108
|
+
|
|
109
|
+
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
|
|
110
|
+
|
|
111
|
+
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
|
112
|
+
|
|
113
|
+
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
|
114
|
+
|
|
115
|
+
### Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
|
116
|
+
|
|
117
|
+
a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
|
|
118
|
+
|
|
119
|
+
b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__
|
|
120
|
+
|
|
121
|
+
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
|
122
|
+
|
|
123
|
+
### Section 6 – Term and Termination.
|
|
124
|
+
|
|
125
|
+
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
|
126
|
+
|
|
127
|
+
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
|
128
|
+
|
|
129
|
+
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
|
|
130
|
+
|
|
131
|
+
2. upon express reinstatement by the Licensor.
|
|
132
|
+
|
|
133
|
+
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
|
|
134
|
+
|
|
135
|
+
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
|
136
|
+
|
|
137
|
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
|
138
|
+
|
|
139
|
+
### Section 7 – Other Terms and Conditions.
|
|
140
|
+
|
|
141
|
+
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
|
142
|
+
|
|
143
|
+
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
|
144
|
+
|
|
145
|
+
### Section 8 – Interpretation.
|
|
146
|
+
|
|
147
|
+
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
|
148
|
+
|
|
149
|
+
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
|
150
|
+
|
|
151
|
+
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
|
152
|
+
|
|
153
|
+
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
|
154
|
+
|
|
155
|
+
> Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
|
|
156
|
+
>
|
|
157
|
+
> Creative Commons may be contacted at [creativecommons.org](http://creativecommons.org).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
include LICENSE.md
|
|
2
|
+
include README.md
|
|
3
|
+
include pyproject.toml
|
|
4
|
+
global-exclude *.sqlite *.sqlite.gz
|
|
5
|
+
|
|
6
|
+
recursive-include process_sanskrit/resources *.json
|
|
7
|
+
recursive-include process_sanskrit/resources *.csv
|
|
8
|
+
recursive-include process_sanskrit/resources *.tsv
|
|
9
|
+
recursive-include process_sanskrit/resources *.xlsx
|
|
10
|
+
|
|
11
|
+
# Include tests for the sdist
|
|
12
|
+
recursive-include tests *.py
|
|
13
|
+
recursive-include tests *.json
|
|
14
|
+
recursive-include tests *.txt
|
|
15
|
+
|
|
16
|
+
# Exclude compiled files and caches
|
|
17
|
+
global-exclude *.py[cod]
|
|
18
|
+
global-exclude __pycache__
|
|
19
|
+
global-exclude .git*
|
|
20
|
+
global-exclude .DS_Store
|
|
21
|
+
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: process-sanskrit
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: Process-Sanskrit is python library for automatic Sanskrit text annotation and inflected dictionary search
|
|
5
|
+
Author-email: Giacomo De Luca <giacomo.deluca@hotmail.it>
|
|
6
|
+
Project-URL: Repository, https://github.com/Giacomo-De-Luca/Process-Sanskrit
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE.md
|
|
10
|
+
Requires-Dist: requests>=2.20.0
|
|
11
|
+
Requires-Dist: sqlalchemy>=1.4.0
|
|
12
|
+
Requires-Dist: indic_transliteration>=2.0.0
|
|
13
|
+
Requires-Dist: regex>=2022.0.0
|
|
14
|
+
Requires-Dist: python-dotenv>=0.19.0
|
|
15
|
+
Requires-Dist: sanskrit-parser==0.2.6
|
|
16
|
+
Provides-Extra: gensim
|
|
17
|
+
Requires-Dist: gensim>=4.0.0; extra == "gensim"
|
|
18
|
+
Requires-Dist: sentencepiece>=0.1.95; extra == "gensim"
|
|
19
|
+
Provides-Extra: byt5
|
|
20
|
+
Requires-Dist: torch>=1.9.0; extra == "byt5"
|
|
21
|
+
Requires-Dist: transformers>=4.5.0; extra == "byt5"
|
|
22
|
+
Requires-Dist: numpy>=2.0.0; extra == "byt5"
|
|
23
|
+
Requires-Dist: scipy>=1.13.0; extra == "byt5"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# Process-Sanskrit
|
|
27
|
+
|
|
28
|
+
Process-Sanskrit is a *python* open-source library for automatic Sanskrit text annotation and inflected dictionary search.
|
|
29
|
+
|
|
30
|
+
The library has two main use cases:
|
|
31
|
+
|
|
32
|
+
1. **Dictionary search:** multi dictionary lookup with grammatical annotation for words exactly as they are written in texts: in **any transliteration format, inflected, compounded and with sandhi**.
|
|
33
|
+
2. **Automatic Text Annotation:** generate automatically version of Sanskrit texts without sandhi and with split compounds, with grammatical annotations and dictionary entries for each word.
|
|
34
|
+
|
|
35
|
+
The architecture of the library is based on a cascading approach to Sanskrit text analysis, as described in our NAACL 2025 paper: [*`Accessible Sanskrit: A Cascading System for Text Analysis and Dictionary Access.`*](https://aclanthology.org/2025.alp-1.5/)
|
|
36
|
+
|
|
37
|
+
The library is one of the main components powering up the [***Sanskrit Voyager*** backend](https://www.sanskritvoyager.com/). It is used for dictionary searches, stemming, and to pre-process texts for the corpus search.
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## Demo:
|
|
41
|
+
|
|
42
|
+
The library can be employed live on the [***Sanskrit Voyager*** website](https://www.sanskritvoyager.com/).
|
|
43
|
+
|
|
44
|
+
Select a book or paste some text, click on the words and see the library in action!
|
|
45
|
+
|
|
46
|
+
Or search some inflected and sandhi-ed words in the search bar to get the dictionary entries.
|
|
47
|
+
|
|
48
|
+
*The following is the Quickstart guide. For a more detailed documentation and advanced features refer to the [documentation website](sanskritvoyager.com/docs).*
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
To install the library use the standard *pip install* command, then call ***update-ps-database*** in the terminal to setup the database.
|
|
53
|
+
|
|
54
|
+
Use the optional dependency download to select the version with 'gensim' or the experimental version that uses the BYT5 model.
|
|
55
|
+
|
|
56
|
+
A virtual enviroment or docker is highly recommended to use gensim, as it downgrades *numpy*.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install process-sanskrit[gensim]
|
|
61
|
+
update-ps-database
|
|
62
|
+
|
|
63
|
+
or
|
|
64
|
+
pip install process-sanskrit[byt5]
|
|
65
|
+
update-ps-database
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
***`update-ps-database`*** downloads and setup the database with the dictionaries and the inflection tables (adjusted from [**CLS inflect**](https://github.com/sanskrit-lexicon/csl-inflect)
|
|
69
|
+
) in the resources folder (150 mb download, 583 mb uncompressed, released with [Creative Commons NC license](https://creativecommons.org/licenses/by-nc/4.0/)).
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
|
|
73
|
+
## if inside jupyter or colab use:
|
|
74
|
+
|
|
75
|
+
!pip install process-sanskrit[gensim]
|
|
76
|
+
!update-ps-database
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
For the experimental version with byt5:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
|
|
84
|
+
## if inside jupyter or colab use:
|
|
85
|
+
|
|
86
|
+
!pip install process-sanskrit[byt5]
|
|
87
|
+
!update-ps-database
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
*only **transliterate** works without the database!*
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## Process Function:
|
|
95
|
+
|
|
96
|
+
The core of the library is the **process** function, that accepts text in Sanskrit as input and executes an entire text processing pipeline for the text.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
import process-sanskrit as ps
|
|
100
|
+
|
|
101
|
+
ps.process("pratiprasave")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Process returns a list that contains for each word contained in the text or compounds:
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
1. **Word stem**: ‘pratiprasava’
|
|
108
|
+
2. **Grammatical tagging**: masculine noun/adjective ending in a
|
|
109
|
+
3. **Case** (for nouns) **or Inflection** (for verbs): [('Loc', 'Sg')]
|
|
110
|
+
4. **Inflection table** for the word as a list: ['pratiprasavaḥ', 'pratiprasavau', 'pratiprasavāḥ', 'pratiprasavam', 'pratiprasavau', 'pratiprasavān', 'pratiprasavena', 'pratiprasavābhyām', 'pratiprasavaiḥ', 'pratiprasavāya', 'pratiprasavābhyām', 'pratiprasavebhyaḥ', 'pratiprasavāt', 'pratiprasavābhyām', 'pratiprasavebhyaḥ', 'pratiprasavasya', 'pratiprasavayoḥ', 'pratiprasavānām', 'pratiprasave', 'pratiprasavayoḥ', 'pratiprasaveṣu', 'pratiprasava', 'pratiprasavau', 'pratiprasavāḥ']
|
|
111
|
+
5. **Original word**: 'pratiprasave’
|
|
112
|
+
6. **Word Components** according to the Monnier Williams: (in this case none) 'prati—prasava’
|
|
113
|
+
7. **Dictionary entries** in XML format. In the form of a dictionary for all the selected dictionaries: {'mw': {'pratiprasava': ['<s>prati—prasava</s> <hom>a</hom> See under <s>prati-pra-</s> √ <hom>1.</hom> <s>sū</s>.', '<s>prati-°prasava</s> <hom>b</hom> <lex>m.</lex> counter-order, suspension of a general prohibition in a particular case, <ls>Śaṃkarācārya </ls>; <ls>Kātyāyana-śrauta-sūtra </ls>, <ab>Scholiast or Commentator</ab>; <ls>Manvarthamuktāvalī, KullūkaBhaṭṭa\'s commentary on Manu-smṛti </ls><info lex="m"/>', ' an exception to an exception, <ls>Taittirīya-prātiśākhya </ls>, <ab>Scholiast or Commentator</ab><info lex="inh"/>', ' return to the original state, <ls>Yoga-sūtra </ls><info lex="inh"/>']}
|
|
114
|
+
|
|
115
|
+
*Process automatically `detects transliteration scheme` and `transliterate to IAST`. If that is problematic, pre-transliterate to IAST first using the **transliterate** function.*
|
|
116
|
+
|
|
117
|
+
*Also, ***the base version of Process is optimised for single words***, - if you have a sentence or book, split by spaces and pass each term to transliterate.*
|
|
118
|
+
|
|
119
|
+
*In the online interface it is possible to retrive the entries for the components (in this case **'prati'** and **'prasava'**) by clicking on them. Clicking automatically sends to the dictionary entry of the components.*
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Dictionary Selection:
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
The process function returns dictionary entries for the found roots.
|
|
126
|
+
|
|
127
|
+
**By default, only the Monnier Williams dictionary is selected.**
|
|
128
|
+
|
|
129
|
+
In the following example we search for a word that is not in the MW: 'dvandva'. The process function automatically check if any of the dictionaries has it and automatically select it. In this case the word is found in the Macdonnell dictionary.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
|
|
134
|
+
import process_sanskrit as ps
|
|
135
|
+
print(ps.process('dvandva'))
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**To use more dictionaries**, process accepts as optional *`arguments`* the dictionary abbreviation. In the following code example we retrieve the entries for the word *'saṃskāra'* from the *Apte, Cappeller, Grassman, and Edgerton* dictionaries.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
|
|
144
|
+
import process_sanskrit as ps
|
|
145
|
+
|
|
146
|
+
print(ps.process('saṃskāra', 'ap90', 'cae', 'gra', 'bhs'))
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### Available Dictionaries and Abbreviations
|
|
151
|
+
|
|
152
|
+
Here is the list of all the currently available dictionaries with the abbreviations:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
- 'mw': 'Monier-Williams Sanskrit-English Dictionary' ,
|
|
156
|
+
- 'ap90': 'Apte Practical Sanskrit-English Dictionary'
|
|
157
|
+
- ‘cae': 'Cappeller Sanskrit-English Dictionary'
|
|
158
|
+
- 'ddsa': 'Macdonell A Practical Sanskrit Dictionary'
|
|
159
|
+
- 'gra': 'Grassmann Wörterbuch zum Rig Veda'
|
|
160
|
+
- 'bhs': 'Edgerton Buddhist Hybrid Sanskrit Dictionary'
|
|
161
|
+
- 'cped': 'Concise Pali English Dictionary'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
All the dictionaries are slightly modified version of the *Cologne Digital Sanskrit Dictionaries*, apart from the [The Concise Pali-English Dictionary By Buddhadatta Mahathera](https://buddhistuniversity.net/content/reference/concise-pali-dictionary). The Pali dictionary was added in to handle words that appears in the late Buddhist authors.
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
Cologne Digital Sanskrit Dictionaries, version 2.7.286,
|
|
168
|
+
Cologne University, accessed on February 19, 2025,
|
|
169
|
+
https://www.sanskrit-lexicon.uni-koeln.de
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Stemming:
|
|
173
|
+
|
|
174
|
+
The process function can be used just for simple sandhi/compound split and stemming, adding the optional flag: *mode=’roots’*.
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
import process_sanskrit as ps
|
|
178
|
+
|
|
179
|
+
print(ps.process('yamaniyamāsanaprāṇāyāmapratyāhāradhāraṇādhyānasamādhayo', mode='roots'))
|
|
180
|
+
|
|
181
|
+
## output:
|
|
182
|
+
## ['yama', 'niyama', 'asana', 'prāṇāyāma', 'pratyāhāra', 'dhāraṇa', 'dhyāna', 'samādhi']
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
*In case of ambiguity the process function does not select between the two (or three) possibilities, but returns all of them.*
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
### Transliteration:
|
|
191
|
+
|
|
192
|
+
The library offers a function to transliterate texts with auto-detection for the transliteration input format. This function is a slight adaptation from [*Indic-Transliteration Detect*](https://github.com/indic-transliteration/detect.py).
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
import process_sanskrit as ps
|
|
196
|
+
|
|
197
|
+
# Transliteration
|
|
198
|
+
print(ps.transliterate("patañjali", "DEVANAGARI")) ## IAST
|
|
199
|
+
print(ps.transliterate("pataJjali", "DEVANAGARI")) ## HK format
|
|
200
|
+
|
|
201
|
+
## same output:
|
|
202
|
+
## पतञ्जलि
|
|
203
|
+
|
|
204
|
+
## In case you need to manually select the input scheme,
|
|
205
|
+
## force it using the optional 'input_scheme' flag
|
|
206
|
+
## the scheme it's not case sensitive (slp1=SLP1):
|
|
207
|
+
|
|
208
|
+
print(ps.transliterate('pataYjali', 'tamil', input_scheme='slp1'))
|
|
209
|
+
|
|
210
|
+
## output: பதஞ்ஜலி
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Dictionary Search:
|
|
214
|
+
|
|
215
|
+
The library provides the *dict_search* function to retrieve dictionary entries.
|
|
216
|
+
|
|
217
|
+
Pass to the dict_search a list of strings to be searched on and (optionally) a list of dictionary tags.
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
import process_sanskrit as ps
|
|
221
|
+
|
|
222
|
+
## unlike the process function, the dict_search wants the input in IAST format.
|
|
223
|
+
|
|
224
|
+
# example usage for Dictionary lookup
|
|
225
|
+
ps.dict_search(['pratiprasava', 'saṃskāra'])
|
|
226
|
+
|
|
227
|
+
# after a list of entries, optionally add dictionary tags to search in multiple dictionaries.
|
|
228
|
+
|
|
229
|
+
# search in Edgerton Buddhist Hybrid Sanskrit Dictionary
|
|
230
|
+
# and Grassmann Wörterbuch zum Rig Veda:
|
|
231
|
+
ps.dict_search(['pratiprasava', 'saṃskāra'], 'gra', 'bhs')
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
*The library automatically handles the fact that the Apte records nominatives instead of un-inflected stems (i.E. yogaḥ instead of yoga)*.
|
|
235
|
+
|
|
236
|
+
### ProcessBYT5
|
|
237
|
+
|
|
238
|
+
Experimental function -- preprocess the text with BYT5 then sends it to the process function after for stemming and grammatical results.
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
!pip install process-sanskrit[byt5]
|
|
242
|
+
!update-ps-database
|
|
243
|
+
|
|
244
|
+
from process_sanskrit.functions import processBYT5
|
|
245
|
+
ps.process(‘śrutam āgamavijñānaṃ tat sāmānyaviṣayam’)
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Sources:
|
|
249
|
+
|
|
250
|
+
**CLS inflect** for the inflection tables: [https://github.com/sanskrit-lexicon/csl-inflect](https://github.com/sanskrit-lexicon/csl-inflect)
|
|
251
|
+
|
|
252
|
+
The **Sanskrit Parser** library handles part of the Sandhi Splitting: [https://github.com/kmadathil/sanskrit_parser?tab=readme-ov-file](https://github.com/kmadathil/sanskrit_parser?tab=readme-ov-file)
|
|
253
|
+
|
|
254
|
+
The **BYT5 model** used in the experimental version of the process function is from the [https://huggingface.co/buddhist-nlp/byt5-sanskrit](https://huggingface.co/buddhist-nlp/byt5-sanskrit) discussed in the paper:
|
|
255
|
+
|
|
256
|
+
**One Model is All You Need: ByT5-Sanskrit, a Unified Model for Sanskrit NLP Tasks**
|
|
257
|
+
|
|
258
|
+
[Sebastian Nehrdich](https://arxiv.org/search/cs?searchtype=author&query=Nehrdich,+S), [Oliver Hellwig](https://arxiv.org/search/cs?searchtype=author&query=Hellwig,+O), [Kurt Keutzer](https://arxiv.org/search/cs?searchtype=author&query=Keutzer,+K)
|
|
259
|
+
|
|
260
|
+
[https://arxiv.org/abs/2409.13920](https://arxiv.org/abs/2409.13920)
|
|
261
|
+
|