It takes a sentence. removes all punctuations and converts all letters to lower case. Then coverts every letter to a binary 10 bit form with 2 ON bits. Every letter is a binary representation stored in a matrix row. every matrix is a word. All words are stored in 3D matrix, 1st word being the first dimension .
Every letter is processed like a input pattern. Every word is a sequence of letters(patterns). You type a sentence and it gives a higher level representation of that sentence. Two symantically similar sentences will have semantically overlapping bits in the SDR. Totally different sentences will have NO overlaping bit. You can try different sentences. If you filter some letters from a sentence, its higher level representation wont change.
Democracy is maintained in the code. No cell will ever become so powerfull that it overwrites other cells excitation. Every new cell will have its influence on making pattern. A group of cells decide the final pattern, so inhibition by one cell is insignificant.
Its totally a CORTICAL LERNING ALGORITHM. implementation is little different from Nupic but the theory is same. Heirarchical connection is different. Its constantly learning.
Next part of this code will be a motor output. THe computer will respond with a sentence to the user. Regerating a sentence from this higher order SDR is in progress.
PYTHON 3.3 and Numpy Required !!!!
Numpy can be found here http://www.lfd.uci.edu/~gohlke/pythonlibs/