def convert_public(): #print('There requests are') #print(request.json) nativize = True preoptions = [] postoptions = [] if 'preoptions' in request.values: preoptions = request.values['preoptions'].split(',') if 'postoptions' in request.values: postoptions = request.values['postoptions'].split(',') if 'nativize' in request.values: if request.values['nativize'] == 'False' or request.values['nativize'] == 'false': nativize = False if 'source' not in request.values: source = auto_detect(request.values['text']) preoptions = detect_preoptions(request.values['text'], source) else: source = request.values['source'] if 'text' in request.values: text = convert(source, request.values['target'], request.values['text'], nativize, preoptions, postoptions) else: text = '' return text
def convert_plugin(): source = request.json['source'] preoptions = request.json['preOptions'] #print(request.json['text']) if request.json['source'] == 'autodetect': source = auto_detect(request.json['text'], plugin = True) preoptions = detect_preoptions(request.json['text'], source) if source not in GeneralMap.Transliteration: text = convert(source, request.json['target'], request.json['text'], request.json['nativize'], preoptions, request.json['postOptions']) else: text = request.json['text'] return text
print(transliterate.process('HK', 'Siddham', 'buddhaH')) print(transliterate.process('autodetect', 'IAST', 'ꯃꯤꯇꯩ_ꯃꯌꯦꯛ')) print(transliterate.process('HK', 'Tamil', 'maMgaLa', False)) print( transliterate.process( 'HK', 'Tamil', 'bRhaspati gaMgA', False, post_options=['TamilSubScript', 'TamilRemoveApostrophe'])) print( transliterate.process('Thai', 'Devanagari', 'พุทธัง สะระณัง คัจฉามิ', pre_options=['ThaiOrthography'])) print(transliterate.process('autodetect', 'IAST', 'พุทธัง สะระณัง คัจฉามิ')) print(transliterate.auto_detect('ꯃꯤꯇꯩ_ꯃꯌꯦꯛ')) print( transliterate.process( 'Devanagari', 'IAST', 'धर्म भारत की श्रमण परम्परा से निकला धर्म और दर्शन है', pre_options=['RemoveSchwaHindi']))
def auto_detect_request(): return auto_detect(request.json['text'])
def auto_detect_request(): #print('The source is ' + auto_detect(request.json['text'])) return auto_detect(request.json['text'])