rajasthani 1.0.0__py3-none-any.whl
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.
- rajasthani/__init__.py +436 -0
- rajasthani/cli.py +166 -0
- rajasthani/constants.py +274 -0
- rajasthani/culture/__init__.py +90 -0
- rajasthani/culture/architecture.py +95 -0
- rajasthani/culture/attire.py +77 -0
- rajasthani/culture/cuisine.py +102 -0
- rajasthani/culture/data/bibliography.json +32 -0
- rajasthani/culture/data/folk_songs.json +47 -0
- rajasthani/culture/deities.py +103 -0
- rajasthani/culture/literature.py +78 -0
- rajasthani/culture/music.py +145 -0
- rajasthani/culture/ornaments.py +487 -0
- rajasthani/culture/places.py +93 -0
- rajasthani/culture/rituals.py +340 -0
- rajasthani/grammar/__init__.py +130 -0
- rajasthani/grammar/adjectives.py +53 -0
- rajasthani/grammar/adverbs.py +50 -0
- rajasthani/grammar/causatives.py +46 -0
- rajasthani/grammar/deliberative.py +31 -0
- rajasthani/grammar/honorifics.py +40 -0
- rajasthani/grammar/inceptive.py +19 -0
- rajasthani/grammar/negation.py +46 -0
- rajasthani/grammar/nouns.py +155 -0
- rajasthani/grammar/obligative.py +24 -0
- rajasthani/grammar/postpositions.py +58 -0
- rajasthani/grammar/presumptive.py +24 -0
- rajasthani/grammar/pronouns.py +202 -0
- rajasthani/grammar/syntax.py +1086 -0
- rajasthani/grammar/verbs.py +241 -0
- rajasthani/grammar/voice.py +54 -0
- rajasthani/kinship.py +701 -0
- rajasthani/lexicon/__init__.py +32 -0
- rajasthani/lexicon/data/idioms.json +474 -0
- rajasthani/lexicon/data/phrases.json +184 -0
- rajasthani/lexicon/data/proverbs.json +422 -0
- rajasthani/lexicon/data/riddles.json +252 -0
- rajasthani/lexicon/data/words.json +19615 -0
- rajasthani/lexicon/dictionary.py +245 -0
- rajasthani/lexicon/morphology.py +71 -0
- rajasthani/linguistics/__init__.py +28 -0
- rajasthani/linguistics/bis_tagger.py +77 -0
- rajasthani/linguistics/dialectology.py +71 -0
- rajasthani/linguistics/ergativity.py +31 -0
- rajasthani/linguistics/reduplication.py +63 -0
- rajasthani/numbers/__init__.py +26 -0
- rajasthani/numbers/converter.py +292 -0
- rajasthani/phonetics.py +281 -0
- rajasthani/translator/__init__.py +20 -0
- rajasthani/translator/engine.py +106 -0
- rajasthani/translator/llm_adapter.py +39 -0
- rajasthani/translator/pivot.py +109 -0
- rajasthani/translator/rule_based.py +323 -0
- rajasthani/voice/__init__.py +20 -0
- rajasthani/voice/engine.py +41 -0
- rajasthani/voice/synthesizer.py +73 -0
- rajasthani/web/__init__.py +6 -0
- rajasthani/web/app.py +202 -0
- rajasthani/web/static/app.js +220 -0
- rajasthani/web/static/index.html +276 -0
- rajasthani/web/static/style.css +408 -0
- rajasthani-1.0.0.dist-info/METADATA +163 -0
- rajasthani-1.0.0.dist-info/RECORD +67 -0
- rajasthani-1.0.0.dist-info/WHEEL +5 -0
- rajasthani-1.0.0.dist-info/entry_points.txt +2 -0
- rajasthani-1.0.0.dist-info/licenses/LICENSE +21 -0
- rajasthani-1.0.0.dist-info/top_level.txt +1 -0
rajasthani/__init__.py
ADDED
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Rajasthani (राजस्थानी) Language Standard Library for Python
|
|
4
|
+
==========================================================
|
|
5
|
+
|
|
6
|
+
A comprehensive, production-grade computational linguistics toolkit, NLP engine,
|
|
7
|
+
and cultural repository for the Rajasthani language (राजस्थानी भाषा).
|
|
8
|
+
|
|
9
|
+
Key Capabilities:
|
|
10
|
+
-----------------
|
|
11
|
+
1. Universal Translation Engine (World Languages -> Rajasthani)
|
|
12
|
+
2. Morphological Verb Conjugation & Syntax Engine (SOV, Split Ergativity)
|
|
13
|
+
3. Rich Lexicon, Proverbs (कहावतें), and Riddles (आडी / पहेलियाँ)
|
|
14
|
+
4. Comprehensive Kinship Resolution (नाता-गोता)
|
|
15
|
+
5. Numbers & Ordinals Converter (0 - 100,000,000+)
|
|
16
|
+
6. Cultural & Heritage Encyclopedia (Architecture, Music, Deities, Attire, Cuisine)
|
|
17
|
+
7. Phonetics & Bidirectional Romanization Engine
|
|
18
|
+
8. Interactive Web UI & Command Line Interface
|
|
19
|
+
|
|
20
|
+
Quick Start:
|
|
21
|
+
------------
|
|
22
|
+
>>> import rajasthani
|
|
23
|
+
>>> rajasthani.translate("How are you?")
|
|
24
|
+
<TranslationResult text='थें कियां हो सा?' romanized='then kiyan ho sa?' method='rule_based'>
|
|
25
|
+
>>> rajasthani.conjugate("खाणो", tense="past", gender="masculine")
|
|
26
|
+
'खायो'
|
|
27
|
+
>>> rajasthani.num_to_words(42)
|
|
28
|
+
'बयालीस'
|
|
29
|
+
>>> rajasthani.lookup("चोखो")
|
|
30
|
+
Word(rajasthani='चोखो', roman='chokho', english='good / fine / pleasant', hindi='अच्छा / बढ़िया', pos='adjective', category='descriptors')
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
__version__ = "1.0.0"
|
|
34
|
+
__author__ = "Akshat Singh Bisht"
|
|
35
|
+
__email__ = "infoakshatsinghbisht@gmail.com"
|
|
36
|
+
__maintainer__ = "Akshat Singh Bisht"
|
|
37
|
+
__website__ = "https://akshatsinghbisht.com/"
|
|
38
|
+
__license__ = "MIT"
|
|
39
|
+
__copyright__ = "Copyright (c) 2026 Akshat Singh Bisht"
|
|
40
|
+
|
|
41
|
+
# Constants & Enums
|
|
42
|
+
from rajasthani.constants import (
|
|
43
|
+
ISO_639_1,
|
|
44
|
+
ISO_639_2,
|
|
45
|
+
ISO_639_3,
|
|
46
|
+
ISO_639_NAME,
|
|
47
|
+
NATIVE_NAME,
|
|
48
|
+
DEVANAGARI_NAME,
|
|
49
|
+
HISTORICAL_SCRIPT,
|
|
50
|
+
Dialect,
|
|
51
|
+
Script,
|
|
52
|
+
PartOfSpeech,
|
|
53
|
+
Gender,
|
|
54
|
+
GrammaticalNumber,
|
|
55
|
+
Person,
|
|
56
|
+
Tense,
|
|
57
|
+
Case,
|
|
58
|
+
RAJASTHANI_MONTHS,
|
|
59
|
+
SEASONS,
|
|
60
|
+
DAYS_OF_WEEK,
|
|
61
|
+
GREETINGS,
|
|
62
|
+
POSTPOSITIONS_BY_DIALECT,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Phonetics & Script Conversion
|
|
66
|
+
from rajasthani.phonetics import (
|
|
67
|
+
normalize_devanagari,
|
|
68
|
+
detect_script,
|
|
69
|
+
devanagari_to_latin,
|
|
70
|
+
latin_to_devanagari,
|
|
71
|
+
tokenize,
|
|
72
|
+
syllables,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Numbers & Numerals
|
|
76
|
+
from rajasthani.numbers import (
|
|
77
|
+
num_to_words,
|
|
78
|
+
words_to_num,
|
|
79
|
+
to_devanagari_numerals,
|
|
80
|
+
from_devanagari_numerals,
|
|
81
|
+
ordinal,
|
|
82
|
+
fraction,
|
|
83
|
+
DEV_DIGITS,
|
|
84
|
+
RAJASTHANI_NUMBERS,
|
|
85
|
+
FRACTIONS,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# Grammar & Morphology
|
|
89
|
+
from rajasthani.grammar import (
|
|
90
|
+
pluralize,
|
|
91
|
+
to_oblique,
|
|
92
|
+
decline_noun,
|
|
93
|
+
to_feminine,
|
|
94
|
+
to_masculine,
|
|
95
|
+
make_diminutive,
|
|
96
|
+
PRONOUN_TABLE,
|
|
97
|
+
get_pronoun,
|
|
98
|
+
get_possessive,
|
|
99
|
+
get_interrogative,
|
|
100
|
+
get_relative,
|
|
101
|
+
extract_root,
|
|
102
|
+
conjugate,
|
|
103
|
+
conjugate_to_be,
|
|
104
|
+
imperative,
|
|
105
|
+
conjunctive_participle,
|
|
106
|
+
passive_verb,
|
|
107
|
+
make_causative,
|
|
108
|
+
attach_case,
|
|
109
|
+
get_marker,
|
|
110
|
+
POSTPOSITIONS,
|
|
111
|
+
SPATIAL_POSTPOSITIONS,
|
|
112
|
+
agree_adjective,
|
|
113
|
+
comparative,
|
|
114
|
+
superlative,
|
|
115
|
+
get_adverb,
|
|
116
|
+
ADVERBS_CATALOG,
|
|
117
|
+
add_honorific_sa,
|
|
118
|
+
honorific_greeting,
|
|
119
|
+
negate_sentence,
|
|
120
|
+
prohibitive,
|
|
121
|
+
obligative_clause,
|
|
122
|
+
presumptive_clause,
|
|
123
|
+
inceptive_clause,
|
|
124
|
+
deliberative_question,
|
|
125
|
+
hortative_proposal,
|
|
126
|
+
passive_form,
|
|
127
|
+
medio_passive_inability,
|
|
128
|
+
SyntaxEngine,
|
|
129
|
+
hindi_to_rajasthani,
|
|
130
|
+
explain_syntax_rules,
|
|
131
|
+
build_compound_verb,
|
|
132
|
+
build_complex_sentence,
|
|
133
|
+
generate_causative,
|
|
134
|
+
build_imperative,
|
|
135
|
+
convert_clusivity,
|
|
136
|
+
transform_voice,
|
|
137
|
+
build_counterfactual_conditional,
|
|
138
|
+
build_optative,
|
|
139
|
+
build_vat_narrative,
|
|
140
|
+
build_echo_word,
|
|
141
|
+
intensify_adjective,
|
|
142
|
+
convert_reported_speech,
|
|
143
|
+
build_rhetorical_question,
|
|
144
|
+
elevate_politeness,
|
|
145
|
+
build_dubitative_sentence,
|
|
146
|
+
connect_discourse,
|
|
147
|
+
apply_ergative_construction,
|
|
148
|
+
build_manner_correlative,
|
|
149
|
+
build_habitual_aspect,
|
|
150
|
+
transform_interrogative,
|
|
151
|
+
build_negative_optative,
|
|
152
|
+
attach_compound_postposition,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
# Lexicon & Dictionary
|
|
156
|
+
from rajasthani.lexicon import (
|
|
157
|
+
Word,
|
|
158
|
+
Dictionary,
|
|
159
|
+
get_default_dictionary,
|
|
160
|
+
lookup,
|
|
161
|
+
search,
|
|
162
|
+
get_idioms,
|
|
163
|
+
get_proverbs,
|
|
164
|
+
get_riddles,
|
|
165
|
+
generate_noun_paradigm,
|
|
166
|
+
generate_verb_paradigm,
|
|
167
|
+
stem_word,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
# Kinship System
|
|
171
|
+
from rajasthani.kinship import (
|
|
172
|
+
KinshipTerm,
|
|
173
|
+
resolve_kinship,
|
|
174
|
+
get_all_kinship_terms,
|
|
175
|
+
list_by_category,
|
|
176
|
+
KINSHIP_DATABASE,
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
# Translation Engine
|
|
180
|
+
from rajasthani.translator import (
|
|
181
|
+
TranslationResult,
|
|
182
|
+
TranslationEngine,
|
|
183
|
+
get_default_engine,
|
|
184
|
+
translate,
|
|
185
|
+
translate_rule_based,
|
|
186
|
+
pivot_translate,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
# Cultural Heritage
|
|
190
|
+
from rajasthani.culture import (
|
|
191
|
+
ArchitectureElement,
|
|
192
|
+
get_architecture_elements,
|
|
193
|
+
lookup_architecture,
|
|
194
|
+
ARCHITECTURE_DATABASE,
|
|
195
|
+
AttireItem,
|
|
196
|
+
get_attire_items,
|
|
197
|
+
ATTIRE_DATABASE,
|
|
198
|
+
FolkInstrument,
|
|
199
|
+
FolkDance,
|
|
200
|
+
get_instruments,
|
|
201
|
+
get_dances,
|
|
202
|
+
INSTRUMENTS_DATABASE,
|
|
203
|
+
DANCES_DATABASE,
|
|
204
|
+
Dish,
|
|
205
|
+
get_cuisine_dishes,
|
|
206
|
+
CUISINE_DATABASE,
|
|
207
|
+
FolkDeity,
|
|
208
|
+
get_folk_deities,
|
|
209
|
+
DEITIES_DATABASE,
|
|
210
|
+
HeritagePlace,
|
|
211
|
+
get_heritage_places,
|
|
212
|
+
PLACES_DATABASE,
|
|
213
|
+
LiteraryFigure,
|
|
214
|
+
get_literary_figures,
|
|
215
|
+
LITERATURE_DATABASE,
|
|
216
|
+
CulturalRitual,
|
|
217
|
+
get_all_rituals,
|
|
218
|
+
get_rituals_by_category,
|
|
219
|
+
RITUALS_DATABASE,
|
|
220
|
+
Ornament,
|
|
221
|
+
get_all_ornaments,
|
|
222
|
+
get_ornaments_by_body_part,
|
|
223
|
+
ORNAMENTS_DATABASE,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
# Voice & Pronunciation
|
|
227
|
+
from rajasthani.voice import (
|
|
228
|
+
VoiceEngine,
|
|
229
|
+
get_default_voice_engine,
|
|
230
|
+
pronounce,
|
|
231
|
+
RajasthaniVoiceSynthesizer,
|
|
232
|
+
VoiceConfig,
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
# Linguistics
|
|
236
|
+
from rajasthani.linguistics import (
|
|
237
|
+
get_dialect_features,
|
|
238
|
+
list_all_dialects,
|
|
239
|
+
DIALECT_COMPARISONS,
|
|
240
|
+
echo_word,
|
|
241
|
+
intensive_reduplication,
|
|
242
|
+
is_ergative_sentence,
|
|
243
|
+
tag_sentence,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
# Web & CLI
|
|
247
|
+
from rajasthani.web import run_server
|
|
248
|
+
from rajasthani.cli import main as cli_main
|
|
249
|
+
|
|
250
|
+
__all__ = [
|
|
251
|
+
# Metadata
|
|
252
|
+
"__version__",
|
|
253
|
+
"__author__",
|
|
254
|
+
"__email__",
|
|
255
|
+
"__maintainer__",
|
|
256
|
+
"__website__",
|
|
257
|
+
"__license__",
|
|
258
|
+
# Constants
|
|
259
|
+
"ISO_639_1",
|
|
260
|
+
"ISO_639_2",
|
|
261
|
+
"ISO_639_3",
|
|
262
|
+
"ISO_639_NAME",
|
|
263
|
+
"NATIVE_NAME",
|
|
264
|
+
"DEVANAGARI_NAME",
|
|
265
|
+
"HISTORICAL_SCRIPT",
|
|
266
|
+
"Dialect",
|
|
267
|
+
"Script",
|
|
268
|
+
"PartOfSpeech",
|
|
269
|
+
"Gender",
|
|
270
|
+
"GrammaticalNumber",
|
|
271
|
+
"Person",
|
|
272
|
+
"Tense",
|
|
273
|
+
"Case",
|
|
274
|
+
"RAJASTHANI_MONTHS",
|
|
275
|
+
"SEASONS",
|
|
276
|
+
"DAYS_OF_WEEK",
|
|
277
|
+
"GREETINGS",
|
|
278
|
+
"POSTPOSITIONS_BY_DIALECT",
|
|
279
|
+
# Phonetics
|
|
280
|
+
"normalize_devanagari",
|
|
281
|
+
"detect_script",
|
|
282
|
+
"devanagari_to_latin",
|
|
283
|
+
"latin_to_devanagari",
|
|
284
|
+
"tokenize",
|
|
285
|
+
"syllables",
|
|
286
|
+
# Numbers
|
|
287
|
+
"num_to_words",
|
|
288
|
+
"words_to_num",
|
|
289
|
+
"to_devanagari_numerals",
|
|
290
|
+
"from_devanagari_numerals",
|
|
291
|
+
"ordinal",
|
|
292
|
+
"fraction",
|
|
293
|
+
"DEV_DIGITS",
|
|
294
|
+
"RAJASTHANI_NUMBERS",
|
|
295
|
+
"FRACTIONS",
|
|
296
|
+
# Grammar
|
|
297
|
+
"pluralize",
|
|
298
|
+
"to_oblique",
|
|
299
|
+
"decline_noun",
|
|
300
|
+
"to_feminine",
|
|
301
|
+
"to_masculine",
|
|
302
|
+
"make_diminutive",
|
|
303
|
+
"PRONOUN_TABLE",
|
|
304
|
+
"get_pronoun",
|
|
305
|
+
"get_possessive",
|
|
306
|
+
"get_interrogative",
|
|
307
|
+
"get_relative",
|
|
308
|
+
"extract_root",
|
|
309
|
+
"conjugate",
|
|
310
|
+
"conjugate_to_be",
|
|
311
|
+
"imperative",
|
|
312
|
+
"conjunctive_participle",
|
|
313
|
+
"passive_verb",
|
|
314
|
+
"make_causative",
|
|
315
|
+
"attach_case",
|
|
316
|
+
"get_marker",
|
|
317
|
+
"POSTPOSITIONS",
|
|
318
|
+
"SPATIAL_POSTPOSITIONS",
|
|
319
|
+
"agree_adjective",
|
|
320
|
+
"comparative",
|
|
321
|
+
"superlative",
|
|
322
|
+
"get_adverb",
|
|
323
|
+
"ADVERBS_CATALOG",
|
|
324
|
+
"add_honorific_sa",
|
|
325
|
+
"honorific_greeting",
|
|
326
|
+
"negate_sentence",
|
|
327
|
+
"prohibitive",
|
|
328
|
+
"obligative_clause",
|
|
329
|
+
"presumptive_clause",
|
|
330
|
+
"inceptive_clause",
|
|
331
|
+
"deliberative_question",
|
|
332
|
+
"hortative_proposal",
|
|
333
|
+
"passive_form",
|
|
334
|
+
"medio_passive_inability",
|
|
335
|
+
"SyntaxEngine",
|
|
336
|
+
"hindi_to_rajasthani",
|
|
337
|
+
"explain_syntax_rules",
|
|
338
|
+
"build_compound_verb",
|
|
339
|
+
"build_complex_sentence",
|
|
340
|
+
"generate_causative",
|
|
341
|
+
"build_imperative",
|
|
342
|
+
"convert_clusivity",
|
|
343
|
+
"transform_voice",
|
|
344
|
+
"build_counterfactual_conditional",
|
|
345
|
+
"build_optative",
|
|
346
|
+
"build_vat_narrative",
|
|
347
|
+
"build_echo_word",
|
|
348
|
+
"intensify_adjective",
|
|
349
|
+
"convert_reported_speech",
|
|
350
|
+
"build_rhetorical_question",
|
|
351
|
+
"elevate_politeness",
|
|
352
|
+
"build_dubitative_sentence",
|
|
353
|
+
"connect_discourse",
|
|
354
|
+
"apply_ergative_construction",
|
|
355
|
+
"build_manner_correlative",
|
|
356
|
+
"build_habitual_aspect",
|
|
357
|
+
"transform_interrogative",
|
|
358
|
+
"build_negative_optative",
|
|
359
|
+
"attach_compound_postposition",
|
|
360
|
+
# Lexicon
|
|
361
|
+
"Word",
|
|
362
|
+
"Dictionary",
|
|
363
|
+
"get_default_dictionary",
|
|
364
|
+
"lookup",
|
|
365
|
+
"search",
|
|
366
|
+
"get_idioms",
|
|
367
|
+
"get_proverbs",
|
|
368
|
+
"get_riddles",
|
|
369
|
+
"generate_noun_paradigm",
|
|
370
|
+
"generate_verb_paradigm",
|
|
371
|
+
"stem_word",
|
|
372
|
+
# Kinship
|
|
373
|
+
"KinshipTerm",
|
|
374
|
+
"resolve_kinship",
|
|
375
|
+
"get_all_kinship_terms",
|
|
376
|
+
"list_by_category",
|
|
377
|
+
"KINSHIP_DATABASE",
|
|
378
|
+
# Translator
|
|
379
|
+
"TranslationResult",
|
|
380
|
+
"TranslationEngine",
|
|
381
|
+
"get_default_engine",
|
|
382
|
+
"translate",
|
|
383
|
+
"translate_rule_based",
|
|
384
|
+
"pivot_translate",
|
|
385
|
+
# Culture
|
|
386
|
+
"ArchitectureElement",
|
|
387
|
+
"get_architecture_elements",
|
|
388
|
+
"lookup_architecture",
|
|
389
|
+
"ARCHITECTURE_DATABASE",
|
|
390
|
+
"AttireItem",
|
|
391
|
+
"get_attire_items",
|
|
392
|
+
"ATTIRE_DATABASE",
|
|
393
|
+
"FolkInstrument",
|
|
394
|
+
"FolkDance",
|
|
395
|
+
"get_instruments",
|
|
396
|
+
"get_dances",
|
|
397
|
+
"INSTRUMENTS_DATABASE",
|
|
398
|
+
"DANCES_DATABASE",
|
|
399
|
+
"Dish",
|
|
400
|
+
"get_cuisine_dishes",
|
|
401
|
+
"CUISINE_DATABASE",
|
|
402
|
+
"FolkDeity",
|
|
403
|
+
"get_folk_deities",
|
|
404
|
+
"DEITIES_DATABASE",
|
|
405
|
+
"HeritagePlace",
|
|
406
|
+
"get_heritage_places",
|
|
407
|
+
"PLACES_DATABASE",
|
|
408
|
+
"LiteraryFigure",
|
|
409
|
+
"get_literary_figures",
|
|
410
|
+
"LITERATURE_DATABASE",
|
|
411
|
+
"CulturalRitual",
|
|
412
|
+
"get_all_rituals",
|
|
413
|
+
"get_rituals_by_category",
|
|
414
|
+
"RITUALS_DATABASE",
|
|
415
|
+
"Ornament",
|
|
416
|
+
"get_all_ornaments",
|
|
417
|
+
"get_ornaments_by_body_part",
|
|
418
|
+
"ORNAMENTS_DATABASE",
|
|
419
|
+
# Voice
|
|
420
|
+
"VoiceEngine",
|
|
421
|
+
"get_default_voice_engine",
|
|
422
|
+
"pronounce",
|
|
423
|
+
"RajasthaniVoiceSynthesizer",
|
|
424
|
+
"VoiceConfig",
|
|
425
|
+
# Linguistics
|
|
426
|
+
"get_dialect_features",
|
|
427
|
+
"list_all_dialects",
|
|
428
|
+
"DIALECT_COMPARISONS",
|
|
429
|
+
"echo_word",
|
|
430
|
+
"intensive_reduplication",
|
|
431
|
+
"is_ergative_sentence",
|
|
432
|
+
"tag_sentence",
|
|
433
|
+
# Web & CLI
|
|
434
|
+
"run_server",
|
|
435
|
+
"cli_main",
|
|
436
|
+
]
|
rajasthani/cli.py
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Rajasthani Language Library - Command-Line Interface (CLI)
|
|
4
|
+
=========================================================
|
|
5
|
+
CLI tool for translation, morphological conjugation, dictionary lookup,
|
|
6
|
+
number conversion, kinship resolution, and local web app server.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
import argparse
|
|
11
|
+
import rajasthani
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def main():
|
|
15
|
+
parser = argparse.ArgumentParser(
|
|
16
|
+
prog="rajasthani",
|
|
17
|
+
description="Rajasthani (राजस्थानी) Language Standard Library CLI",
|
|
18
|
+
)
|
|
19
|
+
subparsers = parser.add_subparsers(dest="command", help="Available commands")
|
|
20
|
+
|
|
21
|
+
# 1. Translate
|
|
22
|
+
trans_p = subparsers.add_parser("translate", help="Translate text into Rajasthani")
|
|
23
|
+
trans_p.add_argument("text", help="Source text to translate")
|
|
24
|
+
trans_p.add_argument("--source", "-s", default="auto", help="Source language (en, hi, etc.)")
|
|
25
|
+
trans_p.add_argument("--dialect", "-d", default="mwr", help="Target dialect (mwr, mew, dhd, hoj, swv)")
|
|
26
|
+
|
|
27
|
+
# 2. Conjugate
|
|
28
|
+
conj_p = subparsers.add_parser("conjugate", help="Conjugate a Rajasthani verb")
|
|
29
|
+
conj_p.add_argument("verb", help="Verb infinitive (e.g. खाणो, जाणो, करणो)")
|
|
30
|
+
conj_p.add_argument("--tense", "-t", default="present", help="Tense (present, past, future, continuous, presumptive, imperative)")
|
|
31
|
+
conj_p.add_argument("--person", "-p", default="third", choices=["first", "second", "third"])
|
|
32
|
+
conj_p.add_argument("--gender", "-g", default="masculine", choices=["masculine", "feminine"])
|
|
33
|
+
conj_p.add_argument("--number", "-n", default="singular", choices=["singular", "plural"])
|
|
34
|
+
conj_p.add_argument("--dialect", "-d", default="mwr")
|
|
35
|
+
|
|
36
|
+
# 3. Numbers
|
|
37
|
+
num_p = subparsers.add_parser("num", help="Convert numbers to Rajasthani words")
|
|
38
|
+
num_p.add_argument("value", type=int, help="Integer to convert (e.g. 42)")
|
|
39
|
+
|
|
40
|
+
# 4. Dictionary Lookup
|
|
41
|
+
dict_p = subparsers.add_parser("dict", help="Search the Rajasthani dictionary")
|
|
42
|
+
dict_p.add_argument("query", help="Word to search")
|
|
43
|
+
|
|
44
|
+
# 5. Kinship
|
|
45
|
+
kin_p = subparsers.add_parser("kinship", help="Resolve Rajasthani kinship relationships")
|
|
46
|
+
kin_p.add_argument("relation", help="Kinship relation (e.g. uncle, mama, father, byai)")
|
|
47
|
+
|
|
48
|
+
# 6. Culture
|
|
49
|
+
cul_p = subparsers.add_parser("culture", help="Explore Rajasthani cultural heritage")
|
|
50
|
+
cul_p.add_argument("category", choices=["architecture", "attire", "music", "cuisine", "deities", "places", "literature"])
|
|
51
|
+
|
|
52
|
+
# 7. Proverb
|
|
53
|
+
subparsers.add_parser("proverb", help="Display a traditional Rajasthani proverb (कहावत)")
|
|
54
|
+
|
|
55
|
+
# 8. Riddle
|
|
56
|
+
subparsers.add_parser("riddle", help="Display a traditional Rajasthani riddle (पहेली)")
|
|
57
|
+
|
|
58
|
+
# 9. Web Server
|
|
59
|
+
web_p = subparsers.add_parser("web", help="Launch interactive web server")
|
|
60
|
+
web_p.add_argument("--port", "-p", type=int, default=8000, help="Port to run on")
|
|
61
|
+
web_p.add_argument("--host", default="127.0.0.1", help="Host interface")
|
|
62
|
+
|
|
63
|
+
args = parser.parse_args()
|
|
64
|
+
|
|
65
|
+
if not args.command:
|
|
66
|
+
parser.print_help()
|
|
67
|
+
sys.exit(0)
|
|
68
|
+
|
|
69
|
+
# Dispatch commands
|
|
70
|
+
if args.command == "translate":
|
|
71
|
+
res = rajasthani.translate(args.text, source_lang=args.source, dialect=args.dialect)
|
|
72
|
+
print(f"\n🐫 राजस्थानी : {res.text}")
|
|
73
|
+
print(f"🔤 Romanized : {res.romanized}")
|
|
74
|
+
print(f"📌 Method : {res.method} (Dialect: {res.dialect})\n")
|
|
75
|
+
|
|
76
|
+
elif args.command == "conjugate":
|
|
77
|
+
tense = getattr(rajasthani.Tense, args.tense.upper(), rajasthani.Tense.PRESENT)
|
|
78
|
+
person = getattr(rajasthani.Person, args.person.upper(), rajasthani.Person.THIRD)
|
|
79
|
+
gender = getattr(rajasthani.Gender, args.gender.upper(), rajasthani.Gender.MASCULINE)
|
|
80
|
+
number = getattr(rajasthani.GrammaticalNumber, args.number.upper(), rajasthani.GrammaticalNumber.SINGULAR)
|
|
81
|
+
res = rajasthani.conjugate(
|
|
82
|
+
args.verb, tense=tense, person=person, gender=gender, number=number, dialect=args.dialect
|
|
83
|
+
)
|
|
84
|
+
print(f"\n⚙️ Conjugated Form: {res}\n")
|
|
85
|
+
|
|
86
|
+
elif args.command == "num":
|
|
87
|
+
words = rajasthani.num_to_words(args.value)
|
|
88
|
+
digits = rajasthani.to_devanagari_numerals(args.value)
|
|
89
|
+
ord_m = rajasthani.ordinal(args.value, "m")
|
|
90
|
+
print(f"\n🔢 Number : {args.value}")
|
|
91
|
+
print(f"📖 Words : {words}")
|
|
92
|
+
print(f"🪔 Digits : {digits}")
|
|
93
|
+
print(f"🏅 Ordinal : {ord_m}\n")
|
|
94
|
+
|
|
95
|
+
elif args.command == "dict":
|
|
96
|
+
w = rajasthani.lookup(args.query)
|
|
97
|
+
if w:
|
|
98
|
+
print(f"\n📖 शब्द : {w.rajasthani} ({w.roman}) [{w.pos}]")
|
|
99
|
+
print(f"🇮🇳 हिन्दी : {w.hindi}")
|
|
100
|
+
print(f"🇬🇧 English : {w.english}")
|
|
101
|
+
if w.example:
|
|
102
|
+
print(f"💬 उदाहरण : {w.example}")
|
|
103
|
+
print()
|
|
104
|
+
else:
|
|
105
|
+
matches = rajasthani.search(args.query, limit=5)
|
|
106
|
+
if matches:
|
|
107
|
+
print(f"\nFound {len(matches)} matches:")
|
|
108
|
+
for m in matches:
|
|
109
|
+
print(f"• {m.rajasthani} ({m.roman}): {m.hindi} / {m.english}")
|
|
110
|
+
print()
|
|
111
|
+
else:
|
|
112
|
+
print("\n❌ कोई शब्द कोनी मिल्यो (No words found).\n")
|
|
113
|
+
|
|
114
|
+
elif args.command == "kinship":
|
|
115
|
+
term = rajasthani.resolve_kinship(args.relation)
|
|
116
|
+
if term:
|
|
117
|
+
print(f"\n👥 नाता-गोता : {term.rajasthani} ({term.roman})")
|
|
118
|
+
print(f"👑 आदरसूचक : {term.honorific}")
|
|
119
|
+
print(f"🇮🇳 सम्बन्ध : {term.hindi}")
|
|
120
|
+
print(f"🇬🇧 English : {term.english}")
|
|
121
|
+
print(f"💡 परंपरा : {term.cultural_notes}\n")
|
|
122
|
+
else:
|
|
123
|
+
print("\n❌ Kinship term not resolved.\n")
|
|
124
|
+
|
|
125
|
+
elif args.command == "culture":
|
|
126
|
+
if args.category == "architecture":
|
|
127
|
+
for el in rajasthani.get_architecture_elements():
|
|
128
|
+
print(f"🏰 {el.name}: {el.description}")
|
|
129
|
+
elif args.category == "cuisine":
|
|
130
|
+
for d in rajasthani.get_cuisine_dishes():
|
|
131
|
+
print(f"🍛 {d.name}: {d.description}")
|
|
132
|
+
elif args.category == "music":
|
|
133
|
+
for ins in rajasthani.get_instruments():
|
|
134
|
+
print(f"🎶 {ins.name}: {ins.description}")
|
|
135
|
+
elif args.category == "deities":
|
|
136
|
+
for deity in rajasthani.get_folk_deities():
|
|
137
|
+
print(f"🙏 {deity.name}: {deity.legend}")
|
|
138
|
+
elif args.category == "places":
|
|
139
|
+
for pl in rajasthani.get_heritage_places():
|
|
140
|
+
print(f"📍 {pl.name}: {pl.description}")
|
|
141
|
+
elif args.category == "literature":
|
|
142
|
+
for lit in rajasthani.get_literary_figures():
|
|
143
|
+
print(f"📜 {lit.name} ({lit.period}): {lit.significance}")
|
|
144
|
+
|
|
145
|
+
elif args.command == "proverb":
|
|
146
|
+
p = rajasthani.get_default_dictionary().random_proverb()
|
|
147
|
+
if p:
|
|
148
|
+
print(f"\n📜 कहावत : {p['rajasthani']}")
|
|
149
|
+
print(f"🔤 उच्चारण : {p['roman']}")
|
|
150
|
+
print(f"🇮🇳 अर्थ : {p['hindi']}")
|
|
151
|
+
print(f"🇬🇧 Meaning : {p['english']}")
|
|
152
|
+
print(f"💡 संदर्भ : {p['cultural_context']}\n")
|
|
153
|
+
|
|
154
|
+
elif args.command == "riddle":
|
|
155
|
+
r = rajasthani.get_default_dictionary().random_riddle()
|
|
156
|
+
if r:
|
|
157
|
+
print(f"\n❓ पहेली (आडी) : {r['riddle']}")
|
|
158
|
+
print(f"💡 संकेत : {r['hindi_hint']}")
|
|
159
|
+
print(f"✅ उत्तर : {r['answer']} ({r['answer_english']})\n")
|
|
160
|
+
|
|
161
|
+
elif args.command == "web":
|
|
162
|
+
rajasthani.run_server(port=args.port, host=args.host)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
if __name__ == "__main__":
|
|
166
|
+
main()
|