def utter_namank_from_received_string(string_data): print("== starting the process == \n") bell_module.ring(20, 0.2) print("STATUS: FOUND NAMES\n") sadhu.say("found_names") LED_STATUS.found_names() print(string_data) print("============\n") print("\nSTATUS: PREDICTIONS.") # ring the bell (hit solenoid 15 for 0.1 sec) bell_module.ring(15, 0.1) # Chant before starting prediction sadhu.say("om") sadhu.say("name_header") sadhu.say_name(str(string_data)) SN = destiny.soul_number(string_data) destiny_number = SN SD = destiny.soul_desires(string_data) # IDN = destiny.inner_dream_number(string_data) # IDS = destiny.inner_dreams(string_data) print("\n") print("-----------------------------------------") print("Soul Urge Number / Heart Desire Number: " + str(SN)) print("-----------------------------------------") print(SD) print("\n") sadhu.say("desire_header") sadhu.say_number(str(SN)) time.sleep(1) sadhu.say('dt' + str(SN)) # time.sleep(1) # print("\n") # print("------------------------------------------------------") # print("Personality Number / Inner Dream Number: " + str(IDN)) # print("------------------------------------------------------") # print(IDS) # print("\n") # sadhu.say("personality_header") # sadhu.say_number(str(IDN)) # time.sleep(1) # sadhu.say('su'+str(IDN)) print("\n*************** ^^^ **************") # ring the bell (hit solenoid 4 timesfor 0.25 sec) marking the ned of one prediction bell_module.ring(20, 0.2) LED_STATUS.deactivate()
def utter_namank_from_received_string(string_data): global destiny_number global found_name # clean strings of any speacial character as # softwareserial from ATMEGA sometimes introduces garbage str_data = ''.join(e for e in string_data if e.isalnum()) str_data = str_data.lower() # string_data = string_data.lower() found_name = str_data print(" => Starting the process\n") print("\n => Ringing auspicious bell") bell_module.ring(10, 0.1) print("\n => STATUS: FOUND NAMES:") sadhu.say("found_names:") LED_STATUS.found_names() print("\n" + found_name + "\n") print("\nSTATUS: PREDICTIONS.") # ring the bell (hit solenoid 15 for 0.1 sec) bell_module.ring(10, 0.1) # Chant before starting prediction sadhu.say("om") sadhu.say("name_header") sadhu.say_name(str(found_name)) SN = destiny.soul_number(found_name) destiny_number = SN SD = destiny.soul_desires(found_name) print("\n") print("-----------------------------------------") print("Soul Desire Destiny Number: " + str(SN)) print("-----------------------------------------") print(SD) print("\n") sadhu.say("desire_header") sadhu.say_number(str(SN)) time.sleep(1) sadhu.say('su' + str(SN)) # ring the bell (hit solenoid 4 timesfor 0.25 sec) marking # the end of one prediction print("\n => Ringing auspicious bell") bell_module.ring(10, 0.1) LED_STATUS.deactivate()
def starting_process_assignment(serial_data): # 1 --- > EXTRACRT STRING SENTENCE/TEXT < --- # # 1.1 --- > Do speech recognition and SST < --- # if serial_data == "start": print("\n => Starting the listening process") time.sleep(2) sadhu.say("start") LED_STATUS.listening() time.sleep(0.5) sentence = get_heard_sentence() if sentence != "None" and len(sentence) > 0: print("\n => STATUS: RECOGNIZED SST") print("\n => SST: " + sentence) # ::2:: --- > Do name recognition within speech < --- # names = extract_names(sentence) if names != "None": print("\n => STATUS: FOUND NAMES:") sadhu.say("found_names") LED_STATUS.found_names() # ---> pretty print the names list <--- # for name in names: print(" " + name) # ::3:: --- > Do destiny findings < --- # # Send ony one name from the names list if there is many if(len(names) >= 1): found_name,DN = assign_destiny_and_destiny_number(names[randint(0, len(names)-1)]); # return the name and number for sending it via serial return found_name,DN else: found_name,DN = assign_destiny_and_destiny_number(names[0]) # return the name and number for sending it via serial return found_name,DN else: print("\n => STATUS: No names found. Try Again!") print("\n => Start Again! hit the Bell") LED_STATUS.no_names() sadhu.say("noNames") found_name = "None" DN = "None" return found_name,DN else: print("\n => STATUS: SST unsuccessful. Try Again!") print("\n => Start Again! hit the Bell") LED_STATUS.no_names() sadhu.say("noNames") found_name = "None" DN = "None" return found_name,DN # 1.2 --- > Do String text reception < --- # elif (serial_data != "start" and serial_data != "stop" and len(serial_data) > 0) and !serial_data.isdigit(): print("\n => Starting the string reading process") time.sleep(2) LED_STATUS.listening() time.sleep(0.5) sentence = get_data_from_serial_string(serial_data) if sentence != "None" and len(sentence) > 0: print("\n => STATUS: RECOGNIZED VALID STRING") print("\n => STRING: " + sentence) # ::2:: --- > Do name recognition within speech < --- # names = extract_names(sentence) if names != "None": print("\n => STATUS: FOUND NAMES:") sadhu.say("found_names") LED_STATUS.found_names() # ---> pretty print the names list <--- # for name in names: print(" " + name) # ::3:: --- > Do destiny findings < --- # # Send ony one name from the names list if there is many if(len(names) >= 1): found_name,DN = assign_destiny_and_destiny_number(names[randint(0, len(names)-1)]); # return the name and number for sending it via serial return found_name,DN else: found_name,DN = assign_destiny_and_destiny_number(names[0]) # return the name and number for sending it via serial return found_name,DN else: print("\n => STATUS: No names found. Try Again!") print("\n => Start Again! hit the Bell") LED_STATUS.no_names() sadhu.say("noNames") found_name = "None" DN = "None" return found_name,DN else: print("\n => STATUS: serial string not valid. Try Again!") print("\n => Try Again by sending valid string. Normal string, you know :)") LED_STATUS.no_names() sadhu.say("noString") found_name = "None" DN = "None" return found_name,DN # 1.3 --- > Do analog value / number reception < --- # elif (serial_data != "start" and serial_data != "stop" and len(serial_data) > 0) and serial_data.isdigit(): print("\n => Starting the numer reading process") time.sleep(2) LED_STATUS.listening() time.sleep(0.5) found_name = "noname" DNN = int(serial_data) DN = int(valmap(DNN, 0, 1022, 1, 9)) # ::2:: --- > Assign predictions based on numbers < --- # if DN != 0 and DN in range(1, 10): # range (5, 8) >>> 5, 6, 7 print("\n => STATUS: FOUND NUMBER:") sadhu.say("numReceived") sadhu.say_number(DN) LED_STATUS.found_names() # same blink seq doesn't matter # ::3:: --- > Do destiny findings < --- # say_destiny_from_number_only(DN) return found_name,DN else: print("\n => STATUS: No number found or it was a string or it is not in required range. Try Again!") print("\n => Try Again by sending valid number. 1-1022, you know :)") LED_STATUS.no_names() sadhu.say("noNumber") found_name = "None" DN = "None" return found_name,DN elif serial_data == "stop": print("\n => STATUS: STOP Flag received! Do not Do anything!") found_name = "None" DN = "None" return found_name,DN else: found_name = "None" DN = "None" return found_name,DN
def find_names_utter_namank(): print("== starting the process == \n") time.sleep(2) sadhu.say("start") LED_STATUS.listening() time.sleep(0.5) # 1. --- > do speech recognition and SST < --- # listened_result = listener.listen() LED_STATUS.recognizing() if listened_result["success"] == True and listened_result["error"] == None: sentence = str(listened_result["transcription"]) print("STATUS: RECOGNIZED SST\n") print("SST: " + sentence + "\n") # 2. --- > Do name recognition within speech < --- # names = nr.get_names(sentence) if names == 'no valid names found': print("STATUS: No names found. Try Again!") LED_STATUS.no_names() sadhu.say("noNames") else: print("STATUS: FOUND NAMES\n") sadhu.say("found_names") LED_STATUS.found_names() # pretty print the names list for name in names: print(name) print("============\n") print("\nSTATUS: PREDICTIONS..") # 3. --- > Do destiny findings < --- # for name in names: print("\n" + name + "\n") # ring the bell (hit solenoid 15 for 0.1 sec) bell_module.ring(20, 0.2) # Chant before starting prediction sadhu.say("om") sadhu.say("name_header") sadhu.say_name(str(name)) SN = destiny.soul_number(name) destiny_number = SN SD = destiny.soul_desires(name) # IDN = destiny.inner_dream_number(name) # IDS = destiny.inner_dreams(name) print("\n") print("-----------------------------------------") print("Soul Urge Number / Heart Desire Number: " + str(SN)) print("-----------------------------------------") print(SD) print("\n") sadhu.say("desire_header") sadhu.say_number(str(SN)) time.sleep(1) sadhu.say('dt' + str(SN)) # time.sleep(1) # print("\n") # print("------------------------------------------------------") # print("Numerology Personality Number / Inner Dream Number " + str(IDN)) # print("------------------------------------------------------") # print(IDS) # print("\n") # sadhu.say("personality_header") # sadhu.say_number(str(IDN)) # time.sleep(1) # sadhu.say('su'+str(IDN)) # serial.pritn("name,6,jhsfgbhsbf,6, sdghvfsghdf;") print("\n*************** ^^^ **************") # ring the bell (hit solenoid 4 timesfor 0.25 sec) marking the ned of one prediction bell_module.ring(20, 0.2) LED_STATUS.deactivate() else: print(listened_result["success"]) print(listened_result["error"]) print("\n=> Start Again! hit the Bell <=\n") LED_STATUS.no_names() sadhu.say("noNames")
def find_names_utter_namank(): global destiny_number global found_name print(" => Starting the process") time.sleep(2) sadhu.say("start") LED_STATUS.listening() time.sleep(0.5) # 1. --- > do speech recognition and SST < --- # listened_result = listener.listen() LED_STATUS.recognizing() if listened_result["success"] == True and listened_result["error"] == None: sentence = str(listened_result["transcription"]) print("\n => STATUS: RECOGNIZED SST") print("\n => SST: " + sentence) # 2. --- > Do name recognition within speech < --- # names = nr.get_names(sentence) if names == 'no valid names found': print("\n => STATUS: No names found. Try Again!") print("\n => Start Again! hit the Bell") LED_STATUS.no_names() sadhu.say("noNames") destiny_number = None found_name = None else: print("\n => STATUS: FOUND NAMES:") sadhu.say("found_names") LED_STATUS.found_names() # pretty print the names list for name in names: # clean strings of any speacial character as we need one piece of string name = ''.join(e for e in name if e.isalnum()) name = name.lower() print(name) found_name = name print("\n => STATUS: PREDICTIONS:") # 3. --- > Do destiny findings < --- # for found_name in names: found_name = ''.join(e for e in name if e.isalnum()) found_name = found_name.lower() print("\n" + found_name + "\n") print("\n => Ringing auspicious bell") # ring the bell (hit solenoid 15 for 0.1 sec) bell_module.ring(10, 0.1) # Chant before starting prediction sadhu.say("om") sadhu.say("name_header") sadhu.say_name(str(found_name)) SN = destiny.soul_number(found_name) destiny_number = SN SD = destiny.soul_desires(found_name) print("\n") print("-----------------------------------------") print("Destiny Number and Heart Desire: " + str(SN)) print("-----------------------------------------") print(SD) print("\n") sadhu.say("desire_header") sadhu.say_number(str(SN)) time.sleep(1) sadhu.say('su' + str(SN)) # ring the bell (hit solenoid 4 timesfor 0.25 sec) marking # the end of one prediction print("\n => Ringing auspicious bell") bell_module.ring(10, 0.1) LED_STATUS.deactivate() else: print(listened_result["success"]) print(listened_result["error"]) print("\n => Start Again! hit the Bell") LED_STATUS.no_names() sadhu.say("noNames") destiny_number = None found_name = None
def utter_main_namank(): print("== starting the process == \n") time.sleep(2) # Turn BLUE LED here to indicate :listening: LED_STATUS.listening() # 1. --- > do speech recognition and SST < --- # listened_result = listener.listen() # LED_STATUS.recognizing() if listened_result["success"] == True and listened_result["error"] == None: sentence = str(listened_result["transcription"]) print("STATUS: RECOGNIZED SST\n") print("SST: " + sentence + "\n") # 2. --- > Do name recognition within speech < --- # names = nr.get_names(sentence) if names == 'no valid names found': print("STATUS: No names found. Try Again!") LED_STATUS.no_names() time.sleep(2.5) LED_STATUS.deactivate() print("\n=> Press Button to start Again! <=\n") else: print("STATUS: FOUND NAMES\n") bell_module.ring(30, 0.1) LED_STATUS.found_names() # pretty print the names list for name in names: print(name) time.sleep(1) print("============\n") print("\nSTATUS: PREDICTIONS..") # 3. --- > Do destiny findings < --- # for name in names: # ring the bell (hit solenoid twice for 0.25 sec) bell_module.ring(30, 0.1) time.sleep(1) # Setup the voice here before every loop # print(voice) sadhu.set_voice_gender(voice) # Chant before starting prediction sadhu.say_bullshit("ommmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm") print("\n" + name + "\n") sadhu.say_bullshit("So for name " + str(name)) SN = destiny.soul_number(name) SD = destiny.soul_desires(name) IDN = destiny.inner_dream_number(name) IDS = destiny.inner_dreams(name) print("-----------------------------------------") print("Soul Urge Number / Heart Desire Number: " + str(SN)) print("-----------------------------------------") print(SD) sadhu.say_bullshit( "Your desire number also called soul urge number is " + str(SN)) time.sleep(2) sadhu.say_bullshit(str(SD)) time.sleep(3) print("------------------------------------------------------") print("Numerology Personality Number / Inner Dream Number " + str(IDN)) print("------------------------------------------------------") print(IDS) sadhu.say_bullshit( "Your personality number also called inner dream number is " + str(IDN)) time.sleep(2) sadhu.say_bullshit(str(IDS)) # serial.pritn("name,6,jhsfgbhsbf,6, sdghvfsghdf;") print("\n*************** ^^^ **************") # ring the bell (hit solenoid 4 timesfor 0.25 sec) marking the ned of one prediction bell_module.ring(30, 0.1) print("\n=> Press Button to start Again! <=\n") LED_STATUS.deactivate() else: print(listened_result["success"]) print(listened_result["error"]) print("\n=> Press Button to start Again! <=\n") LED_STATUS.no_names() time.sleep(2.5) LED_STATUS.deactivate()