-
Notifications
You must be signed in to change notification settings - Fork 0
/
TALK
74 lines (62 loc) · 3.37 KB
/
TALK
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
import sys
import operator
import math
import time
import numpy
#from numpy import *
from TALK_support import *
def main():
count=0
while True:
if count==0:
connection_matrix_1=numpy.random.rand(SENTENCE.memory_matrix_columns,SENTENCE.ascii_matrix_columns)
connection_matrix_1=SENTENCE.Connection_Matrix_1(connection_matrix_1) #makes 50% NaN
synapse_matrix_1=numpy.random.rand(SENTENCE.memory_matrix_rows*SENTENCE.memory_matrix_columns,SENTENCE.memory_matrix_rows,SENTENCE.memory_matrix_columns)
connection_matrix_2=numpy.random.rand(SENTENCE.memory_matrix_columns,SENTENCE.memory_matrix_rows,SENTENCE.memory_matrix_columns)
connection_matrix_2=SENTENCE.Connection_Matrix_2(connection_matrix_2) #makes 50% NaN
synapse_matrix_2=numpy.random.rand(SENTENCE.memory_matrix_rows*SENTENCE.memory_matrix_columns,SENTENCE.memory_matrix_rows,SENTENCE.memory_matrix_columns)
connection_matrix_3=numpy.random.rand(SENTENCE.memory_matrix_columns,SENTENCE.memory_matrix_rows,SENTENCE.memory_matrix_columns)
connection_matrix_3=SENTENCE.Connection_Matrix_2(connection_matrix_3) #function CM2 is similar to CM3
print('all matrixes initiated\n')
my_str = input("Enter a sentence: ")
sentence1=SENTENCE() # object of class
sent1=sentence1.RemovePunctuations(my_str) # also makes lower case
sent2=sentence1.SeparateWords(sent1) #sent2= ['how','are','you']
#print (sentence1.number_of_words)
sentence1.NumberofWords(sent2)
#print (sentence1.number_of_words)
sentence1.Length_of_each_word(sent2)
#print (sentence1.length_of_each_word)
#print(sentence1.words)
sentence1.Ascii_Matrix() # self.ascii_matrix has ascii matrix now !!
#print (connection_matrix_1)
connection_matrix_1=sentence1.Sdr_Matrix_1(connection_matrix_1) #store self.sdr_matrix_1
#input('connection_matrix1')
#print(connection_matrix_1)
synapse_matrix_1=sentence1.Memory_Matrix_1(synapse_matrix_1) # builts self.memory_matrix_1
#print (sentence1.memory_matrix_1)
#input('above is Main() memmory matrix 1')
#print(sentence1.sdr_matrix_1)
#input('above is self.sdr_matrix_1')
#print (synapse_matrix_1)
#input('above is Main() synapse_matrix_1')
#print(connection_matrix_2)
#input('\n above is connection_matrix_2 \n')
connection_matrix_2=sentence1.Sdr_Matrix_2(connection_matrix_2) #store self.sdr_matrix_2
#print(sentence1.sdr_matrix_2)
#print(connection_matrix_2)
#print(sentence1.memory_matrix_1[0,:,:])
synapse_matrix_2=sentence1.Memory_Matrix_2(synapse_matrix_2) # builts self.memory_matrix_2
#print (sentence1.memory_matrix_2)
#input('above is memmory matrix 2')
#print (synapse_matrix_2)
connection_matrix_3=sentence1.Sdr_Matrix_3(connection_matrix_3) #store self.sdr_matrix_3
#print(sentence1.sdr_matrix_1)
#print('\nabove is sdr_matrix_1\n')
#print(sentence1.sdr_matrix_2)
#print('\nabove is sdr_matrix_2\n')
print(sentence1.sdr_matrix_3)
print('\n above is SDR matrix 3 \n Higher level Representation of the sentence\n')
count=count+1
if __name__ == '__main__':
main()