Skip to content

Commit

Permalink
preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
DGrothe-PhD committed Oct 29, 2023
1 parent 7315d72 commit 1c57bf5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
5 changes: 4 additions & 1 deletion T9KeyboardApp/T9.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@
"634783" : [ "meiste" ],
"6347836" : [ "meisten" ],
"2553" : [ "alle" ],
"25537" : [ "alles" ]
"25537" : [ "alles" ],
"32653" : [ "danke" ],
"373833" : [ "Freude" ],
"32648": [ "damit" ]
}
24 changes: 21 additions & 3 deletions T9KeyboardApp/numify.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

def ifromchar(q):
c = q.lower()
if c < 'd':
Expand Down Expand Up @@ -26,10 +28,26 @@ def numify(text):
result += x
return result


def jsonify(text):
with open(f"T9.json") as jsd:
json_data = json.load(jsd)
jsd.close()
#
word = text.split()
for w in word:
print(f'"{numify(w)}" : [ "{w}" ],')
for x in word:
w = x.strip(".,;:-!?'")
textkey = numify(w)
if not textkey in json_data:
json_data[textkey] = [ w ]
else:
entry = json_data[textkey]
if not w in entry:
entry.append(w)
json_data[textkey] = entry
# TODO testing, writing to file
print(json_data)
#print(f'"{numify(w)}" : [ "{w}" ],')

# numify("Auf Wiedersehen!")
# '283 94333773436!'
# '283 94333773436!'

0 comments on commit 1c57bf5

Please sign in to comment.