def story_page(): new_data = OrderedDict() user_stories = data_handler.get_all_user_story( ) # ezt ---------------------------------------- if request.method == 'POST': new_data['id'] = len( user_stories ) + 1 # ezt ---------------------------------------------- new_data['title'] = request.form['story_title'] new_data['user_story'] = str(request.form["user_story"]).replace( '\n', '<br>') new_data['acceptance_criteria'] = str( request.form["acceptance_criteria"]).replace('\n', '<br>') new_data['business_value'] = request.form['business_value'] new_data['estimation'] = request.form['estimation'] new_data['status'] = 'no status' user_stories.append( new_data ) # ezt ------------------------------------------------------- data_handler.write_data(user_stories) return render_template('story.html', statuses=data_handler.STATUSES, status_visibility='hidden', button_text='Add new User Story')
loader.load() from indicnlp.transliterate.unicode_transliterate import ItransTransliterator def transliterate(data, lang): """Transliterator.""" total = len(data) new_data = list() for i in range(len(data)): print(i, len(data)) # printProgressBar(i+1, total, prefix='Progress:', suffix='Complete', length=50) try: new_data.append(ItransTransliterator.to_itrans(data[i], LANG)) except IndexError: print(data[i]) return new_data if __name__ == "__main__": LANG = 'hi' INPUT_FILE = "/home/chrizandr/code-mixing/data/IITB.en-hi.hi" OUTPUT_FILE = "/home/chrizandr/code-mixing/data/IITB.en-hi.hi.roman" print("Reading data") original_text = read_data(INPUT_FILE, encoding="UNI", clean=False) print("Transliterating") romanized_text = transliterate(original_text, LANG) print("Writing to file") write_data(OUTPUT_FILE, romanized_text, encoding="UNI")
#!/usr/bin/python3 from data_handler import write_data if __name__ == "__main__": write_data()
""".""" from data_handler import read_data, write_data, break_in_subword import pdb INPUT = "data/IITB.en-hi.hi.roman.clean" OUTPUT = "data/IITB.en-hi.hi.syll" print "Reading" data = read_data(INPUT, encoding="UNI", clean=True) print "Breaking" new_data = break_in_subword(data, sentences=True) print "Writing" write_data(OUTPUT, new_data, encoding="UNI") pdb.set_trace()