starting ada stuff

This commit is contained in:
Kyle Isom 2022-10-21 19:18:42 -07:00
parent b4fff86a37
commit acdf83da5a
4 changed files with 73 additions and 0 deletions

1
ada/bap/README Normal file
View File

@ -0,0 +1 @@
Beginning Ada Programming

View File

@ -0,0 +1,9 @@
with Ada.Text_IO;
procedure hello_world is
begin
Ada.Text_IO.Put_Line("Hello, world.");
Ada.Text_IO.Put("Now, goodbye.");
Ada.Text_IO.New_Line;
end hello_world;

62
misc/ns/keypad.py Executable file
View File

@ -0,0 +1,62 @@
import pyttsx3
engine = pyttsx3.init()
engine.setProperty("rate", 100)
keys = {
"2": "abc",
"3": "def",
"4": "ghi",
"5": "jkl",
"6": "mno",
"7": "pqrs",
"8": "tuv",
"9": "wxyz",
"0": " ",
}
numbers_spoken = [
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
]
def keypad_encode(text):
orig_message = text.lower()
keypad_strokes = []
for i in orig_message:
strokes = _to_stroke(i)
if strokes:
keypad_strokes.append(strokes)
coded = " ".join(keypad_strokes)
coded_ns = coded.replace(" ", "")
coded_arr = list(coded_ns)
numbers = []
for x in coded_arr:
numbers.append(numbers_spoken[int(x)])
return numbers
def _to_stroke(char):
for i in keys:
if char in keys[i]:
return i * (keys[i].find(char) + 1)
return None
def transmit(msg):
emsg = keypad_encode(msg)
print(emsg)
for number in emsg:
engine.say(number)
engine.runAndWait()

1
misc/ns/requirements.txt Executable file
View File

@ -0,0 +1 @@
pyttsx3