-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNineRootedTree.html
93 lines (65 loc) · 2.82 KB
/
NineRootedTree.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html>
<head>
<title>
</title>
<style>
</style>
<!--link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css"-->
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<meta charset="utf-8">
</head>
<body>
<div id = "NRTWDiv" class = "NRTWDivStyle"></div>
<input id="wordsHere" value="text here"></input>
<button type="button" id ="addWordToNRTW">Add Word(s) To Nine Rooted Tree</button>
<button type="button" id="clearNRTWbutton">Clear Tree</button>
<py-env>
- numpy
- matplotlib
- nltk
- paths:
- ./ndigitsets3.py
- ./gematriac.db
- ./gemNumFuncs.py
- ./alphabet.py
- ./getwordsfromdbs.py
- ./NineRootedTreeWords.py
</py-env>
<py-script>
import NineRootedTreeWords as nrtw
from pyodide import create_proxy
from js import window, document, MouseEvent, localStorage, console
import gemNumFuncs as gnf
console.log("Here We Are")
tree_ScaExt = nrtw.NineRootedTree([], "ScaExt")
document.getElementById("NRTWDiv").innerHTML=tree_ScaExt.generateNestedList()
def addWordNRTW(mE):
console.log("addWordNRTW()")
global tree_ScaExt
new_words = document.getElementById("wordsHere").value.split()
for word in new_words:
gemval = gnf.getGematria(word, "ScaExt")
route = gnf.getParentList(gemval).reverse()
word=word.lower()
for i in word:
if not i.isalpha():
word=word.replace(i,"")
console.log("Lisään: "+str(word))
tree_ScaExt.addWord(word, "ScaExt")
document.getElementById("NRTWDiv").innerHTML=tree_ScaExt.generateNestedList()
return
aw_proxy = create_proxy(addWordNRTW)
wordAdder = document.getElementById("addWordToNRTW")
wordAdder.addEventListener("click", aw_proxy)
def clearNRTW(mE):
global tree_ScaExt
tree_ScaExt = nrtw.NineRootedTree([], "ScaExt")
document.getElementById("NRTWDiv").innerHTML=tree_ScaExt.generateNestedList()
return
clrNRTW_proxy = create_proxy(clearNRTW)
clearer = document.getElementById("clearNRTWbutton")
clearer.addEventListener("click", clrNRTW_proxy)
</py-script>
</body>
</html>