<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.edegan.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hiep</id>
	<title>edegan.com - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://www.edegan.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hiep"/>
	<link rel="alternate" type="text/html" href="http://www.edegan.com/wiki/Special:Contributions/Hiep"/>
	<updated>2026-06-02T01:17:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25804</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25804"/>
		<updated>2019-05-30T15:40:29Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = tf.contrib.cudnn_rnn.CudnnCompatibleLSTMCell(num_units) #num_units is the number of hidden units in the LSTM cell.&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. tf.nn.dynamic_rnn will do the work. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;br /&gt;
&lt;br /&gt;
If we want to stack multiple LSTM layers together, we can replace '''lstm=lstm_cell(keep_prob)''' with '''lstm= tf.contrib.rnn.MultiRNNCell([lstm_cell(keep_prob) for _ in range(num_layers)])''' where '''num_layers''' is an integer representing the number of LSTM layers we want&lt;br /&gt;
&lt;br /&gt;
A sample training code lives in&lt;br /&gt;
 E:\projects\embedding\Web_extractor_model\train_sample.py&lt;br /&gt;
&lt;br /&gt;
In the '''utils.py''' file, there are a few hyperparameters to remember.&lt;br /&gt;
&lt;br /&gt;
max_len: the length of each training point&lt;br /&gt;
&lt;br /&gt;
step: the number of steps we want to move to generate the next training point&lt;br /&gt;
&lt;br /&gt;
num_units: LSTM units, a safe choice is 128&lt;br /&gt;
&lt;br /&gt;
len_unique_chars: total number of unique tokens in all training data&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25803</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25803"/>
		<updated>2019-05-30T15:37:30Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = tf.contrib.cudnn_rnn.CudnnCompatibleLSTMCell(num_units) #num_units is the number of hidden units in the LSTM cell.&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. tf.nn.dynamic_rnn will do the work. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;br /&gt;
&lt;br /&gt;
If we want to stack multiple LSTM layers together, we can replace '''lstm=lstm_cell(keep_prob)''' with '''lstm= tf.contrib.rnn.MultiRNNCell([lstm_cell(keep_prob) for _ in range(num_layers)])''' where '''num_layers''' is an integer representing the number of LSTM layers we want&lt;br /&gt;
&lt;br /&gt;
A sample training code lives in&lt;br /&gt;
 E:\projects\embedding\Web_extractor_model\train_sample.py&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25802</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25802"/>
		<updated>2019-05-30T15:28:29Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = tf.contrib.cudnn_rnn.CudnnCompatibleLSTMCell(num_units) #num_units is the number of hidden units in the LSTM cell.&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. tf.nn.dynamic_rnn will do the work. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;br /&gt;
&lt;br /&gt;
A sample training code lives in&lt;br /&gt;
 E:\projects\embedding\Web_extractor_model\train_sample.py&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_generator&amp;diff=25800</id>
		<title>DSL generator</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_generator&amp;diff=25800"/>
		<updated>2019-05-30T15:13:23Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Geneator&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/05/16&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
The most important data we want to capture is the companies' tags, the images' tags, companies' short description, and companies' long description. For example, if we look at &lt;br /&gt;
 view-source:https://www.boost.vc/companies/&lt;br /&gt;
&lt;br /&gt;
We want to capture the tags that are associated with the companies' logos, the names of companies, the short descriptions of companies, and companies websites. The goal is to compress all of those into one DSL so that our [model http://www.edegan.com/wiki/DSL_Encoding] could learn the structure that we want.&lt;br /&gt;
&lt;br /&gt;
This [https://metacpan.org/pod/DSL::HTML::Compiler article] can be a good start to look at&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25739</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25739"/>
		<updated>2019-05-19T21:36:45Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = tf.contrib.cudnn_rnn.CudnnCompatibleLSTMCell(num_units) #num_units is the number of hidden units in the LSTM cell.&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. tf.nn.dynamic_rnn will do the work. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;br /&gt;
&lt;br /&gt;
A sample training code lives in&lt;br /&gt;
 E:\projects\embedding\train_sample.py&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25738</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25738"/>
		<updated>2019-05-19T21:36:22Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = tf.contrib.cudnn_rnn.CudnnCompatibleLSTMCell(num_units) #num_units is the number of hidden units in the LSTM cell.&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. tf.nn.dynamic_rnn will do the work. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;br /&gt;
&lt;br /&gt;
A sample training code lives in&lt;br /&gt;
 E:\projects\embedding&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_generator&amp;diff=25737</id>
		<title>DSL generator</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_generator&amp;diff=25737"/>
		<updated>2019-05-19T21:08:55Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Geneator&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/05/16&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
The most important data want to capture is the companies' tags, the images' tag, companies' short description, and companies' long description. For example, if we look at &lt;br /&gt;
 view-source:https://www.boost.vc/companies/&lt;br /&gt;
&lt;br /&gt;
We want to capture the tag that is associated with the companies' logos, the names of companies, the short descriptions of companies, and companies websites. The goal is to compress all of those into one DSL so that our [model http://www.edegan.com/wiki/DSL_Encoding] could learn the structure that we want.&lt;br /&gt;
&lt;br /&gt;
This [https://metacpan.org/pod/DSL::HTML::Compiler article] can be a good start to look at&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_generator&amp;diff=25682</id>
		<title>DSL generator</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_generator&amp;diff=25682"/>
		<updated>2019-05-16T15:56:54Z</updated>

		<summary type="html">&lt;p&gt;Hiep: Created page with &amp;quot;{{Project |Has title=DSL Geneator |Has owner=Hiep Nguyen |Has start date=2019/05/16 |Has project status=Active }}  ==Approach== The most important data want to capture is the...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Geneator&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/05/16&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
The most important data want to capture is the companies' tags, the images' tag, companies' short description, and companies' long description. For example, if we look at &lt;br /&gt;
 view-source:https://www.boost.vc/companies/&lt;br /&gt;
&lt;br /&gt;
We want to capture the tag that is associated with the companies' logos, the names of companies, the short descriptions of companies, and companies websites. The goal is to compress all of those into one DSL so that our [model http://www.edegan.com/wiki/DSL_Encoding] could learn the structure that we want.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25541</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25541"/>
		<updated>2019-05-10T21:41:05Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = tf.contrib.cudnn_rnn.CudnnCompatibleLSTMCell(num_units) #num_units is the number of hidden units in the LSTM cell.&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. tf.nn.dynamic_rnn will do the work. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25540</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25540"/>
		<updated>2019-05-10T21:40:13Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = tf.contrib.cudnn_rnn.CudnnCompatibleLSTMCell(num_units)&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. tf.nn.dynamic_rnn will do the work. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25539</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25539"/>
		<updated>2019-05-10T21:39:21Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = Cudnn_LSTM_with_bias(num_units)&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. tf.nn.dynamic_rnn will do the work. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25536</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25536"/>
		<updated>2019-05-09T17:04:04Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = Cudnn_LSTM_with_bias(num_units)&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. tf.nn.dynamic_rnn will do the work. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25535</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25535"/>
		<updated>2019-05-09T17:00:23Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = Cudnn_LSTM_with_bias(num_units)&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, W, b,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_tokens]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, W), b,name='prediction')&lt;br /&gt;
    return prediction&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25534</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25534"/>
		<updated>2019-05-09T16:59:35Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;br /&gt;
&lt;br /&gt;
==Proposed Training Model==&lt;br /&gt;
Given the preprocessing described above, one way we can train our model to detect all the marking in a HTML page is as follows.&lt;br /&gt;
&lt;br /&gt;
(1) First, we will store all the tokens in our training data into two Python dictionaries, where the first one has format {'token_index':'token'} and the second one has format {'token':'token_index'} to use later.&lt;br /&gt;
&lt;br /&gt;
(2) Decide a proper length for each training point. For instance, we can determine the max length of a training point to be 10 lines and pages that contain less than 20 lines will be padded with zeroes. For example, if we decide our max length to be 20, then files with 17 lines will be padded with [0, 0, 0...,0] for the remaining 3 rows.&lt;br /&gt;
&lt;br /&gt;
(3) Applied one-hot encoding as described in the previous section to all training dataset. When we do so, each data point ( one DSL file) will have shape [max length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
(4) Define y. What we are trying to do is to predict the next token given the previous tokens, so our label y will be the one-hot representation of the token after the sequence from the training data&lt;br /&gt;
&lt;br /&gt;
(5) Used a LSTM, or possibly bi-directional LSTM to traing the data using mini batches with Adam optimizer. Each batch that goes into the model will have shape [batch size, max  length, number of unique tokens]&lt;br /&gt;
&lt;br /&gt;
A sample LSTM cell in tensorflow is as follows:&lt;br /&gt;
&lt;br /&gt;
 def lstm_cell(keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
    Define one single lstm cell&lt;br /&gt;
    args:&lt;br /&gt;
    keep_prob: tensor scalar&lt;br /&gt;
    '''&lt;br /&gt;
    if tf.test.is_gpu_available():&lt;br /&gt;
        lstm = Cudnn_LSTM_with_bias(num_units)&lt;br /&gt;
    else:&lt;br /&gt;
        lstm = tf.nn.rnn_cell.LSTMCell(num_units,forget_bias=1.0)&lt;br /&gt;
    lstm=tf.contrib.rnn.DropoutWrapper(lstm, output_keep_prob=keep_prob)&lt;br /&gt;
    return lstm&lt;br /&gt;
&lt;br /&gt;
Then, we applied a tf.while loop through the cell to build our network. The sample code is&lt;br /&gt;
&lt;br /&gt;
 def lstm_network(x, weight, bias,keep_prob):&lt;br /&gt;
    '''&lt;br /&gt;
     define stacked cells and prediction&lt;br /&gt;
     x: data with shape [batch_size,max_len,len_unique_char]&lt;br /&gt;
    ''' &lt;br /&gt;
    lstm=lstm_cell(keep_prob)&lt;br /&gt;
    outputs, states = tf.nn.dynamic_rnn(lstm, x, dtype=tf.float32)&lt;br /&gt;
    prediction = tf.add(tf.matmul(states.h, weight), bias,name='prediction')&lt;br /&gt;
    return prediction&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25505</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25505"/>
		<updated>2019-05-06T18:02:39Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 ' ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {' ': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25504</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25504"/>
		<updated>2019-05-06T18:02:15Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 ' ',&lt;br /&gt;
 ' '&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 '',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {'': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25503</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25503"/>
		<updated>2019-05-06T18:01:34Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and storing all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 ''&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 '',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {'': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25502</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25502"/>
		<updated>2019-05-06T18:00:58Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a DSL file from pix2code as an example. The process is as follows:&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and store all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 ''&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 '',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {'': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25501</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25501"/>
		<updated>2019-05-06T18:00:10Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
== Explanation and Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a concrete DSL file from pix2code as example. The process is as follows&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and store all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 ''&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 '',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {'': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25498</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25498"/>
		<updated>2019-05-04T18:45:01Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a concrete DSL file from pix2code as example. The process is as follows&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and store all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 ''&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 [&lt;br /&gt;
 '',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {'': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25497</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25497"/>
		<updated>2019-05-03T23:00:41Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a concrete DSL file from pix2code as example. The process is as follows&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and store all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 ''&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 ['',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red'&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {'': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25496</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25496"/>
		<updated>2019-05-03T23:00:03Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a concrete DSL file from pix2code as example. The process is as follows&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and store all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 [&lt;br /&gt;
 'header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 ''&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 ['',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red']&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {'': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25495</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25495"/>
		<updated>2019-05-03T22:57:36Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one simple DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a concrete DSL file from pix2code as example. The process is as follows&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and store all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 tokens&lt;br /&gt;
 &lt;br /&gt;
 ['header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 ''&lt;br /&gt;
 ]&lt;br /&gt;
&lt;br /&gt;
Now, based on this list, to see the total number of tokens we can do&lt;br /&gt;
&lt;br /&gt;
 chars = sorted(list(set(tokens)))&lt;br /&gt;
&lt;br /&gt;
which results in&lt;br /&gt;
 ['',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 'header ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 'small-title, text, btn-red']&lt;br /&gt;
&lt;br /&gt;
As we can see, we have 9 elements in this example, which means the length of each vector would be 9. Now, we need to assign a number for each of the symbol, and the number will indicate the index of that element in the vector. &lt;br /&gt;
 char_indices = dict((c, i) for i, c in enumerate(chars))&lt;br /&gt;
 indices_char = dict((i, c) for i, c in enumerate(chars))&lt;br /&gt;
&lt;br /&gt;
This results in&lt;br /&gt;
 char_indices&lt;br /&gt;
 {'': 0,&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive': 1,&lt;br /&gt;
 'header ': 2,&lt;br /&gt;
 'quadruple ': 3,&lt;br /&gt;
 'row ': 4,&lt;br /&gt;
 'single ': 5,&lt;br /&gt;
 'small-title, text, btn-green': 6,&lt;br /&gt;
 'small-title, text, btn-orange': 7,&lt;br /&gt;
 'small-title, text, btn-red': 8}&lt;br /&gt;
&lt;br /&gt;
Hence, if we have a line with token 'header', the one-hot representation of it is [0,0,1,0,0,0,0,0,0]. There is a '1' at index 3, which indicates that 3 is there.&lt;br /&gt;
&lt;br /&gt;
Now, let's apply this embedding rule to our GUI file&lt;br /&gt;
 sentences=[]&lt;br /&gt;
 for i in range(0, len(tokens)):&lt;br /&gt;
    sentences.append(tokens[i])&lt;br /&gt;
 one_hot_vector = np.zeros((len(sentences),len(chars)))&lt;br /&gt;
 for i, sentence in enumerate(sentences):&lt;br /&gt;
    for t, char in enumerate(sentences):&lt;br /&gt;
        one_hot_vector[t, char_indices[char]] = 1&lt;br /&gt;
&lt;br /&gt;
The vector that represents our GUI will be something like this.&lt;br /&gt;
 array([[0., 0., 1., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 1., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 0., 1.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 1., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 0., 1., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 1., 0., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 1., 0., 0., 0.],&lt;br /&gt;
       [0., 0., 0., 0., 0., 0., 1., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.],&lt;br /&gt;
       [1., 0., 0., 0., 0., 0., 0., 0., 0.]])&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25494</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25494"/>
		<updated>2019-05-03T22:48:48Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a concrete DSL file from pix2code as example. The process is as follows&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and store all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 ['header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 ''&lt;br /&gt;
 ]&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25493</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25493"/>
		<updated>2019-05-03T22:48:35Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a concrete DSL file from pix2code as example. The process is as follows&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and store all the tokens in a list. The ''tokens'' variable now looks something like this&lt;br /&gt;
 ['header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 '']&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25492</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25492"/>
		<updated>2019-05-03T22:48:11Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a concrete DSL file from pix2code as example. The process is as follows&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;br /&gt;
&lt;br /&gt;
What we just did is opening a DSL file, going through every single line, stripping some symbols and store all the tokens in a list. The ```tokens``` variable now looks something like this&lt;br /&gt;
 ['header ',&lt;br /&gt;
 'btn-inactive, btn-active, btn-inactive, btn-inactive, btn-inactive',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-red',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 'quadruple ',&lt;br /&gt;
 'small-title, text, btn-orange',&lt;br /&gt;
 '',&lt;br /&gt;
 '',&lt;br /&gt;
 'row ',&lt;br /&gt;
 'single ',&lt;br /&gt;
 'small-title, text, btn-green',&lt;br /&gt;
 '',&lt;br /&gt;
 '']&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25491</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25491"/>
		<updated>2019-05-03T22:46:55Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
One-hot-encoding can be understood as representing a word or token as a vector with a lot of zeroes, where the number of zeroes is equal to the number of unique tokens in the DSL file. Let's look at a concrete DSL file from pix2code as example. The process is as follows&lt;br /&gt;
 gui = open('00CDC9A8-3D73-4291-90EF-49178E408797.gui')&lt;br /&gt;
 tokens=[]&lt;br /&gt;
 for line in gui:&lt;br /&gt;
    line=line.strip('\n').strip('}').strip('{')&lt;br /&gt;
    tokens.append(line)&lt;br /&gt;
    print(line)&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25435</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25435"/>
		<updated>2019-04-29T19:05:59Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing. The associated github page can be found [https://github.com/emilwallner/Screenshot-to-code/blob/master/README.md here]&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25422</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25422"/>
		<updated>2019-04-26T22:19:00Z</updated>

		<summary type="html">&lt;p&gt;Hiep: /* Approach */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented properly. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing.&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25421</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25421"/>
		<updated>2019-04-26T22:18:36Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. However, the preprocessing part was not discussed carefully in the paper and the source code was not commented. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing.&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current scripts that I wrote by following pix2code source code are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25420</id>
		<title>LP Extractor Protocol</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25420"/>
		<updated>2019-04-26T22:15:50Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=LP Extractor Protocol&lt;br /&gt;
|Has owner=Lasya Rajan,&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;The [[LP Extractor Protocol]] currently envisages marking data locations on webpages, converting webpages into a simplified Domain Specific Language (DSL), and then encoding the DSL into a matrix. The markings of data locations would be encoded into a companion matrix. Both matrices will then be fed into a neural network, which is trained to produce the markings given the DSL. To date, we have conducted a literature review that has found papers describing similar &amp;quot;paired input&amp;quot; networks, and are in the process refining our understanding of the pre-existing code and work related to each step.&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files location:&lt;br /&gt;
 E:\projects\Kauffman Incubator Project\03 Automate the extraction of information\RajanLasya_ExtractionProtocols_03.21&lt;br /&gt;
&lt;br /&gt;
==Proposed Method==&lt;br /&gt;
&lt;br /&gt;
According to “Project Goal V2,” (E:\mcnair\Projects\Incubators) we considered  three broadly defined methods to organize and extract useful information from an HTML web page. The first method is text processing, analyzing and classifying the textual content of the HTML page. The second method is to use image based pattern recognition, likely through an off-the-shelf model that can extrapolate key HTML elements from web page screenshots. The third, and most novel method is to structurally analyze the HTML tree structure, and express that simplified HTML structure in a Domain Specific Language (DSL). We are currently pursuing this third method.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
Structurally analyzing the HTML tree structure of a web page and expressing it in a DSL is the most innovative method of the three. It would require more than simply adapting off-the-shelf models. First, the DSL itself would need to be designed to optimize abstraction into the target domain, a web page. (See [[Domain Specific Language Research]].) Then, the DSL would need to be integrated into the machine learning pipeline by encoding the DSL into an appropriately formatted input, such as a vector or matrix, for a neural network. Three proposed methods for this encoding are using an adjacency matrix, an edges to vertices matrix, or utilizing DFS (depth-first search) algorithms. &lt;br /&gt;
&lt;br /&gt;
==== DFS Encoding ====&lt;br /&gt;
&lt;br /&gt;
Currently, we are leaning towards utilizing DFS algorithms. DFS algorithms operate by starting at the root node (or an arbitrary node for a graph) and traverses the longest branch fully before backtracking back to the last split before the branch terminated. A DFS algorithm could traverse any given tree and record 1 when a new node is found, and 0 when that node is fully explored. This creates a numerical representation of that tree that can then be entered into a vector or matrix. A DFS algorithm has an efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Adjacency Matrix ====&lt;br /&gt;
&lt;br /&gt;
By interpreting the tree as a graph, we can utilize an adjacency matrix to encode the tree. The elements of the matrix represent whether their corresponding vertices are adjacent in the graphical representation. In its simplest form, for a set of V number of vertices, the matrix would be a square matrix of dimensions |V| x |V|. The diagonal elements of such a matrix would all be zero. This approach has an algorithmic efficiency of O(n^2).&lt;br /&gt;
&lt;br /&gt;
==== Edges to Vertices Matrix ====&lt;br /&gt;
&lt;br /&gt;
For any given tree, we have n-1 (I'm assuming n = number of nodes) edges. For every edge, we can record the two ending vertices. This will result in a matrix of dimensions (n-1) x 2. This matrix approach has an algorithmic efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Supervised Learning Approach (HTML to DSL) ====&lt;br /&gt;
&lt;br /&gt;
Additionally, the HTML tree structure analysis method will require a subprocess by which to parse a complex HTML page into our DSL. An example of a similar process is Pix2Code, in which a DSL context and a GUI are feed into an architecture containing Long Short-Term Memory (LSTM) layers and a CNN-based vision model (see image below) which outputs a DSL token. After training with paired inputs is complete, this architecture can then take an empty context and a GUI input and output DSL code. &lt;br /&gt;
&lt;br /&gt;
[[File:Pix2code.png|thumb|center|upright=3|Image from &amp;quot;Project Goal V2&amp;quot; of Pix2Code architecture]]&lt;br /&gt;
&lt;br /&gt;
==Literature==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1705.07962 Pix2Code (Beltramelli)] &lt;br /&gt;
:This is the documentation for the Pix2Code architecture mentioned. &lt;br /&gt;
&lt;br /&gt;
* [https://pdfs.semanticscholar.org/a47e/e762b9c1f9d6876928a909623ebf4d0d3218.pdf Trend of Supervised Web Data Extraction (Martono, Azhari, Mustafa)]&lt;br /&gt;
:This article provides an overview of various web data extraction techniques. Section 2.2 describes a process of extracting a web page's DOM structure, and Section 2.3 includes a supervised extraction process that has some similar aspects to Pix2Code and other paired input architectures.&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/ZhouMashuq-WebContentExtractionThroughMachineLearning.pdf Web Content Extraction Through Machine Learning (Zhou, Mashuq)]&lt;br /&gt;
:This approach to web content extraction focuses exclusively on less structured web pages, and classifying text blocks within those pages. In Section 3: Data Collection, an algorithm written in JavaScript is used to inspect DOM elements and organize them by parent element. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1207.0246 Web Data Extraction, Applications and Techniques: A Survey (Ferrara et al.)]&lt;br /&gt;
: This survey of various web data extraction methods includes a section on tree-based analysis in Chapter 2: Techniques.&lt;br /&gt;
&lt;br /&gt;
*[https://arxiv.org/abs/1210.6113 Using the DOM Tree for Content Extraction (Lopez, Silva, Insa)]&lt;br /&gt;
: This paper presents a method of content extraction that analyzes the relationships between DOM elements based on a &amp;quot;chars-node ratio&amp;quot; that displays the relationship between text content and tags content in each node of the DOM tree. The authors of this paper implemented this technique in an open-source Firefox plugin. &lt;br /&gt;
&lt;br /&gt;
*[https://dl.acm.org/citation.cfm?id=775182 DOM-based Content Extraction of HTML Documents (Gupta et al.)]&lt;br /&gt;
: The approach delineated in this article parses HTML documents into DOM trees using openXML. Then, a recursive content extractor process each DOM tree and removes any non-content nodes. &lt;br /&gt;
&lt;br /&gt;
*[https://link.springer.com/chapter/10.1007/3-540-36901-5_42 Extracting Content Structure for Web Pages Based On Visual Representation (Cai et al.)]&lt;br /&gt;
: This paper proposes a Vision-based Page Segmentation (VIPS) algorithm that creates an extracted content structure, with each node of the structure corresponding to a block of coherent content on the page. Although this method focuses on semantically dividing the page, the algorithm uses page layout features to detect the page's structure.&lt;br /&gt;
&lt;br /&gt;
*[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.642.6155&amp;amp;rep=rep1&amp;amp;type=pdf A Survey on HTML Structure Aware and Tree Based Web Data Scraping Technique (Kadam, Pakle)]&lt;br /&gt;
: This article surveys eleven existing web extraction tools that utilize DOM structure to pull out relevant information. Some of these tools rely solely on the DOM tree, while others combine visual features with the DOM tree to extract content. &lt;br /&gt;
&lt;br /&gt;
*[https://ieeexplore.ieee.org/abstract/document/4376990 Layout Based Information Extraction from HTML Documents (Burget)]&lt;br /&gt;
: This paper articulates a method that uses visual information, rather than DOM tree structure, to extract information from a webpage. Although this is a different method from our proposed DOM-based approach, the page segmentation algorithm in Section 5 (Page Segmentation Algorithm) includes various factors that may be useful in our simplified HTML/DSL interpretation of the DOM tree structure.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1709.05584 Representation Learning on Graphs: Methods and Application (Hamilton, Ying, Leskovec)]&lt;br /&gt;
: This paper discusses different methods of encoding graph structures into low-dimensional embeddings that can be exploited by machine learning models. Section 2.2.2 (Random walk approaches) specifically compares the accuracy of using the random walk approach to traverse a graph, as opposed to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1607.00653 node2vec: Scalable Feature Learning for Networks (Grover, Leskovec)]&lt;br /&gt;
: node2vec was mentioned briefly in the above Hamilton et al. paper. node2vec is a scalable encoding algorithm that focuses on preserving network neighborhoods of nodes. The definition of a neighborhood can manipulated depending on the application context. In section 3.1 (Classic Search Strategies), node2vec is compared to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [http://www.ece.iastate.edu/snt/files/2018/03/v2v-graml18.pdf V2V: Vector Embedding of Graph and Applications (Nguyen, Tirthapura)]&lt;br /&gt;
: V2V (Vector to Vertex) is a learning approach similar to node2vec, except that it takes the random-walk sequence results from graph data and encodes them using a Continous Bag of Word (CBOW) approach to create V2V vectors. &lt;br /&gt;
&lt;br /&gt;
* [https://openreview.net/pdf?id=BkSqjHqxg Skip-Graph: Learning Graph Embeddings with an Encoder-Decoder Model (Lee, Kong)]&lt;br /&gt;
: This paper explains how to apply the skip-gram model to learning node representations of graph-structured data. This new encoder-decoder model can be trained to generate representations for any arbitrary random walk sequence. &lt;br /&gt;
&lt;br /&gt;
* [https://www.kdd.org/kdd2018/files/deep-learning-day/DLDay18_paper_27.pdf Learning Graph Representations with Recurrent Neural Network Autoencoders (Taheri, Gimpel, Berger-Wolf)]&lt;br /&gt;
: In a similar process to other neural network encoders, this proposed architecture first generates sequential data from graphs, using BFS shortest path, and random walk algorithms. It then trains LSTM autoencoders to embed these graph sequences into a vector space. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1805.07683 Learning Graph Representations with Recurrent Neural Networks (Jin, JaJa)]&lt;br /&gt;
:This article describes another approach to learning graph-level representations, except through a combination of supervised and unsupervised learning components. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/YaoZuo-AMachineLearningApproachToWebpageContentExtraction.pdf A Machine Learning Approach to Webpage Content Extraction (Yao, Zuo)]&lt;br /&gt;
: This article describes methods to simplify the content of a noisy HTML page, specifically through using machine learning to predict whether a block is content or non-content. This allows the classifier to remove boilerplate information.&lt;br /&gt;
&lt;br /&gt;
* [https://dl.acm.org/citation.cfm?id=565137 A Brief Survey of Web Data Extraction Tools (Laender et al.)]&lt;br /&gt;
: This article classifies various web data extraction techniques into 5 different types of tools, and one category of web extraction specific-languages. Section 3.2 (HTML-aware Tools) describes several existing tools for parsing HTML tree structures in building wrappers. Section 3.4 (NLP-based Tools) includes several methods of text analysis that may be relevant to this project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
This section contains possible implementation libraries and tools for various components of the extractor.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.crummy.com/software/BeautifulSoup/bs4/doc/ Beautiful Soup]&lt;br /&gt;
: A simple Python library that can parse HTML files into &amp;quot;Beautiful Soup objects,&amp;quot; which are basically tree structure objects. Likely too limited in functionality for automated extraction, but might be useful in developing/testing DSL.&lt;br /&gt;
&lt;br /&gt;
*[https://docs.scrapy.org/en/latest/index.html Scrapy]&lt;br /&gt;
: Similar to Beautiful Soup, but has more extensive and efficient functionality. Extracts HTML data by creating &amp;quot;selectors&amp;quot; specified by CSS or XPath expressions. &lt;br /&gt;
&lt;br /&gt;
==== pix2code ====&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tonybeltramelli/pix2code pix2Code]&lt;br /&gt;
: Github repo that contains original reference implementation of pix2code architecture. See above pix2code paper. [https://www.youtube.com/watch?v=pqKeXkhFA3I&amp;amp;feature=youtu.be Video] demo of trained neural network. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/fjbriones/pix2code2 pix2code2]&lt;br /&gt;
: An attempt to improve pix2code through the use of autoencoders between the two LSTM layers.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emilwallner/Screenshot-to-code Screenshot-to-code]&lt;br /&gt;
: Another version of pix2code with a Bootstrap version that converts web page screenshots to HTML, with the potential to generalize on new design mock-ups. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/andrewsoohwanlee/pix2code-pytorch pix2code PyTorch]&lt;br /&gt;
: pix2code implemented in PyTorch, also not ready for general usage yet.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ngundotra/code2pix code2pix]&lt;br /&gt;
: A project to recreate an inverse architecture to pix2code, with the objective of creating a GAN (Generative Adversarial Network) to replace pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/aditya-grover/node2vec node2Vec]&lt;br /&gt;
: Github repo that contains reference implementation of node2vec algorithm as a python module. See above node2vec paper.&lt;br /&gt;
: A [https://github.com/thunlp/OpenNE toolkit] containing node2vec implemented in a framework based on tensorflow&lt;br /&gt;
: [https://towardsdatascience.com/node2vec-embeddings-for-graph-data-32a866340fef Here] is a very good and elementary introduction to node2vec &lt;br /&gt;
* [https://networkx.github.io/documentation/stable/index.html NetworkX]&lt;br /&gt;
: NetworkX is a Python package for loading, visualizing, and processing graph data. Includes built in functions for DFS encoding, and constructing adjacency and edges to vertices matrices. &lt;br /&gt;
&lt;br /&gt;
*[https://radimrehurek.com/gensim/ Gensim]&lt;br /&gt;
: Gensim is a Python library used to analyze plain-text documents for semantic structure. Is required for node2vec.&lt;br /&gt;
&lt;br /&gt;
* [http://www.numpy.org/ NumPy]&lt;br /&gt;
: NumPy is a computing package that includes a N-dimensional array object (useful in encoding) and many other functions to process data. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DSL Development ===&lt;br /&gt;
&lt;br /&gt;
* [http://hackage.haskell.org/package/lucid Lucid]&lt;br /&gt;
: Lucid is a DSL implemented with Haskell for writing HTML. It represents DOM elements as functions, and uses specific notation to differentiate between data elements and code elements. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [https://keras.io/ Keras]&lt;br /&gt;
: In conjunction with tensorflow, Keras will support the deep learning components of the project. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ziyan/spider SVM Classifier Training Algorithm ]&lt;br /&gt;
: From the Yao, Zuo paper, this Github repo contains an algorithm for labelling the collected dataset using clustering, training the SVM with the labeled dataset, and using SVM model to extract content from new webpages. Implemented in JavaScript, CoffeeScript, and Python.&lt;br /&gt;
&lt;br /&gt;
* [https://www.h5py.org/ H5PY]&lt;br /&gt;
: The h5py package can be used to store large amounts of numerical data, and integrates well with NumPy&lt;br /&gt;
&lt;br /&gt;
=== Useful tutorials ===&lt;br /&gt;
: Since we will be using a two-layer LSTMs in tensorflow, this [https://medium.com/@erikhallstrm/using-the-tensorflow-multilayered-lstm-api-f6e7da7bbe40 article] might be useful.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Model ===&lt;br /&gt;
: Here is a visualization of the model that we might want to use for our extractor&lt;br /&gt;
[[File: Extractor-Model.png| first diagram of extractor model]]&lt;br /&gt;
&lt;br /&gt;
==DSL Encoder==&lt;br /&gt;
To encode the structure of the DSL scripts, we can try using one-hot vector. More details can be found [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ here] and [http://www.edegan.com/wiki/DSL_Encoding here].&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25419</id>
		<title>DSL Encoding</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=DSL_Encoding&amp;diff=25419"/>
		<updated>2019-04-26T22:11:11Z</updated>

		<summary type="html">&lt;p&gt;Hiep: Created page with &amp;quot;{{Project |Has title=DSL Encoding |Has owner=Hiep Nguyen |Has start date=2019/04/26 |Has project status=Active }}  ==Approach== Currently, I am thinking about using one-hot ve...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=DSL Encoding&lt;br /&gt;
|Has owner=Hiep Nguyen&lt;br /&gt;
|Has start date=2019/04/26&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Approach==&lt;br /&gt;
Currently, I am thinking about using one-hot vector to encode the structure of a DSL page. The author of the [http://www.edegan.com/wiki/Pix2code pix2code] project also had the same approach. This [https://blog.floydhub.com/turning-design-mockups-into-code-with-deep-learning/ article] gives a more detailed instruction for the embedding method. For our project, we can ignore the image-preprocessing part and focus solely on the text processing.&lt;br /&gt;
&lt;br /&gt;
==File and scripts==&lt;br /&gt;
The current codes are living on &lt;br /&gt;
 E:/projects/embedding&lt;br /&gt;
So far, I have been experimenting with only one DSL file, which is '00CDC9A8-3D73-4291-90EF-49178E408797.gui'. To see the current output (not yet one-hot), write&lt;br /&gt;
 python convert_gui.py&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25381</id>
		<title>GPU fix</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25381"/>
		<updated>2019-04-20T23:04:53Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Fixing the GPU on the RDP (Aprl 2019)==&lt;br /&gt;
&lt;br /&gt;
At the time of writing, CUDA and tensorflow cannot connect to our GPU. This can be verified by opening python3 and type&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 tf.test.is_gpu_available()&lt;br /&gt;
&lt;br /&gt;
In addition, GeForce Experience and NVIDIA control panel do not work right now.&lt;br /&gt;
&lt;br /&gt;
Hiep has checked GPU driver by going to device manager -&amp;gt; Display adapter -&amp;gt; RTX Titan -&amp;gt; Properties -&amp;gt; Driver -&amp;gt; Update Driver. However, nothing new is installed since the current driver is already up-to-date.&lt;br /&gt;
&lt;br /&gt;
Hiep has also restarted several NVIDIA services by opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA services -&amp;gt; clicked on restart. However, it still cannot resolve the issue.&lt;br /&gt;
&lt;br /&gt;
Since Geforce Experience cannot be opened, Hiep has followed a solution from NVIDIA forum, which is opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA service -&amp;gt; Under nvidia telemetry container -&amp;gt; Choose Log on -&amp;gt; Check Log on as Local System Account.&lt;br /&gt;
&lt;br /&gt;
However, none of the above approaches actually resolved the issue. Reinstalling NVIDIA software might be necessary.&lt;br /&gt;
&lt;br /&gt;
The error we have while opening GeForce experience is &lt;br /&gt;
 The code execution cannot proceed because wlanapi.dll was not found. Reinstalling the program may fix this problem.&lt;br /&gt;
&lt;br /&gt;
However, after re-downloading and re-installing GeForce experience, the error does not go away.&lt;br /&gt;
&lt;br /&gt;
According to this [https://www.lifewire.com/how-to-fix-wlanapi-dll-not-found-or-missing-errors-2624238 article], adding a featured called Wireless LAN service may fix the problem.&lt;br /&gt;
&lt;br /&gt;
In addition, the computer cannot find the GPU when we type 'dxdiag' in the cmd prompt. This may be a driver-related issue and this [http://www.bsocialshine.com/2016/06/how-to-fix-all-dll-file-missing-error.html article] suggests that installing 'Directx end user runtime web installer' will fix the problem.&lt;br /&gt;
&lt;br /&gt;
==Uninstall and Reinstall Drivers (04/20/2019)==&lt;br /&gt;
&lt;br /&gt;
I have uninstalled NVIDIA graphic drivers by &lt;br /&gt;
&lt;br /&gt;
(1) opening control panel -&amp;gt; remove application -&amp;gt; remove NVIDIA graphic driver, &lt;br /&gt;
(2) device manager -&amp;gt; remove device -&amp;gt; remove device and associated drivers, and&lt;br /&gt;
(3) restarted the computer&lt;br /&gt;
&lt;br /&gt;
I have reinstalled a new driver downloaded from [https://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/Windows/419.67/419.67-desktop-win10-64bit-international-crd-whql.exe&amp;amp;lang=us&amp;amp;type=TITAN NVIDIA page] using the default setting.&lt;br /&gt;
&lt;br /&gt;
However, the old error&lt;br /&gt;
 The code execution cannot proceed because wlanapi.dll was not found. Reinstalling the program may fix this problem.&lt;br /&gt;
is still there.&lt;br /&gt;
There is an [http://techgenix.com/enabling-physical-gpus-hyper/ article] that talks about enabling GPU(s) on windows sever.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25380</id>
		<title>GPU fix</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25380"/>
		<updated>2019-04-20T23:01:06Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Fixing the GPU on the RDP (Aprl 2019)==&lt;br /&gt;
&lt;br /&gt;
At the time of writing, CUDA and tensorflow cannot connect to our GPU. This can be verified by opening python3 and type&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 tf.test.is_gpu_available()&lt;br /&gt;
&lt;br /&gt;
In addition, GeForce Experience and NVIDIA control panel do not work right now.&lt;br /&gt;
&lt;br /&gt;
Hiep has checked GPU driver by going to device manager -&amp;gt; Display adapter -&amp;gt; RTX Titan -&amp;gt; Properties -&amp;gt; Driver -&amp;gt; Update Driver. However, nothing new is installed since the current driver is already up-to-date.&lt;br /&gt;
&lt;br /&gt;
Hiep has also restarted several NVIDIA services by opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA services -&amp;gt; clicked on restart. However, it still cannot resolve the issue.&lt;br /&gt;
&lt;br /&gt;
Since Geforce Experience cannot be opened, Hiep has followed a solution from NVIDIA forum, which is opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA service -&amp;gt; Under nvidia telemetry container -&amp;gt; Choose Log on -&amp;gt; Check Log on as Local System Account.&lt;br /&gt;
&lt;br /&gt;
However, none of the above approaches actually resolved the issue. Reinstalling NVIDIA software might be necessary.&lt;br /&gt;
&lt;br /&gt;
The error we have while opening GeForce experience is &lt;br /&gt;
 The code execution cannot proceed because wlanapi.dll was not found. Reinstalling the program may fix this problem.&lt;br /&gt;
&lt;br /&gt;
However, after re-downloading and re-installing GeForce experience, the error does not go away.&lt;br /&gt;
&lt;br /&gt;
According to this [https://www.lifewire.com/how-to-fix-wlanapi-dll-not-found-or-missing-errors-2624238 article], adding a featured called Wireless LAN service may fix the problem.&lt;br /&gt;
&lt;br /&gt;
In addition, the computer cannot find the GPU when we type 'dxdiag' in the cmd prompt. This may be a driver-related issue and this [http://www.bsocialshine.com/2016/06/how-to-fix-all-dll-file-missing-error.html article] suggests that installing 'Directx end user runtime web installer' will fix the problem.&lt;br /&gt;
&lt;br /&gt;
==Uninstall and Reinstall Drivers (04/20/2019)==&lt;br /&gt;
&lt;br /&gt;
I have uninstalled NVIDIA graphic drivers by &lt;br /&gt;
&lt;br /&gt;
(1) opening control panel -&amp;gt; remove application -&amp;gt; remove NVIDIA graphic driver, &lt;br /&gt;
(2) device manager -&amp;gt; remove device -&amp;gt; remove device and associated drivers, and&lt;br /&gt;
(3) restarted the computer&lt;br /&gt;
&lt;br /&gt;
I have reinstalled a new driver downloaded from [https://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/Windows/419.67/419.67-desktop-win10-64bit-international-crd-whql.exe&amp;amp;lang=us&amp;amp;type=TITAN NVIDIA page] using the default setting.&lt;br /&gt;
&lt;br /&gt;
However, the old error&lt;br /&gt;
 The code execution cannot proceed because wlanapi.dll was not found. Reinstalling the program may fix this problem.&lt;br /&gt;
is still there.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25379</id>
		<title>LP Extractor Protocol</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25379"/>
		<updated>2019-04-19T21:00:57Z</updated>

		<summary type="html">&lt;p&gt;Hiep: /* DFS Encoding */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=LP Extractor Protocol&lt;br /&gt;
|Has owner=Lasya Rajan,&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;The [[LP Extractor Protocol]] currently envisages marking data locations on webpages, converting webpages into a simplified Domain Specific Language (DSL), and then encoding the DSL into a matrix. The markings of data locations would be encoded into a companion matrix. Both matrices will then be fed into a neural network, which is trained to produce the markings given the DSL. To date, we have conducted a literature review that has found papers describing similar &amp;quot;paired input&amp;quot; networks, and are in the process refining our understanding of the pre-existing code and work related to each step.&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files location:&lt;br /&gt;
 E:\projects\Kauffman Incubator Project\03 Automate the extraction of information\RajanLasya_ExtractionProtocols_03.21&lt;br /&gt;
&lt;br /&gt;
==Proposed Method==&lt;br /&gt;
&lt;br /&gt;
According to “Project Goal V2,” (E:\mcnair\Projects\Incubators) we considered  three broadly defined methods to organize and extract useful information from an HTML web page. The first method is text processing, analyzing and classifying the textual content of the HTML page. The second method is to use image based pattern recognition, likely through an off-the-shelf model that can extrapolate key HTML elements from web page screenshots. The third, and most novel method is to structurally analyze the HTML tree structure, and express that simplified HTML structure in a Domain Specific Language (DSL). We are currently pursuing this third method.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
Structurally analyzing the HTML tree structure of a web page and expressing it in a DSL is the most innovative method of the three. It would require more than simply adapting off-the-shelf models. First, the DSL itself would need to be designed to optimize abstraction into the target domain, a web page. (See [[Domain Specific Language Research]].) Then, the DSL would need to be integrated into the machine learning pipeline by encoding the DSL into an appropriately formatted input, such as a vector or matrix, for a neural network. Three proposed methods for this encoding are using an adjacency matrix, an edges to vertices matrix, or utilizing DFS (depth-first search) algorithms. &lt;br /&gt;
&lt;br /&gt;
==== DFS Encoding ====&lt;br /&gt;
&lt;br /&gt;
Currently, we are leaning towards utilizing DFS algorithms. DFS algorithms operate by starting at the root node (or an arbitrary node for a graph) and traverses the longest branch fully before backtracking back to the last split before the branch terminated. A DFS algorithm could traverse any given tree and record 1 when a new node is found, and 0 when that node is fully explored. This creates a numerical representation of that tree that can then be entered into a vector or matrix. A DFS algorithm has an efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Adjacency Matrix ====&lt;br /&gt;
&lt;br /&gt;
By interpreting the tree as a graph, we can utilize an adjacency matrix to encode the tree. The elements of the matrix represent whether their corresponding vertices are adjacent in the graphical representation. In its simplest form, for a set of V number of vertices, the matrix would be a square matrix of dimensions |V| x |V|. The diagonal elements of such a matrix would all be zero. This approach has an algorithmic efficiency of O(n^2).&lt;br /&gt;
&lt;br /&gt;
==== Edges to Vertices Matrix ====&lt;br /&gt;
&lt;br /&gt;
For any given tree, we have n-1 (I'm assuming n = number of nodes) edges. For every edge, we can record the two ending vertices. This will result in a matrix of dimensions (n-1) x 2. This matrix approach has an algorithmic efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Supervised Learning Approach (HTML to DSL) ====&lt;br /&gt;
&lt;br /&gt;
Additionally, the HTML tree structure analysis method will require a subprocess by which to parse a complex HTML page into our DSL. An example of a similar process is Pix2Code, in which a DSL context and a GUI are feed into an architecture containing Long Short-Term Memory (LSTM) layers and a CNN-based vision model (see image below) which outputs a DSL token. After training with paired inputs is complete, this architecture can then take an empty context and a GUI input and output DSL code. &lt;br /&gt;
&lt;br /&gt;
[[File:Pix2code.png|thumb|center|upright=3|Image from &amp;quot;Project Goal V2&amp;quot; of Pix2Code architecture]]&lt;br /&gt;
&lt;br /&gt;
==Literature==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1705.07962 Pix2Code (Beltramelli)] &lt;br /&gt;
:This is the documentation for the Pix2Code architecture mentioned. &lt;br /&gt;
&lt;br /&gt;
* [https://pdfs.semanticscholar.org/a47e/e762b9c1f9d6876928a909623ebf4d0d3218.pdf Trend of Supervised Web Data Extraction (Martono, Azhari, Mustafa)]&lt;br /&gt;
:This article provides an overview of various web data extraction techniques. Section 2.2 describes a process of extracting a web page's DOM structure, and Section 2.3 includes a supervised extraction process that has some similar aspects to Pix2Code and other paired input architectures.&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/ZhouMashuq-WebContentExtractionThroughMachineLearning.pdf Web Content Extraction Through Machine Learning (Zhou, Mashuq)]&lt;br /&gt;
:This approach to web content extraction focuses exclusively on less structured web pages, and classifying text blocks within those pages. In Section 3: Data Collection, an algorithm written in JavaScript is used to inspect DOM elements and organize them by parent element. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1207.0246 Web Data Extraction, Applications and Techniques: A Survey (Ferrara et al.)]&lt;br /&gt;
: This survey of various web data extraction methods includes a section on tree-based analysis in Chapter 2: Techniques.&lt;br /&gt;
&lt;br /&gt;
*[https://arxiv.org/abs/1210.6113 Using the DOM Tree for Content Extraction (Lopez, Silva, Insa)]&lt;br /&gt;
: This paper presents a method of content extraction that analyzes the relationships between DOM elements based on a &amp;quot;chars-node ratio&amp;quot; that displays the relationship between text content and tags content in each node of the DOM tree. The authors of this paper implemented this technique in an open-source Firefox plugin. &lt;br /&gt;
&lt;br /&gt;
*[https://dl.acm.org/citation.cfm?id=775182 DOM-based Content Extraction of HTML Documents (Gupta et al.)]&lt;br /&gt;
: The approach delineated in this article parses HTML documents into DOM trees using openXML. Then, a recursive content extractor process each DOM tree and removes any non-content nodes. &lt;br /&gt;
&lt;br /&gt;
*[https://link.springer.com/chapter/10.1007/3-540-36901-5_42 Extracting Content Structure for Web Pages Based On Visual Representation (Cai et al.)]&lt;br /&gt;
: This paper proposes a Vision-based Page Segmentation (VIPS) algorithm that creates an extracted content structure, with each node of the structure corresponding to a block of coherent content on the page. Although this method focuses on semantically dividing the page, the algorithm uses page layout features to detect the page's structure.&lt;br /&gt;
&lt;br /&gt;
*[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.642.6155&amp;amp;rep=rep1&amp;amp;type=pdf A Survey on HTML Structure Aware and Tree Based Web Data Scraping Technique (Kadam, Pakle)]&lt;br /&gt;
: This article surveys eleven existing web extraction tools that utilize DOM structure to pull out relevant information. Some of these tools rely solely on the DOM tree, while others combine visual features with the DOM tree to extract content. &lt;br /&gt;
&lt;br /&gt;
*[https://ieeexplore.ieee.org/abstract/document/4376990 Layout Based Information Extraction from HTML Documents (Burget)]&lt;br /&gt;
: This paper articulates a method that uses visual information, rather than DOM tree structure, to extract information from a webpage. Although this is a different method from our proposed DOM-based approach, the page segmentation algorithm in Section 5 (Page Segmentation Algorithm) includes various factors that may be useful in our simplified HTML/DSL interpretation of the DOM tree structure.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1709.05584 Representation Learning on Graphs: Methods and Application (Hamilton, Ying, Leskovec)]&lt;br /&gt;
: This paper discusses different methods of encoding graph structures into low-dimensional embeddings that can be exploited by machine learning models. Section 2.2.2 (Random walk approaches) specifically compares the accuracy of using the random walk approach to traverse a graph, as opposed to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1607.00653 node2vec: Scalable Feature Learning for Networks (Grover, Leskovec)]&lt;br /&gt;
: node2vec was mentioned briefly in the above Hamilton et al. paper. node2vec is a scalable encoding algorithm that focuses on preserving network neighborhoods of nodes. The definition of a neighborhood can manipulated depending on the application context. In section 3.1 (Classic Search Strategies), node2vec is compared to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [http://www.ece.iastate.edu/snt/files/2018/03/v2v-graml18.pdf V2V: Vector Embedding of Graph and Applications (Nguyen, Tirthapura)]&lt;br /&gt;
: V2V (Vector to Vertex) is a learning approach similar to node2vec, except that it takes the random-walk sequence results from graph data and encodes them using a Continous Bag of Word (CBOW) approach to create V2V vectors. &lt;br /&gt;
&lt;br /&gt;
* [https://openreview.net/pdf?id=BkSqjHqxg Skip-Graph: Learning Graph Embeddings with an Encoder-Decoder Model (Lee, Kong)]&lt;br /&gt;
: This paper explains how to apply the skip-gram model to learning node representations of graph-structured data. This new encoder-decoder model can be trained to generate representations for any arbitrary random walk sequence. &lt;br /&gt;
&lt;br /&gt;
* [https://www.kdd.org/kdd2018/files/deep-learning-day/DLDay18_paper_27.pdf Learning Graph Representations with Recurrent Neural Network Autoencoders (Taheri, Gimpel, Berger-Wolf)]&lt;br /&gt;
: In a similar process to other neural network encoders, this proposed architecture first generates sequential data from graphs, using BFS shortest path, and random walk algorithms. It then trains LSTM autoencoders to embed these graph sequences into a vector space. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1805.07683 Learning Graph Representations with Recurrent Neural Networks (Jin, JaJa)]&lt;br /&gt;
:This article describes another approach to learning graph-level representations, except through a combination of supervised and unsupervised learning components. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/YaoZuo-AMachineLearningApproachToWebpageContentExtraction.pdf A Machine Learning Approach to Webpage Content Extraction (Yao, Zuo)]&lt;br /&gt;
: This article describes methods to simplify the content of a noisy HTML page, specifically through using machine learning to predict whether a block is content or non-content. This allows the classifier to remove boilerplate information.&lt;br /&gt;
&lt;br /&gt;
* [https://dl.acm.org/citation.cfm?id=565137 A Brief Survey of Web Data Extraction Tools (Laender et al.)]&lt;br /&gt;
: This article classifies various web data extraction techniques into 5 different types of tools, and one category of web extraction specific-languages. Section 3.2 (HTML-aware Tools) describes several existing tools for parsing HTML tree structures in building wrappers. Section 3.4 (NLP-based Tools) includes several methods of text analysis that may be relevant to this project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
This section contains possible implementation libraries and tools for various components of the extractor.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.crummy.com/software/BeautifulSoup/bs4/doc/ Beautiful Soup]&lt;br /&gt;
: A simple Python library that can parse HTML files into &amp;quot;Beautiful Soup objects,&amp;quot; which are basically tree structure objects. Likely too limited in functionality for automated extraction, but might be useful in developing/testing DSL.&lt;br /&gt;
&lt;br /&gt;
*[https://docs.scrapy.org/en/latest/index.html Scrapy]&lt;br /&gt;
: Similar to Beautiful Soup, but has more extensive and efficient functionality. Extracts HTML data by creating &amp;quot;selectors&amp;quot; specified by CSS or XPath expressions. &lt;br /&gt;
&lt;br /&gt;
==== pix2code ====&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tonybeltramelli/pix2code pix2Code]&lt;br /&gt;
: Github repo that contains original reference implementation of pix2code architecture. See above pix2code paper. [https://www.youtube.com/watch?v=pqKeXkhFA3I&amp;amp;feature=youtu.be Video] demo of trained neural network. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/fjbriones/pix2code2 pix2code2]&lt;br /&gt;
: An attempt to improve pix2code through the use of autoencoders between the two LSTM layers.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emilwallner/Screenshot-to-code Screenshot-to-code]&lt;br /&gt;
: Another version of pix2code with a Bootstrap version that converts web page screenshots to HTML, with the potential to generalize on new design mock-ups. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/andrewsoohwanlee/pix2code-pytorch pix2code PyTorch]&lt;br /&gt;
: pix2code implemented in PyTorch, also not ready for general usage yet.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ngundotra/code2pix code2pix]&lt;br /&gt;
: A project to recreate an inverse architecture to pix2code, with the objective of creating a GAN (Generative Adversarial Network) to replace pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/aditya-grover/node2vec node2Vec]&lt;br /&gt;
: Github repo that contains reference implementation of node2vec algorithm as a python module. See above node2vec paper.&lt;br /&gt;
: A [https://github.com/thunlp/OpenNE toolkit] containing node2vec implemented in a framework based on tensorflow&lt;br /&gt;
: [https://towardsdatascience.com/node2vec-embeddings-for-graph-data-32a866340fef Here] is a very good and elementary introduction to node2vec &lt;br /&gt;
* [https://networkx.github.io/documentation/stable/index.html NetworkX]&lt;br /&gt;
: NetworkX is a Python package for loading, visualizing, and processing graph data. Includes built in functions for DFS encoding, and constructing adjacency and edges to vertices matrices. &lt;br /&gt;
&lt;br /&gt;
*[https://radimrehurek.com/gensim/ Gensim]&lt;br /&gt;
: Gensim is a Python library used to analyze plain-text documents for semantic structure. Is required for node2vec.&lt;br /&gt;
&lt;br /&gt;
* [http://www.numpy.org/ NumPy]&lt;br /&gt;
: NumPy is a computing package that includes a N-dimensional array object (useful in encoding) and many other functions to process data. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DSL Development ===&lt;br /&gt;
&lt;br /&gt;
* [http://hackage.haskell.org/package/lucid Lucid]&lt;br /&gt;
: Lucid is a DSL implemented with Haskell for writing HTML. It represents DOM elements as functions, and uses specific notation to differentiate between data elements and code elements. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [https://keras.io/ Keras]&lt;br /&gt;
: In conjunction with tensorflow, Keras will support the deep learning components of the project. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ziyan/spider SVM Classifier Training Algorithm ]&lt;br /&gt;
: From the Yao, Zuo paper, this Github repo contains an algorithm for labelling the collected dataset using clustering, training the SVM with the labeled dataset, and using SVM model to extract content from new webpages. Implemented in JavaScript, CoffeeScript, and Python.&lt;br /&gt;
&lt;br /&gt;
* [https://www.h5py.org/ H5PY]&lt;br /&gt;
: The h5py package can be used to store large amounts of numerical data, and integrates well with NumPy&lt;br /&gt;
&lt;br /&gt;
=== Useful tutorials ===&lt;br /&gt;
: Since we will be using a two-layer LSTMs in tensorflow, this [https://medium.com/@erikhallstrm/using-the-tensorflow-multilayered-lstm-api-f6e7da7bbe40 article] might be useful.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Model ===&lt;br /&gt;
: Here is a visualization of the model that we might want to use for our extractor&lt;br /&gt;
[[File: Extractor-Model.png| first diagram of extractor model]]&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25375</id>
		<title>LP Extractor Protocol</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25375"/>
		<updated>2019-04-18T20:51:34Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=LP Extractor Protocol&lt;br /&gt;
|Has owner=Lasya Rajan,&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;The [[LP Extractor Protocol]] currently envisages marking data locations on webpages, converting webpages into a simplified Domain Specific Language (DSL), and then encoding the DSL into a matrix. The markings of data locations would be encoded into a companion matrix. Both matrices will then be fed into a neural network, which is trained to produce the markings given the DSL. To date, we have conducted a literature review that has found papers describing similar &amp;quot;paired input&amp;quot; networks, and are in the process refining our understanding of the pre-existing code and work related to each step.&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files location:&lt;br /&gt;
 E:\projects\Kauffman Incubator Project\03 Automate the extraction of information\RajanLasya_ExtractionProtocols_03.21&lt;br /&gt;
&lt;br /&gt;
==Proposed Method==&lt;br /&gt;
&lt;br /&gt;
According to “Project Goal V2,” (E:\mcnair\Projects\Incubators) we considered  three broadly defined methods to organize and extract useful information from an HTML web page. The first method is text processing, analyzing and classifying the textual content of the HTML page. The second method is to use image based pattern recognition, likely through an off-the-shelf model that can extrapolate key HTML elements from web page screenshots. The third, and most novel method is to structurally analyze the HTML tree structure, and express that simplified HTML structure in a Domain Specific Language (DSL). We are currently pursuing this third method.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
Structurally analyzing the HTML tree structure of a web page and expressing it in a DSL is the most innovative method of the three. It would require more than simply adapting off-the-shelf models. First, the DSL itself would need to be designed to optimize abstraction into the target domain, a web page. (See [[Domain Specific Language Research]].) Then, the DSL would need to be integrated into the machine learning pipeline by encoding the DSL into an appropriately formatted input, such as a vector or matrix, for a neural network. Three proposed methods for this encoding are using an adjacency matrix, an edges to vertices matrix, or utilizing DFS (depth-first search) algorithms. &lt;br /&gt;
&lt;br /&gt;
==== DFS Encoding ====&lt;br /&gt;
&lt;br /&gt;
Currently, we are leaning towards utilizing DFS algorithms. DFS algorithms operate by starting at the root node (or an arbitrary node for a graph) and traverses the longest branch fully before backtracking back to the last split before the branch terminated. A DFS algorithm could traverse any given tree and record 1 when a new node is found, and 0 when that node is fully explored. This creates a numerical representation of that tree that can then be entered into a vector or matrix. A DFS algorithm has an efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Adjacency Matrix ====&lt;br /&gt;
&lt;br /&gt;
By interpreting the tree as a graph, we can utilize an adjacency matrix to encode the tree. The elements of the matrix represent whether their corresponding vertices are adjacent in the graphical representation. In its simplest form, for a set of V number of vertices, the matrix would be a square matrix of dimensions |V| x |V|. The diagonal elements of such a matrix would all be zero. This approach has an algorithmic efficiency of O(n^2).&lt;br /&gt;
&lt;br /&gt;
==== Edges to Vertices Matrix ====&lt;br /&gt;
&lt;br /&gt;
For any given tree, we have n-1 (I'm assuming n = number of nodes) edges. For every edge, we can record the two ending vertices. This will result in a matrix of dimensions (n-1) x 2. This matrix approach has an algorithmic efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Supervised Learning Approach (HTML to DSL) ====&lt;br /&gt;
&lt;br /&gt;
Additionally, the HTML tree structure analysis method will require a subprocess by which to parse a complex HTML page into our DSL. An example of a similar process is Pix2Code, in which a DSL context and a GUI are feed into an architecture containing Long Short-Term Memory (LSTM) layers and a CNN-based vision model (see image below) which outputs a DSL token. After training with paired inputs is complete, this architecture can then take an empty context and a GUI input and output DSL code. &lt;br /&gt;
&lt;br /&gt;
[[File:Pix2code.png|thumb|center|upright=3|Image from &amp;quot;Project Goal V2&amp;quot; of Pix2Code architecture]]&lt;br /&gt;
&lt;br /&gt;
==Literature==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1705.07962 Pix2Code (Beltramelli)] &lt;br /&gt;
:This is the documentation for the Pix2Code architecture mentioned. &lt;br /&gt;
&lt;br /&gt;
* [https://pdfs.semanticscholar.org/a47e/e762b9c1f9d6876928a909623ebf4d0d3218.pdf Trend of Supervised Web Data Extraction (Martono, Azhari, Mustafa)]&lt;br /&gt;
:This article provides an overview of various web data extraction techniques. Section 2.2 describes a process of extracting a web page's DOM structure, and Section 2.3 includes a supervised extraction process that has some similar aspects to Pix2Code and other paired input architectures.&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/ZhouMashuq-WebContentExtractionThroughMachineLearning.pdf Web Content Extraction Through Machine Learning (Zhou, Mashuq)]&lt;br /&gt;
:This approach to web content extraction focuses exclusively on less structured web pages, and classifying text blocks within those pages. In Section 3: Data Collection, an algorithm written in JavaScript is used to inspect DOM elements and organize them by parent element. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1207.0246 Web Data Extraction, Applications and Techniques: A Survey (Ferrara et al.)]&lt;br /&gt;
: This survey of various web data extraction methods includes a section on tree-based analysis in Chapter 2: Techniques.&lt;br /&gt;
&lt;br /&gt;
*[https://arxiv.org/abs/1210.6113 Using the DOM Tree for Content Extraction (Lopez, Silva, Insa)]&lt;br /&gt;
: This paper presents a method of content extraction that analyzes the relationships between DOM elements based on a &amp;quot;chars-node ratio&amp;quot; that displays the relationship between text content and tags content in each node of the DOM tree. The authors of this paper implemented this technique in an open-source Firefox plugin. &lt;br /&gt;
&lt;br /&gt;
*[https://dl.acm.org/citation.cfm?id=775182 DOM-based Content Extraction of HTML Documents (Gupta et al.)]&lt;br /&gt;
: The approach delineated in this article parses HTML documents into DOM trees using openXML. Then, a recursive content extractor process each DOM tree and removes any non-content nodes. &lt;br /&gt;
&lt;br /&gt;
*[https://link.springer.com/chapter/10.1007/3-540-36901-5_42 Extracting Content Structure for Web Pages Based On Visual Representation (Cai et al.)]&lt;br /&gt;
: This paper proposes a Vision-based Page Segmentation (VIPS) algorithm that creates an extracted content structure, with each node of the structure corresponding to a block of coherent content on the page. Although this method focuses on semantically dividing the page, the algorithm uses page layout features to detect the page's structure.&lt;br /&gt;
&lt;br /&gt;
*[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.642.6155&amp;amp;rep=rep1&amp;amp;type=pdf A Survey on HTML Structure Aware and Tree Based Web Data Scraping Technique (Kadam, Pakle)]&lt;br /&gt;
: This article surveys eleven existing web extraction tools that utilize DOM structure to pull out relevant information. Some of these tools rely solely on the DOM tree, while others combine visual features with the DOM tree to extract content. &lt;br /&gt;
&lt;br /&gt;
*[https://ieeexplore.ieee.org/abstract/document/4376990 Layout Based Information Extraction from HTML Documents (Burget)]&lt;br /&gt;
: This paper articulates a method that uses visual information, rather than DOM tree structure, to extract information from a webpage. Although this is a different method from our proposed DOM-based approach, the page segmentation algorithm in Section 5 (Page Segmentation Algorithm) includes various factors that may be useful in our simplified HTML/DSL interpretation of the DOM tree structure.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1709.05584 Representation Learning on Graphs: Methods and Application (Hamilton, Ying, Leskovec)]&lt;br /&gt;
: This paper discusses different methods of encoding graph structures into low-dimensional embeddings that can be exploited by machine learning models. Section 2.2.2 (Random walk approaches) specifically compares the accuracy of using the random walk approach to traverse a graph, as opposed to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1607.00653 node2vec: Scalable Feature Learning for Networks (Grover, Leskovec)]&lt;br /&gt;
: node2vec was mentioned briefly in the above Hamilton et al. paper. node2vec is a scalable encoding algorithm that focuses on preserving network neighborhoods of nodes. The definition of a neighborhood can manipulated depending on the application context. In section 3.1 (Classic Search Strategies), node2vec is compared to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [http://www.ece.iastate.edu/snt/files/2018/03/v2v-graml18.pdf V2V: Vector Embedding of Graph and Applications (Nguyen, Tirthapura)]&lt;br /&gt;
: V2V (Vector to Vertex) is a learning approach similar to node2vec, except that it takes the random-walk sequence results from graph data and encodes them using a Continous Bag of Word (CBOW) approach to create V2V vectors. &lt;br /&gt;
&lt;br /&gt;
* [https://openreview.net/pdf?id=BkSqjHqxg Skip-Graph: Learning Graph Embeddings with an Encoder-Decoder Model (Lee, Kong)]&lt;br /&gt;
: This paper explains how to apply the skip-gram model to learning node representations of graph-structured data. This new encoder-decoder model can be trained to generate representations for any arbitrary random walk sequence. &lt;br /&gt;
&lt;br /&gt;
* [https://www.kdd.org/kdd2018/files/deep-learning-day/DLDay18_paper_27.pdf Learning Graph Representations with Recurrent Neural Network Autoencoders (Taheri, Gimpel, Berger-Wolf)]&lt;br /&gt;
: In a similar process to other neural network encoders, this proposed architecture first generates sequential data from graphs, using BFS shortest path, and random walk algorithms. It then trains LSTM autoencoders to embed these graph sequences into a vector space. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1805.07683 Learning Graph Representations with Recurrent Neural Networks (Jin, JaJa)]&lt;br /&gt;
:This article describes another approach to learning graph-level representations, except through a combination of supervised and unsupervised learning components. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/YaoZuo-AMachineLearningApproachToWebpageContentExtraction.pdf A Machine Learning Approach to Webpage Content Extraction (Yao, Zuo)]&lt;br /&gt;
: This article describes methods to simplify the content of a noisy HTML page, specifically through using machine learning to predict whether a block is content or non-content. This allows the classifier to remove boilerplate information.&lt;br /&gt;
&lt;br /&gt;
* [https://dl.acm.org/citation.cfm?id=565137 A Brief Survey of Web Data Extraction Tools (Laender et al.)]&lt;br /&gt;
: This article classifies various web data extraction techniques into 5 different types of tools, and one category of web extraction specific-languages. Section 3.2 (HTML-aware Tools) describes several existing tools for parsing HTML tree structures in building wrappers. Section 3.4 (NLP-based Tools) includes several methods of text analysis that may be relevant to this project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
This section contains possible implementation libraries and tools for various components of the extractor.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.crummy.com/software/BeautifulSoup/bs4/doc/ Beautiful Soup]&lt;br /&gt;
: A simple Python library that can parse HTML files into &amp;quot;Beautiful Soup objects,&amp;quot; which are basically tree structure objects. Likely too limited in functionality for automated extraction, but might be useful in developing/testing DSL.&lt;br /&gt;
&lt;br /&gt;
*[https://docs.scrapy.org/en/latest/index.html Scrapy]&lt;br /&gt;
: Similar to Beautiful Soup, but has more extensive and efficient functionality. Extracts HTML data by creating &amp;quot;selectors&amp;quot; specified by CSS or XPath expressions. &lt;br /&gt;
&lt;br /&gt;
==== pix2code ====&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tonybeltramelli/pix2code pix2Code]&lt;br /&gt;
: Github repo that contains original reference implementation of pix2code architecture. See above pix2code paper. [https://www.youtube.com/watch?v=pqKeXkhFA3I&amp;amp;feature=youtu.be Video] demo of trained neural network. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/fjbriones/pix2code2 pix2code2]&lt;br /&gt;
: An attempt to improve pix2code through the use of autoencoders between the two LSTM layers.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emilwallner/Screenshot-to-code Screenshot-to-code]&lt;br /&gt;
: Another version of pix2code with a Bootstrap version that converts web page screenshots to HTML, with the potential to generalize on new design mock-ups. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/andrewsoohwanlee/pix2code-pytorch pix2code PyTorch]&lt;br /&gt;
: pix2code implemented in PyTorch, also not ready for general usage yet.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ngundotra/code2pix code2pix]&lt;br /&gt;
: A project to recreate an inverse architecture to pix2code, with the objective of creating a GAN (Generative Adversarial Network) to replace pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/aditya-grover/node2vec node2Vec]&lt;br /&gt;
: Github repo that contains reference implementation of node2vec algorithm as a python module. See above node2vec paper.&lt;br /&gt;
: A [https://github.com/thunlp/OpenNE toolkit] containing node2vec implemented in a framework based on tensorflow&lt;br /&gt;
&lt;br /&gt;
* [https://networkx.github.io/documentation/stable/index.html NetworkX]&lt;br /&gt;
: NetworkX is a Python package for loading, visualizing, and processing graph data. Includes built in functions for DFS encoding, and constructing adjacency and edges to vertices matrices. &lt;br /&gt;
&lt;br /&gt;
*[https://radimrehurek.com/gensim/ Gensim]&lt;br /&gt;
: Gensim is a Python library used to analyze plain-text documents for semantic structure. Is required for node2vec.&lt;br /&gt;
&lt;br /&gt;
* [http://www.numpy.org/ NumPy]&lt;br /&gt;
: NumPy is a computing package that includes a N-dimensional array object (useful in encoding) and many other functions to process data. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DSL Development ===&lt;br /&gt;
&lt;br /&gt;
* [http://hackage.haskell.org/package/lucid Lucid]&lt;br /&gt;
: Lucid is a DSL implemented with Haskell for writing HTML. It represents DOM elements as functions, and uses specific notation to differentiate between data elements and code elements. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [https://keras.io/ Keras]&lt;br /&gt;
: In conjunction with tensorflow, Keras will support the deep learning components of the project. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ziyan/spider SVM Classifier Training Algorithm ]&lt;br /&gt;
: From the Yao, Zuo paper, this Github repo contains an algorithm for labelling the collected dataset using clustering, training the SVM with the labeled dataset, and using SVM model to extract content from new webpages. Implemented in JavaScript, CoffeeScript, and Python.&lt;br /&gt;
&lt;br /&gt;
* [https://www.h5py.org/ H5PY]&lt;br /&gt;
: The h5py package can be used to store large amounts of numerical data, and integrates well with NumPy&lt;br /&gt;
&lt;br /&gt;
=== Useful tutorials ===&lt;br /&gt;
: Since we will be using a two-layer LSTMs in tensorflow, this [https://medium.com/@erikhallstrm/using-the-tensorflow-multilayered-lstm-api-f6e7da7bbe40 article] might be useful.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Model ===&lt;br /&gt;
: Here is a visualization of the model that we might want to use for our extractor&lt;br /&gt;
[[File: Extractor-Model.png| first diagram of extractor model]]&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25374</id>
		<title>LP Extractor Protocol</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25374"/>
		<updated>2019-04-18T20:51:13Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=LP Extractor Protocol&lt;br /&gt;
|Has owner=Lasya Rajan,&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;The [[LP Extractor Protocol]] currently envisages marking data locations on webpages, converting webpages into a simplified Domain Specific Language (DSL), and then encoding the DSL into a matrix. The markings of data locations would be encoded into a companion matrix. Both matrices will then be fed into a neural network, which is trained to produce the markings given the DSL. To date, we have conducted a literature review that has found papers describing similar &amp;quot;paired input&amp;quot; networks, and are in the process refining our understanding of the pre-existing code and work related to each step.&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files location:&lt;br /&gt;
 E:\projects\Kauffman Incubator Project\03 Automate the extraction of information\RajanLasya_ExtractionProtocols_03.21&lt;br /&gt;
&lt;br /&gt;
==Proposed Method==&lt;br /&gt;
&lt;br /&gt;
According to “Project Goal V2,” (E:\mcnair\Projects\Incubators) we considered  three broadly defined methods to organize and extract useful information from an HTML web page. The first method is text processing, analyzing and classifying the textual content of the HTML page. The second method is to use image based pattern recognition, likely through an off-the-shelf model that can extrapolate key HTML elements from web page screenshots. The third, and most novel method is to structurally analyze the HTML tree structure, and express that simplified HTML structure in a Domain Specific Language (DSL). We are currently pursuing this third method.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
Structurally analyzing the HTML tree structure of a web page and expressing it in a DSL is the most innovative method of the three. It would require more than simply adapting off-the-shelf models. First, the DSL itself would need to be designed to optimize abstraction into the target domain, a web page. (See [[Domain Specific Language Research]].) Then, the DSL would need to be integrated into the machine learning pipeline by encoding the DSL into an appropriately formatted input, such as a vector or matrix, for a neural network. Three proposed methods for this encoding are using an adjacency matrix, an edges to vertices matrix, or utilizing DFS (depth-first search) algorithms. &lt;br /&gt;
&lt;br /&gt;
==== DFS Encoding ====&lt;br /&gt;
&lt;br /&gt;
Currently, we are leaning towards utilizing DFS algorithms. DFS algorithms operate by starting at the root node (or an arbitrary node for a graph) and traverses the longest branch fully before backtracking back to the last split before the branch terminated. A DFS algorithm could traverse any given tree and record 1 when a new node is found, and 0 when that node is fully explored. This creates a numerical representation of that tree that can then be entered into a vector or matrix. A DFS algorithm has an efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Adjacency Matrix ====&lt;br /&gt;
&lt;br /&gt;
By interpreting the tree as a graph, we can utilize an adjacency matrix to encode the tree. The elements of the matrix represent whether their corresponding vertices are adjacent in the graphical representation. In its simplest form, for a set of V number of vertices, the matrix would be a square matrix of dimensions |V| x |V|. The diagonal elements of such a matrix would all be zero. This approach has an algorithmic efficiency of O(n^2).&lt;br /&gt;
&lt;br /&gt;
==== Edges to Vertices Matrix ====&lt;br /&gt;
&lt;br /&gt;
For any given tree, we have n-1 (I'm assuming n = number of nodes) edges. For every edge, we can record the two ending vertices. This will result in a matrix of dimensions (n-1) x 2. This matrix approach has an algorithmic efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Supervised Learning Approach (HTML to DSL) ====&lt;br /&gt;
&lt;br /&gt;
Additionally, the HTML tree structure analysis method will require a subprocess by which to parse a complex HTML page into our DSL. An example of a similar process is Pix2Code, in which a DSL context and a GUI are feed into an architecture containing Long Short-Term Memory (LSTM) layers and a CNN-based vision model (see image below) which outputs a DSL token. After training with paired inputs is complete, this architecture can then take an empty context and a GUI input and output DSL code. &lt;br /&gt;
&lt;br /&gt;
[[File:Pix2code.png|thumb|center|upright=3|Image from &amp;quot;Project Goal V2&amp;quot; of Pix2Code architecture]]&lt;br /&gt;
&lt;br /&gt;
==Literature==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1705.07962 Pix2Code (Beltramelli)] &lt;br /&gt;
:This is the documentation for the Pix2Code architecture mentioned. &lt;br /&gt;
&lt;br /&gt;
* [https://pdfs.semanticscholar.org/a47e/e762b9c1f9d6876928a909623ebf4d0d3218.pdf Trend of Supervised Web Data Extraction (Martono, Azhari, Mustafa)]&lt;br /&gt;
:This article provides an overview of various web data extraction techniques. Section 2.2 describes a process of extracting a web page's DOM structure, and Section 2.3 includes a supervised extraction process that has some similar aspects to Pix2Code and other paired input architectures.&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/ZhouMashuq-WebContentExtractionThroughMachineLearning.pdf Web Content Extraction Through Machine Learning (Zhou, Mashuq)]&lt;br /&gt;
:This approach to web content extraction focuses exclusively on less structured web pages, and classifying text blocks within those pages. In Section 3: Data Collection, an algorithm written in JavaScript is used to inspect DOM elements and organize them by parent element. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1207.0246 Web Data Extraction, Applications and Techniques: A Survey (Ferrara et al.)]&lt;br /&gt;
: This survey of various web data extraction methods includes a section on tree-based analysis in Chapter 2: Techniques.&lt;br /&gt;
&lt;br /&gt;
*[https://arxiv.org/abs/1210.6113 Using the DOM Tree for Content Extraction (Lopez, Silva, Insa)]&lt;br /&gt;
: This paper presents a method of content extraction that analyzes the relationships between DOM elements based on a &amp;quot;chars-node ratio&amp;quot; that displays the relationship between text content and tags content in each node of the DOM tree. The authors of this paper implemented this technique in an open-source Firefox plugin. &lt;br /&gt;
&lt;br /&gt;
*[https://dl.acm.org/citation.cfm?id=775182 DOM-based Content Extraction of HTML Documents (Gupta et al.)]&lt;br /&gt;
: The approach delineated in this article parses HTML documents into DOM trees using openXML. Then, a recursive content extractor process each DOM tree and removes any non-content nodes. &lt;br /&gt;
&lt;br /&gt;
*[https://link.springer.com/chapter/10.1007/3-540-36901-5_42 Extracting Content Structure for Web Pages Based On Visual Representation (Cai et al.)]&lt;br /&gt;
: This paper proposes a Vision-based Page Segmentation (VIPS) algorithm that creates an extracted content structure, with each node of the structure corresponding to a block of coherent content on the page. Although this method focuses on semantically dividing the page, the algorithm uses page layout features to detect the page's structure.&lt;br /&gt;
&lt;br /&gt;
*[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.642.6155&amp;amp;rep=rep1&amp;amp;type=pdf A Survey on HTML Structure Aware and Tree Based Web Data Scraping Technique (Kadam, Pakle)]&lt;br /&gt;
: This article surveys eleven existing web extraction tools that utilize DOM structure to pull out relevant information. Some of these tools rely solely on the DOM tree, while others combine visual features with the DOM tree to extract content. &lt;br /&gt;
&lt;br /&gt;
*[https://ieeexplore.ieee.org/abstract/document/4376990 Layout Based Information Extraction from HTML Documents (Burget)]&lt;br /&gt;
: This paper articulates a method that uses visual information, rather than DOM tree structure, to extract information from a webpage. Although this is a different method from our proposed DOM-based approach, the page segmentation algorithm in Section 5 (Page Segmentation Algorithm) includes various factors that may be useful in our simplified HTML/DSL interpretation of the DOM tree structure.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1709.05584 Representation Learning on Graphs: Methods and Application (Hamilton, Ying, Leskovec)]&lt;br /&gt;
: This paper discusses different methods of encoding graph structures into low-dimensional embeddings that can be exploited by machine learning models. Section 2.2.2 (Random walk approaches) specifically compares the accuracy of using the random walk approach to traverse a graph, as opposed to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1607.00653 node2vec: Scalable Feature Learning for Networks (Grover, Leskovec)]&lt;br /&gt;
: node2vec was mentioned briefly in the above Hamilton et al. paper. node2vec is a scalable encoding algorithm that focuses on preserving network neighborhoods of nodes. The definition of a neighborhood can manipulated depending on the application context. In section 3.1 (Classic Search Strategies), node2vec is compared to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [http://www.ece.iastate.edu/snt/files/2018/03/v2v-graml18.pdf V2V: Vector Embedding of Graph and Applications (Nguyen, Tirthapura)]&lt;br /&gt;
: V2V (Vector to Vertex) is a learning approach similar to node2vec, except that it takes the random-walk sequence results from graph data and encodes them using a Continous Bag of Word (CBOW) approach to create V2V vectors. &lt;br /&gt;
&lt;br /&gt;
* [https://openreview.net/pdf?id=BkSqjHqxg Skip-Graph: Learning Graph Embeddings with an Encoder-Decoder Model (Lee, Kong)]&lt;br /&gt;
: This paper explains how to apply the skip-gram model to learning node representations of graph-structured data. This new encoder-decoder model can be trained to generate representations for any arbitrary random walk sequence. &lt;br /&gt;
&lt;br /&gt;
* [https://www.kdd.org/kdd2018/files/deep-learning-day/DLDay18_paper_27.pdf Learning Graph Representations with Recurrent Neural Network Autoencoders (Taheri, Gimpel, Berger-Wolf)]&lt;br /&gt;
: In a similar process to other neural network encoders, this proposed architecture first generates sequential data from graphs, using BFS shortest path, and random walk algorithms. It then trains LSTM autoencoders to embed these graph sequences into a vector space. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1805.07683 Learning Graph Representations with Recurrent Neural Networks (Jin, JaJa)]&lt;br /&gt;
:This article describes another approach to learning graph-level representations, except through a combination of supervised and unsupervised learning components. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/YaoZuo-AMachineLearningApproachToWebpageContentExtraction.pdf A Machine Learning Approach to Webpage Content Extraction (Yao, Zuo)]&lt;br /&gt;
: This article describes methods to simplify the content of a noisy HTML page, specifically through using machine learning to predict whether a block is content or non-content. This allows the classifier to remove boilerplate information.&lt;br /&gt;
&lt;br /&gt;
* [https://dl.acm.org/citation.cfm?id=565137 A Brief Survey of Web Data Extraction Tools (Laender et al.)]&lt;br /&gt;
: This article classifies various web data extraction techniques into 5 different types of tools, and one category of web extraction specific-languages. Section 3.2 (HTML-aware Tools) describes several existing tools for parsing HTML tree structures in building wrappers. Section 3.4 (NLP-based Tools) includes several methods of text analysis that may be relevant to this project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
This section contains possible implementation libraries and tools for various components of the extractor.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.crummy.com/software/BeautifulSoup/bs4/doc/ Beautiful Soup]&lt;br /&gt;
: A simple Python library that can parse HTML files into &amp;quot;Beautiful Soup objects,&amp;quot; which are basically tree structure objects. Likely too limited in functionality for automated extraction, but might be useful in developing/testing DSL.&lt;br /&gt;
&lt;br /&gt;
*[https://docs.scrapy.org/en/latest/index.html Scrapy]&lt;br /&gt;
: Similar to Beautiful Soup, but has more extensive and efficient functionality. Extracts HTML data by creating &amp;quot;selectors&amp;quot; specified by CSS or XPath expressions. &lt;br /&gt;
&lt;br /&gt;
==== pix2code ====&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tonybeltramelli/pix2code pix2Code]&lt;br /&gt;
: Github repo that contains original reference implementation of pix2code architecture. See above pix2code paper. [https://www.youtube.com/watch?v=pqKeXkhFA3I&amp;amp;feature=youtu.be Video] demo of trained neural network. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/fjbriones/pix2code2 pix2code2]&lt;br /&gt;
: An attempt to improve pix2code through the use of autoencoders between the two LSTM layers.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emilwallner/Screenshot-to-code Screenshot-to-code]&lt;br /&gt;
: Another version of pix2code with a Bootstrap version that converts web page screenshots to HTML, with the potential to generalize on new design mock-ups. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/andrewsoohwanlee/pix2code-pytorch pix2code PyTorch]&lt;br /&gt;
: pix2code implemented in PyTorch, also not ready for general usage yet.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ngundotra/code2pix code2pix]&lt;br /&gt;
: A project to recreate an inverse architecture to pix2code, with the objective of creating a GAN (Generative Adversarial Network) to replace pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/aditya-grover/node2vec node2Vec]&lt;br /&gt;
: Github repo that contains reference implementation of node2vec algorithm as a python module. See above node2vec paper.&lt;br /&gt;
: A [https://github.com/thunlp/OpenNE toolkit] containing node2vec implemented in a framework based on tensorflow&lt;br /&gt;
&lt;br /&gt;
* [https://networkx.github.io/documentation/stable/index.html NetworkX]&lt;br /&gt;
: NetworkX is a Python package for loading, visualizing, and processing graph data. Includes built in functions for DFS encoding, and constructing adjacency and edges to vertices matrices. &lt;br /&gt;
&lt;br /&gt;
*[https://radimrehurek.com/gensim/ Gensim]&lt;br /&gt;
: Gensim is a Python library used to analyze plain-text documents for semantic structure. Is required for node2vec.&lt;br /&gt;
&lt;br /&gt;
* [http://www.numpy.org/ NumPy]&lt;br /&gt;
: NumPy is a computing package that includes a N-dimensional array object (useful in encoding) and many other functions to process data. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DSL Development ===&lt;br /&gt;
&lt;br /&gt;
* [http://hackage.haskell.org/package/lucid Lucid]&lt;br /&gt;
: Lucid is a DSL implemented with Haskell for writing HTML. It represents DOM elements as functions, and uses specific notation to differentiate between data elements and code elements. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [https://keras.io/ Keras]&lt;br /&gt;
: In conjunction with tensorflow, Keras will support the deep learning components of the project. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ziyan/spider SVM Classifier Training Algorithm ]&lt;br /&gt;
: From the Yao, Zuo paper, this Github repo contains an algorithm for labelling the collected dataset using clustering, training the SVM with the labeled dataset, and using SVM model to extract content from new webpages. Implemented in JavaScript, CoffeeScript, and Python.&lt;br /&gt;
&lt;br /&gt;
* [https://www.h5py.org/ H5PY]&lt;br /&gt;
: The h5py package can be used to store large amounts of numerical data, and integrates well with NumPy&lt;br /&gt;
&lt;br /&gt;
=== Useful tutorials ===&lt;br /&gt;
: Since we will be using a two-layer LSTMs in tensorflow, this [https://medium.com/@erikhallstrm/using-the-tensorflow-multilayered-lstm-api-f6e7da7bbe40 article] might be useful.&lt;br /&gt;
&lt;br /&gt;
=== Proposed Model ===&lt;br /&gt;
: Here is a visualization of the model what we might want to use for our extractor&lt;br /&gt;
[[File: Extractor-Model.png| first diagram of extractor model]]&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=File:Extractor-Model.png&amp;diff=25373</id>
		<title>File:Extractor-Model.png</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=File:Extractor-Model.png&amp;diff=25373"/>
		<updated>2019-04-18T20:48:51Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25356</id>
		<title>LP Extractor Protocol</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=LP_Extractor_Protocol&amp;diff=25356"/>
		<updated>2019-04-18T05:37:07Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=LP Extractor Protocol&lt;br /&gt;
|Has owner=Lasya Rajan,&lt;br /&gt;
|Has project status=Active&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
&amp;lt;onlyinclude&amp;gt;The [[LP Extractor Protocol]] currently envisages marking data locations on webpages, converting webpages into a simplified Domain Specific Language (DSL), and then encoding the DSL into a matrix. The markings of data locations would be encoded into a companion matrix. Both matrices will then be fed into a neural network, which is trained to produce the markings given the DSL. To date, we have conducted a literature review that has found papers describing similar &amp;quot;paired input&amp;quot; networks, and are in the process refining our understanding of the pre-existing code and work related to each step.&amp;lt;/onlyinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files location:&lt;br /&gt;
 E:\projects\Kauffman Incubator Project\03 Automate the extraction of information\RajanLasya_ExtractionProtocols_03.21&lt;br /&gt;
&lt;br /&gt;
==Proposed Method==&lt;br /&gt;
&lt;br /&gt;
According to “Project Goal V2,” (E:\mcnair\Projects\Incubators) we considered  three broadly defined methods to organize and extract useful information from an HTML web page. The first method is text processing, analyzing and classifying the textual content of the HTML page. The second method is to use image based pattern recognition, likely through an off-the-shelf model that can extrapolate key HTML elements from web page screenshots. The third, and most novel method is to structurally analyze the HTML tree structure, and express that simplified HTML structure in a Domain Specific Language (DSL). We are currently pursuing this third method.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
Structurally analyzing the HTML tree structure of a web page and expressing it in a DSL is the most innovative method of the three. It would require more than simply adapting off-the-shelf models. First, the DSL itself would need to be designed to optimize abstraction into the target domain, a web page. (See [[Domain Specific Language Research]].) Then, the DSL would need to be integrated into the machine learning pipeline by encoding the DSL into an appropriately formatted input, such as a vector or matrix, for a neural network. Three proposed methods for this encoding are using an adjacency matrix, an edges to vertices matrix, or utilizing DFS (depth-first search) algorithms. &lt;br /&gt;
&lt;br /&gt;
==== DFS Encoding ====&lt;br /&gt;
&lt;br /&gt;
Currently, we are leaning towards utilizing DFS algorithms. DFS algorithms operate by starting at the root node (or an arbitrary node for a graph) and traverses the longest branch fully before backtracking back to the last split before the branch terminated. A DFS algorithm could traverse any given tree and record 1 when a new node is found, and 0 when that node is fully explored. This creates a numerical representation of that tree that can then be entered into a vector or matrix. A DFS algorithm has an efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Adjacency Matrix ====&lt;br /&gt;
&lt;br /&gt;
By interpreting the tree as a graph, we can utilize an adjacency matrix to encode the tree. The elements of the matrix represent whether their corresponding vertices are adjacent in the graphical representation. In its simplest form, for a set of V number of vertices, the matrix would be a square matrix of dimensions |V| x |V|. The diagonal elements of such a matrix would all be zero. This approach has an algorithmic efficiency of O(n^2).&lt;br /&gt;
&lt;br /&gt;
==== Edges to Vertices Matrix ====&lt;br /&gt;
&lt;br /&gt;
For any given tree, we have n-1 (I'm assuming n = number of nodes) edges. For every edge, we can record the two ending vertices. This will result in a matrix of dimensions (n-1) x 2. This matrix approach has an algorithmic efficiency of O(n). &lt;br /&gt;
&lt;br /&gt;
==== Supervised Learning Approach (HTML to DSL) ====&lt;br /&gt;
&lt;br /&gt;
Additionally, the HTML tree structure analysis method will require a subprocess by which to parse a complex HTML page into our DSL. An example of a similar process is Pix2Code, in which a DSL context and a GUI are feed into an architecture containing Long Short-Term Memory (LSTM) layers and a CNN-based vision model (see image below) which outputs a DSL token. After training with paired inputs is complete, this architecture can then take an empty context and a GUI input and output DSL code. &lt;br /&gt;
&lt;br /&gt;
[[File:Pix2code.png|thumb|center|upright=3|Image from &amp;quot;Project Goal V2&amp;quot; of Pix2Code architecture]]&lt;br /&gt;
&lt;br /&gt;
==Literature==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1705.07962 Pix2Code (Beltramelli)] &lt;br /&gt;
:This is the documentation for the Pix2Code architecture mentioned. &lt;br /&gt;
&lt;br /&gt;
* [https://pdfs.semanticscholar.org/a47e/e762b9c1f9d6876928a909623ebf4d0d3218.pdf Trend of Supervised Web Data Extraction (Martono, Azhari, Mustafa)]&lt;br /&gt;
:This article provides an overview of various web data extraction techniques. Section 2.2 describes a process of extracting a web page's DOM structure, and Section 2.3 includes a supervised extraction process that has some similar aspects to Pix2Code and other paired input architectures.&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/ZhouMashuq-WebContentExtractionThroughMachineLearning.pdf Web Content Extraction Through Machine Learning (Zhou, Mashuq)]&lt;br /&gt;
:This approach to web content extraction focuses exclusively on less structured web pages, and classifying text blocks within those pages. In Section 3: Data Collection, an algorithm written in JavaScript is used to inspect DOM elements and organize them by parent element. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1207.0246 Web Data Extraction, Applications and Techniques: A Survey (Ferrara et al.)]&lt;br /&gt;
: This survey of various web data extraction methods includes a section on tree-based analysis in Chapter 2: Techniques.&lt;br /&gt;
&lt;br /&gt;
*[https://arxiv.org/abs/1210.6113 Using the DOM Tree for Content Extraction (Lopez, Silva, Insa)]&lt;br /&gt;
: This paper presents a method of content extraction that analyzes the relationships between DOM elements based on a &amp;quot;chars-node ratio&amp;quot; that displays the relationship between text content and tags content in each node of the DOM tree. The authors of this paper implemented this technique in an open-source Firefox plugin. &lt;br /&gt;
&lt;br /&gt;
*[https://dl.acm.org/citation.cfm?id=775182 DOM-based Content Extraction of HTML Documents (Gupta et al.)]&lt;br /&gt;
: The approach delineated in this article parses HTML documents into DOM trees using openXML. Then, a recursive content extractor process each DOM tree and removes any non-content nodes. &lt;br /&gt;
&lt;br /&gt;
*[https://link.springer.com/chapter/10.1007/3-540-36901-5_42 Extracting Content Structure for Web Pages Based On Visual Representation (Cai et al.)]&lt;br /&gt;
: This paper proposes a Vision-based Page Segmentation (VIPS) algorithm that creates an extracted content structure, with each node of the structure corresponding to a block of coherent content on the page. Although this method focuses on semantically dividing the page, the algorithm uses page layout features to detect the page's structure.&lt;br /&gt;
&lt;br /&gt;
*[http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.642.6155&amp;amp;rep=rep1&amp;amp;type=pdf A Survey on HTML Structure Aware and Tree Based Web Data Scraping Technique (Kadam, Pakle)]&lt;br /&gt;
: This article surveys eleven existing web extraction tools that utilize DOM structure to pull out relevant information. Some of these tools rely solely on the DOM tree, while others combine visual features with the DOM tree to extract content. &lt;br /&gt;
&lt;br /&gt;
*[https://ieeexplore.ieee.org/abstract/document/4376990 Layout Based Information Extraction from HTML Documents (Burget)]&lt;br /&gt;
: This paper articulates a method that uses visual information, rather than DOM tree structure, to extract information from a webpage. Although this is a different method from our proposed DOM-based approach, the page segmentation algorithm in Section 5 (Page Segmentation Algorithm) includes various factors that may be useful in our simplified HTML/DSL interpretation of the DOM tree structure.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1709.05584 Representation Learning on Graphs: Methods and Application (Hamilton, Ying, Leskovec)]&lt;br /&gt;
: This paper discusses different methods of encoding graph structures into low-dimensional embeddings that can be exploited by machine learning models. Section 2.2.2 (Random walk approaches) specifically compares the accuracy of using the random walk approach to traverse a graph, as opposed to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1607.00653 node2vec: Scalable Feature Learning for Networks (Grover, Leskovec)]&lt;br /&gt;
: node2vec was mentioned briefly in the above Hamilton et al. paper. node2vec is a scalable encoding algorithm that focuses on preserving network neighborhoods of nodes. The definition of a neighborhood can manipulated depending on the application context. In section 3.1 (Classic Search Strategies), node2vec is compared to BFS and DFS approaches. &lt;br /&gt;
&lt;br /&gt;
* [http://www.ece.iastate.edu/snt/files/2018/03/v2v-graml18.pdf V2V: Vector Embedding of Graph and Applications (Nguyen, Tirthapura)]&lt;br /&gt;
: V2V (Vector to Vertex) is a learning approach similar to node2vec, except that it takes the random-walk sequence results from graph data and encodes them using a Continous Bag of Word (CBOW) approach to create V2V vectors. &lt;br /&gt;
&lt;br /&gt;
* [https://openreview.net/pdf?id=BkSqjHqxg Skip-Graph: Learning Graph Embeddings with an Encoder-Decoder Model (Lee, Kong)]&lt;br /&gt;
: This paper explains how to apply the skip-gram model to learning node representations of graph-structured data. This new encoder-decoder model can be trained to generate representations for any arbitrary random walk sequence. &lt;br /&gt;
&lt;br /&gt;
* [https://www.kdd.org/kdd2018/files/deep-learning-day/DLDay18_paper_27.pdf Learning Graph Representations with Recurrent Neural Network Autoencoders (Taheri, Gimpel, Berger-Wolf)]&lt;br /&gt;
: In a similar process to other neural network encoders, this proposed architecture first generates sequential data from graphs, using BFS shortest path, and random walk algorithms. It then trains LSTM autoencoders to embed these graph sequences into a vector space. &lt;br /&gt;
&lt;br /&gt;
* [https://arxiv.org/abs/1805.07683 Learning Graph Representations with Recurrent Neural Networks (Jin, JaJa)]&lt;br /&gt;
:This article describes another approach to learning graph-level representations, except through a combination of supervised and unsupervised learning components. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [http://cs229.stanford.edu/proj2013/YaoZuo-AMachineLearningApproachToWebpageContentExtraction.pdf A Machine Learning Approach to Webpage Content Extraction (Yao, Zuo)]&lt;br /&gt;
: This article describes methods to simplify the content of a noisy HTML page, specifically through using machine learning to predict whether a block is content or non-content. This allows the classifier to remove boilerplate information.&lt;br /&gt;
&lt;br /&gt;
* [https://dl.acm.org/citation.cfm?id=565137 A Brief Survey of Web Data Extraction Tools (Laender et al.)]&lt;br /&gt;
: This article classifies various web data extraction techniques into 5 different types of tools, and one category of web extraction specific-languages. Section 3.2 (HTML-aware Tools) describes several existing tools for parsing HTML tree structures in building wrappers. Section 3.4 (NLP-based Tools) includes several methods of text analysis that may be relevant to this project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
This section contains possible implementation libraries and tools for various components of the extractor.&lt;br /&gt;
&lt;br /&gt;
=== HTML Tree Structure Analysis ===&lt;br /&gt;
&lt;br /&gt;
* [https://www.crummy.com/software/BeautifulSoup/bs4/doc/ Beautiful Soup]&lt;br /&gt;
: A simple Python library that can parse HTML files into &amp;quot;Beautiful Soup objects,&amp;quot; which are basically tree structure objects. Likely too limited in functionality for automated extraction, but might be useful in developing/testing DSL.&lt;br /&gt;
&lt;br /&gt;
*[https://docs.scrapy.org/en/latest/index.html Scrapy]&lt;br /&gt;
: Similar to Beautiful Soup, but has more extensive and efficient functionality. Extracts HTML data by creating &amp;quot;selectors&amp;quot; specified by CSS or XPath expressions. &lt;br /&gt;
&lt;br /&gt;
==== pix2code ====&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/tonybeltramelli/pix2code pix2Code]&lt;br /&gt;
: Github repo that contains original reference implementation of pix2code architecture. See above pix2code paper. [https://www.youtube.com/watch?v=pqKeXkhFA3I&amp;amp;feature=youtu.be Video] demo of trained neural network. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/fjbriones/pix2code2 pix2code2]&lt;br /&gt;
: An attempt to improve pix2code through the use of autoencoders between the two LSTM layers.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/emilwallner/Screenshot-to-code Screenshot-to-code]&lt;br /&gt;
: Another version of pix2code with a Bootstrap version that converts web page screenshots to HTML, with the potential to generalize on new design mock-ups. &lt;br /&gt;
&lt;br /&gt;
* [https://github.com/andrewsoohwanlee/pix2code-pytorch pix2code PyTorch]&lt;br /&gt;
: pix2code implemented in PyTorch, also not ready for general usage yet.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ngundotra/code2pix code2pix]&lt;br /&gt;
: A project to recreate an inverse architecture to pix2code, with the objective of creating a GAN (Generative Adversarial Network) to replace pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DFS Encoding ===&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/aditya-grover/node2vec node2Vec]&lt;br /&gt;
: Github repo that contains reference implementation of node2vec algorithm as a python module. See above node2vec paper.&lt;br /&gt;
: A [https://github.com/thunlp/OpenNE toolkit] containing node2vec implemented in a framework based on tensorflow&lt;br /&gt;
&lt;br /&gt;
* [https://networkx.github.io/documentation/stable/index.html NetworkX]&lt;br /&gt;
: NetworkX is a Python package for loading, visualizing, and processing graph data. Includes built in functions for DFS encoding, and constructing adjacency and edges to vertices matrices. &lt;br /&gt;
&lt;br /&gt;
*[https://radimrehurek.com/gensim/ Gensim]&lt;br /&gt;
: Gensim is a Python library used to analyze plain-text documents for semantic structure. Is required for node2vec.&lt;br /&gt;
&lt;br /&gt;
* [http://www.numpy.org/ NumPy]&lt;br /&gt;
: NumPy is a computing package that includes a N-dimensional array object (useful in encoding) and many other functions to process data. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
=== DSL Development ===&lt;br /&gt;
&lt;br /&gt;
* [http://hackage.haskell.org/package/lucid Lucid]&lt;br /&gt;
: Lucid is a DSL implemented with Haskell for writing HTML. It represents DOM elements as functions, and uses specific notation to differentiate between data elements and code elements. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General ===&lt;br /&gt;
&lt;br /&gt;
* [https://keras.io/ Keras]&lt;br /&gt;
: In conjunction with tensorflow, Keras will support the deep learning components of the project. Is required for pix2code.&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/ziyan/spider SVM Classifier Training Algorithm ]&lt;br /&gt;
: From the Yao, Zuo paper, this Github repo contains an algorithm for labelling the collected dataset using clustering, training the SVM with the labeled dataset, and using SVM model to extract content from new webpages. Implemented in JavaScript, CoffeeScript, and Python.&lt;br /&gt;
&lt;br /&gt;
* [https://www.h5py.org/ H5PY]&lt;br /&gt;
: The h5py package can be used to store large amounts of numerical data, and integrates well with NumPy&lt;br /&gt;
&lt;br /&gt;
=== Useful tutorials ===&lt;br /&gt;
: Since we will be using a two-layer LSTMs in tensorflow, this [https://medium.com/@erikhallstrm/using-the-tensorflow-multilayered-lstm-api-f6e7da7bbe40 article] might be useful.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25304</id>
		<title>GPU fix</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25304"/>
		<updated>2019-04-16T18:14:49Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Fixing the GPU on the RDP (Aprl 2019)==&lt;br /&gt;
&lt;br /&gt;
At the time of writing, CUDA and tensorflow cannot connect to our GPU. This can be verified by opening python3 and type&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 tf.test.is_gpu_available()&lt;br /&gt;
&lt;br /&gt;
In addition, GeForce Experience and NVIDIA control panel do not work right now.&lt;br /&gt;
&lt;br /&gt;
Hiep has checked GPU driver by going to device manager -&amp;gt; Display adapter -&amp;gt; RTX Titan -&amp;gt; Properties -&amp;gt; Driver -&amp;gt; Update Driver. However, nothing new is installed since the current driver is already up-to-date.&lt;br /&gt;
&lt;br /&gt;
Hiep has also restarted several NVIDIA services by opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA services -&amp;gt; clicked on restart. However, it still cannot resolve the issue.&lt;br /&gt;
&lt;br /&gt;
Since Geforce Experience cannot be opened, Hiep has followed a solution from NVIDIA forum, which is opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA service -&amp;gt; Under nvidia telemetry container -&amp;gt; Choose Log on -&amp;gt; Check Log on as Local System Account.&lt;br /&gt;
&lt;br /&gt;
However, none of the above approaches actually resolved the issue. Reinstalling NVIDIA software might be necessary.&lt;br /&gt;
&lt;br /&gt;
The error we have while opening GeForce experience is &lt;br /&gt;
 The code execution cannot proceed because wlanapi.dll was not found. Reinstalling the program may fix this problem.&lt;br /&gt;
&lt;br /&gt;
However, after re-downloading and re-installing GeForce experience, the error does not go away.&lt;br /&gt;
&lt;br /&gt;
According to this [https://www.lifewire.com/how-to-fix-wlanapi-dll-not-found-or-missing-errors-2624238 article], adding a featured called Wireless LAN service may fix the problem.&lt;br /&gt;
&lt;br /&gt;
In addition, the computer cannot find the GPU when we type 'dxdiag' in the cmd prompt. This may be a driver-related issue and this [http://www.bsocialshine.com/2016/06/how-to-fix-all-dll-file-missing-error.html article] suggests that installing 'Directx end user runtime web installer' will fix the problem.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25294</id>
		<title>GPU fix</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25294"/>
		<updated>2019-04-16T17:54:27Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Fixing the GPU on the RDP (Aprl 2019)==&lt;br /&gt;
&lt;br /&gt;
At the time of writing, CUDA and tensorflow cannot connect to our GPU. This can be verified by opening python3 and type&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 tf.test.is_gpu_available()&lt;br /&gt;
&lt;br /&gt;
In addition, GeForce Experience and NVIDIA control panel do not work right now.&lt;br /&gt;
&lt;br /&gt;
Hiep has checked GPU driver by going to device manager -&amp;gt; Display adapter -&amp;gt; RTX Titan -&amp;gt; Properties -&amp;gt; Driver -&amp;gt; Update Driver. However, nothing new is installed since the current driver is already up-to-date.&lt;br /&gt;
&lt;br /&gt;
Hiep has also restarted several NVIDIA services by opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA services -&amp;gt; clicked on restart. However, it still cannot resolve the issue.&lt;br /&gt;
&lt;br /&gt;
Since Geforce Experience cannot be opened, Hiep has followed a solution from NVIDIA forum, which is opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA service -&amp;gt; Under nvidia telemetry container -&amp;gt; Choose Log on -&amp;gt; Check Log on as Local System Account.&lt;br /&gt;
&lt;br /&gt;
However, none of the above approaches actually resolved the issue. Reinstalling NVIDIA software might be necessary.&lt;br /&gt;
&lt;br /&gt;
The error we have while opening GeForce experience is &lt;br /&gt;
 The code execution cannot proceed because wlanapi.dll was not found. Reinstalling the program may fix this problem.&lt;br /&gt;
&lt;br /&gt;
According to this [https://www.lifewire.com/how-to-fix-wlanapi-dll-not-found-or-missing-errors-2624238 article], adding a featured called Wireless LAN service may fix the problem.&lt;br /&gt;
&lt;br /&gt;
In addition, the computer cannot find the GPU when we type 'dxdiag' in the cmd prompt. This may be a driver-related issue and this [http://www.bsocialshine.com/2016/06/how-to-fix-all-dll-file-missing-error.html article] suggests that installing 'Directx end user runtime web installer' will fix the problem.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25264</id>
		<title>GPU fix</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25264"/>
		<updated>2019-04-15T16:06:40Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Fixing the GPU on the RDP (Aprl 2019)==&lt;br /&gt;
&lt;br /&gt;
At the time of writing, CUDA and tensorflow cannot connect to our GPU. This can be verified by opening python3 and type&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 tf.test.is_gpu_available()&lt;br /&gt;
&lt;br /&gt;
In addition, GeForce Experience and NVIDIA control panel do not work right now.&lt;br /&gt;
&lt;br /&gt;
Hiep has checked GPU driver by going to device manager -&amp;gt; Display adapter -&amp;gt; RTX Titan -&amp;gt; Properties -&amp;gt; Driver -&amp;gt; Update Driver. However, nothing new is installed since the current driver is already up-to-date.&lt;br /&gt;
&lt;br /&gt;
Hiep has also restarted several NVIDIA services by opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA services -&amp;gt; clicked on restart. However, it still cannot resolve the issue.&lt;br /&gt;
&lt;br /&gt;
Since Geforce Experience cannot be opened, Hiep has followed a solution from NVIDIA forum, which is opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA service -&amp;gt; Under nvidia telemetry container -&amp;gt; Choose Log on -&amp;gt; Check Log on as Local System Account.&lt;br /&gt;
&lt;br /&gt;
However, none of the above approaches actually resolved the issue. Reinstalling NVIDIA software might be necessary.&lt;br /&gt;
&lt;br /&gt;
The error we have while opening GeForce experience is &lt;br /&gt;
 The code execution cannot proceed because wlanapi.dll was not found. Reinstalling the program may fix this problem.&lt;br /&gt;
&lt;br /&gt;
According to this [https://www.lifewire.com/how-to-fix-wlanapi-dll-not-found-or-missing-errors-2624238 article], adding a featured called Wireless LAN service may fix the problem.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25261</id>
		<title>GPU fix</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=GPU_fix&amp;diff=25261"/>
		<updated>2019-04-11T21:24:03Z</updated>

		<summary type="html">&lt;p&gt;Hiep: Created page with &amp;quot;==Fixing the GPU on the RDP (Aprl 11th 2019)==  At the time of writing, CUDA and tensorflow cannot connect to our GPU. This can be verified by opening python3 and type  import...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Fixing the GPU on the RDP (Aprl 11th 2019)==&lt;br /&gt;
&lt;br /&gt;
At the time of writing, CUDA and tensorflow cannot connect to our GPU. This can be verified by opening python3 and type&lt;br /&gt;
 import tensorflow as tf&lt;br /&gt;
 tf.test.is_gpu_available()&lt;br /&gt;
&lt;br /&gt;
In addition, GeForce Experience and NVIDIA control panel do not work right now.&lt;br /&gt;
&lt;br /&gt;
Hiep has checked GPU driver by going to device manager -&amp;gt; Display adapter -&amp;gt; RTX Titan -&amp;gt; Properties -&amp;gt; Driver -&amp;gt; Update Driver. However, nothing new is installed since the current driver is already up-to-date.&lt;br /&gt;
&lt;br /&gt;
Hiep has also restarted several NVIDIA services by opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA services -&amp;gt; clicked on restart. However, it still cannot resolve the issue.&lt;br /&gt;
&lt;br /&gt;
Since Geforce Experience cannot be opened, Hiep has followed a solution from NVIDIA forum, which is opening Run -&amp;gt; type in services.msc -&amp;gt; scrolled down to NVIDIA service -&amp;gt; Under nvidia telemetry container -&amp;gt; Choose Log on -&amp;gt; Check Log on as Local System Account.&lt;br /&gt;
&lt;br /&gt;
However, none of the above approaches actually resolved the issue. Reinstalling NVIDIA software might be necessary.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=RDP_Software_Configuration&amp;diff=25240</id>
		<title>RDP Software Configuration</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=RDP_Software_Configuration&amp;diff=25240"/>
		<updated>2019-04-11T18:41:25Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;All software installed on the RDP, as well as its configuration, should be recorded on this page!&lt;br /&gt;
&lt;br /&gt;
==Base installation==&lt;br /&gt;
&lt;br /&gt;
Ed installed the following during the build:&lt;br /&gt;
*ActiveState Perl 5.26.3&lt;br /&gt;
*ArcGIS Desktop (instructions at http://answers.library.georgetown.edu/faq/247307)&lt;br /&gt;
*ArcGIS Reader (ESU196456098)&lt;br /&gt;
**Python 2.7 (installed with ArcGIS in C:\Python27\ArcGIS10.6)&lt;br /&gt;
*CUDA 10.1&lt;br /&gt;
*Google Chrome&lt;br /&gt;
*Komodo 9 IDE (licence is E:\mcnair\installs\Komodo-IDE-9-Windows-S19344C4830A.exe)&lt;br /&gt;
*.NET 3.5 (install from media, see instructions [https://awsbloglink.wordpress.com/2018/10/25/windows-server-2019-measures-to-be-taken-when-installing-net-framework-3-5-fails/])&lt;br /&gt;
*Matlab 2018a (instructions at http://uis.georgetown.edu/computers/purchase/software/matlab/install)&lt;br /&gt;
*Office 2019&lt;br /&gt;
*STATA 15MP (24 core, network edition, 2 licenses)&lt;br /&gt;
*SDC Platinum&lt;br /&gt;
*Textpad 8&lt;br /&gt;
*Visual Studio 2018 Community Edition&lt;br /&gt;
**Anaconda 3 &amp;amp; Python 3.6 (installed with Microsoft Visual Studio, in C:\Program Files (x86)\Microsoft Visual Studio\Shared\)&lt;br /&gt;
&lt;br /&gt;
Hiep installed the following:&lt;br /&gt;
*Git windows 2.21.0&lt;br /&gt;
*Git bash (to use git, no new path added)&lt;br /&gt;
==Python and R==&lt;br /&gt;
&lt;br /&gt;
Ed installed additional new versions of:&lt;br /&gt;
*Python 2.7&lt;br /&gt;
*Anaconda 3 (with the add to path option)&lt;br /&gt;
*R 3.5.3&lt;br /&gt;
&lt;br /&gt;
Afterwards C:\Python27, C:\Python27\Lib and C:\Program Files\R\R-3.5.3\bin\x64 were added to the path (search &amp;quot;edit system environment variables&amp;quot;). C:\Python27\python.exe was copied to C:\Python27\python2.exe and C:\ProgramData\Anaconda3\python.exe was copied to python3.exe. &lt;br /&gt;
&lt;br /&gt;
Users wanting to run python can therefore run any of the following:&lt;br /&gt;
 python -- runs python 3.7 in C:\ProgramData\Anaconda3&lt;br /&gt;
 python3 -- runs python 3.7 in C:\ProgramData\Anaconda3&lt;br /&gt;
 python2 --  runs python 2.7 in C:\Python27&lt;br /&gt;
 py -3 -- runs python 3.7 in C:\ProgramData\Anaconda3&lt;br /&gt;
 py -2 --  runs python 2.7 in C:\Python27&lt;br /&gt;
&lt;br /&gt;
For some reason this configuration stopped working. It seems that C:\ProgramData\Anaconda3 was removed from the path. It has now been added back. If you have an issue, please try closing and reopening your shell, or disconnecting and reconnecting your session.&lt;br /&gt;
&lt;br /&gt;
For the old RDP configuration, see notes on [[Python on the RDP]]. There was also a GIT server on the old RDP, which hosted our [[Software Repository]]. All of the projects in the [[Software Repository Listing]] are on the E drive. We may install a new GIT server at some point.&lt;br /&gt;
&lt;br /&gt;
==Adding libraries==&lt;br /&gt;
&lt;br /&gt;
If you add a library or package to a programming language, for instance through pip or manually, record what you did here!&lt;br /&gt;
&lt;br /&gt;
The following packages have been downloaded for python3 via pip&lt;br /&gt;
 tensorflow 1.13.1&lt;br /&gt;
 keras 2.2.4&lt;br /&gt;
 open-cv 4.0&lt;br /&gt;
 networkx 4.3&lt;br /&gt;
 sklearn 0.20.1&lt;br /&gt;
 numpy 1.16.2 (upgraded from 1.15.4)&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=RDP_Software_Configuration&amp;diff=25202</id>
		<title>RDP Software Configuration</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=RDP_Software_Configuration&amp;diff=25202"/>
		<updated>2019-04-09T20:12:39Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;All software installed on the RDP, as well as its configuration, should be recorded on this page!&lt;br /&gt;
&lt;br /&gt;
==Base installation==&lt;br /&gt;
&lt;br /&gt;
Ed installed the following during the build:&lt;br /&gt;
*ActiveState Perl 5.26.3&lt;br /&gt;
*ArcGIS Desktop (instructions at http://answers.library.georgetown.edu/faq/247307)&lt;br /&gt;
*ArcGIS Reader (ESU196456098)&lt;br /&gt;
**Python 2.7 (installed with ArcGIS in C:\Python27\ArcGIS10.6)&lt;br /&gt;
*CUDA 10.1&lt;br /&gt;
*Google Chrome&lt;br /&gt;
*Komodo 9 IDE (licence is E:\mcnair\installs\Komodo-IDE-9-Windows-S19344C4830A.exe)&lt;br /&gt;
*.NET 3.5 (install from media, see instructions [https://awsbloglink.wordpress.com/2018/10/25/windows-server-2019-measures-to-be-taken-when-installing-net-framework-3-5-fails/])&lt;br /&gt;
*Matlab 2018a (instructions at http://uis.georgetown.edu/computers/purchase/software/matlab/install)&lt;br /&gt;
*Office 2019&lt;br /&gt;
*STATA 15MP (24 core, network edition, 2 licenses)&lt;br /&gt;
*SDC Platinum&lt;br /&gt;
*Textpad 8&lt;br /&gt;
*Visual Studio 2018 Community Edition&lt;br /&gt;
**Anaconda 3 &amp;amp; Python 3.6 (installed with Microsoft Visual Studio, in C:\Program Files (x86)\Microsoft Visual Studio\Shared\)&lt;br /&gt;
&lt;br /&gt;
==Python and R==&lt;br /&gt;
&lt;br /&gt;
Ed installed additional new versions of:&lt;br /&gt;
*Python 2.7&lt;br /&gt;
*Anaconda 3 (with the add to path option)&lt;br /&gt;
*R 3.5.3&lt;br /&gt;
&lt;br /&gt;
Afterwards C:\Python27, C:\Python27\Lib and C:\Program Files\R\R-3.5.3\bin\x64 were added to the path (search &amp;quot;edit system environment variables&amp;quot;). C:\Python27\python.exe was copied to C:\Python27\python2.exe and C:\ProgramData\Anaconda3\python.exe was copied to python3.exe. &lt;br /&gt;
&lt;br /&gt;
Users wanting to run python can therefore run any of the following:&lt;br /&gt;
 python -- runs python 3.7 in C:\ProgramData\Anaconda3&lt;br /&gt;
 python3 -- runs python 3.7 in C:\ProgramData\Anaconda3&lt;br /&gt;
 python2 --  runs python 2.7 in C:\Python27&lt;br /&gt;
 py -3 -- runs python 3.7 in C:\ProgramData\Anaconda3&lt;br /&gt;
 py -2 --  runs python 2.7 in C:\Python27&lt;br /&gt;
&lt;br /&gt;
For some reason this configuration stopped working. It seems that C:\ProgramData\Anaconda3 was removed from the path. It has now been added back. If you have an issue, please try closing and reopening your shell, or disconnecting and reconnecting your session.&lt;br /&gt;
&lt;br /&gt;
For the old RDP configuration, see notes on [[Python on the RDP]]. There was also a GIT server on the old RDP, which hosted our [[Software Repository]]. All of the projects in the [[Software Repository Listing]] are on the E drive. We may install a new GIT server at some point.&lt;br /&gt;
&lt;br /&gt;
==Adding libraries==&lt;br /&gt;
&lt;br /&gt;
If you add a library or package to a programming language, for instance through pip or manually, record what you did here!&lt;br /&gt;
&lt;br /&gt;
The following packages have been downloaded for python3 via pip&lt;br /&gt;
 tensorflow 1.13.1&lt;br /&gt;
 keras 2.2.4&lt;br /&gt;
 open-cv 4.0&lt;br /&gt;
 networkx 4.3&lt;br /&gt;
 sklearn 0.20.1&lt;br /&gt;
 numpy 1.16.2 (upgraded from 1.15.4)&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=RDP_Software_Configuration&amp;diff=25170</id>
		<title>RDP Software Configuration</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=RDP_Software_Configuration&amp;diff=25170"/>
		<updated>2019-04-08T19:39:21Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;All software installed on the RDP, as well as its configuration, should be recorded on this page!&lt;br /&gt;
&lt;br /&gt;
==Base installation==&lt;br /&gt;
&lt;br /&gt;
Ed installed the following during the build:&lt;br /&gt;
*ActiveState Perl 5.26.3&lt;br /&gt;
*ArcGIS Desktop (instructions at http://answers.library.georgetown.edu/faq/247307)&lt;br /&gt;
*ArcGIS Reader (ESU196456098)&lt;br /&gt;
**Python 2.7 (installed with ArcGIS in C:\Python27\ArcGIS10.6)&lt;br /&gt;
*CUDA 10.1&lt;br /&gt;
*Google Chrome&lt;br /&gt;
*Komodo 9 IDE (licence is E:\mcnair\installs\Komodo-IDE-9-Windows-S19344C4830A.exe)&lt;br /&gt;
*.NET 3.5 (install from media, see instructions [https://awsbloglink.wordpress.com/2018/10/25/windows-server-2019-measures-to-be-taken-when-installing-net-framework-3-5-fails/])&lt;br /&gt;
*Matlab 2018a (instructions at http://uis.georgetown.edu/computers/purchase/software/matlab/install)&lt;br /&gt;
*Office 2019&lt;br /&gt;
*STATA 15MP (24 core, network edition, 2 licenses)&lt;br /&gt;
*SDC Platinum&lt;br /&gt;
*Textpad 8&lt;br /&gt;
*Visual Studio 2018 Community Edition&lt;br /&gt;
**Anaconda 3 &amp;amp; Python 3.6 (installed with Microsoft Visual Studio, in C:\Program Files (x86)\Microsoft Visual Studio\Shared\)&lt;br /&gt;
&lt;br /&gt;
==Python and R==&lt;br /&gt;
&lt;br /&gt;
Ed installed additional new versions of:&lt;br /&gt;
*Python 2.7&lt;br /&gt;
*Anaconda 3 (with the add to path option)&lt;br /&gt;
*R 3.5.3&lt;br /&gt;
&lt;br /&gt;
Afterwards C:\Python27, C:\Python27\Lib and C:\Program Files\R\R-3.5.3\bin\x64 were added to the path (search &amp;quot;edit system environment variables&amp;quot;). C:\Python27\python.exe was copied to C:\Python27\python2.exe and C:\ProgramData\Anaconda3\python.exe was copied to python3.exe. &lt;br /&gt;
&lt;br /&gt;
Users wanting to run python can therefore run any of the following:&lt;br /&gt;
 python -- runs python 3.7 in C:\ProgramData\Anaconda3&lt;br /&gt;
 python3 -- runs python 3.7 in C:\ProgramData\Anaconda3&lt;br /&gt;
 python2 --  runs python 2.7 in C:\Python27&lt;br /&gt;
 py -3 -- runs python 3.7 in C:\ProgramData\Anaconda3&lt;br /&gt;
 py -2 --  runs python 2.7 in C:\Python27&lt;br /&gt;
&lt;br /&gt;
For the old RDP configuration, see notes on [[Python on the RDP]]. There was also a GIT server on the old RDP, which hosted our [[Software Repository]]. All of the projects in the [[Software Repository Listing]] are on the E drive. We may install a new GIT server at some point.&lt;br /&gt;
&lt;br /&gt;
==Adding libraries==&lt;br /&gt;
&lt;br /&gt;
If you add a library or package to a programming language, for instance through pip or manually, record what you did here!&lt;br /&gt;
&lt;br /&gt;
The following packages have been downloaded for python3 via pip&lt;br /&gt;
 tensorflow 1.13.1&lt;br /&gt;
 keras 2.2.4&lt;br /&gt;
 open-cv 4.0&lt;br /&gt;
 networkx 4.3&lt;br /&gt;
 sklearn 0.20.1&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=Pix2code&amp;diff=25138</id>
		<title>Pix2code</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=Pix2code&amp;diff=25138"/>
		<updated>2019-04-05T22:45:14Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=Pix2code experimentation&lt;br /&gt;
|Has owner=Hiep Nguyen,&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Brief Introduction==&lt;br /&gt;
Pix2code is an AI model that can convert GUI images to DSL codes and then uses a compiler to convert DSL code to HTML, Android XML, and iOS Storyboard. More details can be found [https://arxiv.org/pdf/1705.07962.pdf here] in the original paper. Instructions to train and use the models can be found on the original [https://github.com/tonybeltramelli/pix2code github] page. There is an improved version of pix2code, which is [https://github.com/fjbriones/pix2code2 pix2code2]. It uses a Convolutional Neural Network  (CNN) as an autoencoder for the GUI before training. The users also include a pre-trained model to experiment with. What we have in the RDP right now is pix2code2.&lt;br /&gt;
&lt;br /&gt;
==Usage of pix2code on RDP==&lt;br /&gt;
Currently, source code and pre-trained model for pix2code are living on &lt;br /&gt;
 E:/projects/pix2code_test&lt;br /&gt;
&lt;br /&gt;
To generate DSL code from specific GUI images, first place the image on pix2code_test directory, then do the following&lt;br /&gt;
&lt;br /&gt;
 cd pix2code_test/model&lt;br /&gt;
 ./sample.py ../bin pix2code2 ../test_img.png ../code greedy #to use greedy algorithm, replace greedy with 1,2,3..,k to use beam search with size k.&lt;br /&gt;
&lt;br /&gt;
The GUI code will be inside the pix2code_test/code directory&lt;br /&gt;
&lt;br /&gt;
To generate GUI to HTML:&lt;br /&gt;
 cd compiler&lt;br /&gt;
 ./web_compiler.py ./code/test_img.gui&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While pix2code can preserve the structure of the HTML page quite well, it cannot preserve the contents of the website. Most of the texts from the original page are distorted in the generated DSL. Moreover, pix2code is extremely expensive to train and the current model only works for very simple GUIs that are similar to ones in the training set. Hence, pix2code model would not be suited for building an information extractor. However, we can learn from the source code how to input and structure GUI data and construct LSTM networks on top of GUI and output DSL code.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=Pix2code&amp;diff=25137</id>
		<title>Pix2code</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=Pix2code&amp;diff=25137"/>
		<updated>2019-04-05T22:43:41Z</updated>

		<summary type="html">&lt;p&gt;Hiep: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=Pix2code experimentation&lt;br /&gt;
|Has owner=Hiep Nguyen,&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Brief Introduction==&lt;br /&gt;
Pix2code is an AI model that can convert GUI images to DSL codes and then uses a compiler to convert DSL code to HTML, Android XML, and iOS Storyboard. More details can be found [https://arxiv.org/pdf/1705.07962.pdf here] in the original paper. Instructions to train and use the models can be found on the original [https://github.com/tonybeltramelli/pix2code github] page. There is an improved version of pix2code, which is [https://github.com/fjbriones/pix2code2 pix2code2]. It uses a Convolutional Neural Network  (CNN) as an autoencoder for the GUI before training. The users also include a pre-trained model to experiment with.&lt;br /&gt;
&lt;br /&gt;
==Usage of pix2code on RDP==&lt;br /&gt;
Currently, source code and pre-trained model for pix2code are living on &lt;br /&gt;
 E:/projects/pix2code_test&lt;br /&gt;
&lt;br /&gt;
To generate DSL code from specific GUI images, first place the image on pix2code_test directory, then do the following&lt;br /&gt;
&lt;br /&gt;
 cd pix2code_test/model&lt;br /&gt;
 ./sample.py ../bin pix2code2 ../test_img.png ../code greedy #to use greedy algorithm, replace greedy with 1,2,3..,k to use beam search with size k.&lt;br /&gt;
&lt;br /&gt;
The GUI code will be inside the pix2code_test/code directory&lt;br /&gt;
&lt;br /&gt;
To generate GUI to HTML:&lt;br /&gt;
 cd compiler&lt;br /&gt;
 ./web_compiler.py ./code/test_img.gui&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While pix2code can preserve the structure of the HTML page quite well, it cannot preserve the contents of the website. Most of the texts from the original page are distorted in the generated DSL. Moreover, pix2code is extremely expensive to train and the current model only works for very simple GUIs that are similar to ones in the training set. Hence, pix2code model would not be suited for building an information extractor. However, we can learn from the source code how to input and structure GUI data and construct LSTM networks on top of GUI and output DSL code.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=Pix2code&amp;diff=25136</id>
		<title>Pix2code</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=Pix2code&amp;diff=25136"/>
		<updated>2019-04-05T22:42:15Z</updated>

		<summary type="html">&lt;p&gt;Hiep: /* Usage on RDP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=Pix2code experimentation&lt;br /&gt;
|Has owner=Hiep Nguyen,&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Brief Introduction==&lt;br /&gt;
Pix2code is an AI model that can convert GUI images to DSL codes and then uses a compiler to convert DSL code to HTML, Android XML, and iOS Storyboard. More details can be found [https://arxiv.org/pdf/1705.07962.pdf here] in the original paper. Instructions to train and use the models can be found on the original [https://github.com/tonybeltramelli/pix2code github] page. There is an improved version of pix2code, which is [https://github.com/fjbriones/pix2code2 pix2code2]. It uses a Convolutional Neural Network  (CNN) as an autoencoder for the GUI before training. The users also include a pre-trained model to experiment with.&lt;br /&gt;
&lt;br /&gt;
==Usage of pix2code on RDP==&lt;br /&gt;
Currently, source code and pre-trained model for pix2code are living on &lt;br /&gt;
 E:/projects/pix2code_test&lt;br /&gt;
&lt;br /&gt;
To generate DSL code from specific GUI images, first place the image on pix2code_test directory, then do the following&lt;br /&gt;
&lt;br /&gt;
 cd pix2code_test/model&lt;br /&gt;
 ./sample.py ../bin pix2code2 ../test_img.png ../code greedy #to use greedy algorithm, replace greedy with 1,2,3..,k to use beam search with size k.&lt;br /&gt;
&lt;br /&gt;
The GUI code will be inside the pix2code_test/code directory&lt;br /&gt;
&lt;br /&gt;
To generate GUI to HTML:&lt;br /&gt;
 cd compiler&lt;br /&gt;
 ./web_compiler.py ./code/test_img.gui&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While pix2code can preserve the structure of the HTML page quite well, it cannot preserve the contents of the websites. Most of the texts from the original page are distorted in the generated DSL. Moreover, pix2code is extremely expensive to train and the current model only works for very simple GUIs that are similar to ones in the training set. Hence, pix2code model would not be suited for building an information extractor. However, we can learn from the source code how to input and structure GUI data and construct LSTM networks on top of GUI and output DSL code.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
	<entry>
		<id>http://www.edegan.com/mediawiki/index.php?title=Pix2code&amp;diff=25135</id>
		<title>Pix2code</title>
		<link rel="alternate" type="text/html" href="http://www.edegan.com/mediawiki/index.php?title=Pix2code&amp;diff=25135"/>
		<updated>2019-04-05T22:41:53Z</updated>

		<summary type="html">&lt;p&gt;Hiep: Created page with &amp;quot;{{Project |Has title=Pix2code experimentation |Has owner=Hiep Nguyen, }}  ==Brief Introduction== Pix2code is an AI model that can convert GUI images to DSL codes and then uses...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Project&lt;br /&gt;
|Has title=Pix2code experimentation&lt;br /&gt;
|Has owner=Hiep Nguyen,&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Brief Introduction==&lt;br /&gt;
Pix2code is an AI model that can convert GUI images to DSL codes and then uses a compiler to convert DSL code to HTML, Android XML, and iOS Storyboard. More details can be found [https://arxiv.org/pdf/1705.07962.pdf here] in the original paper. Instructions to train and use the models can be found on the original [https://github.com/tonybeltramelli/pix2code github] page. There is an improved version of pix2code, which is [https://github.com/fjbriones/pix2code2 pix2code2]. It uses a Convolutional Neural Network  (CNN) as an autoencoder for the GUI before training. The users also include a pre-trained model to experiment with.&lt;br /&gt;
&lt;br /&gt;
==Usage on RDP==&lt;br /&gt;
Currently, source code and pre-trained model for pix2code are living on &lt;br /&gt;
 E:/projects/pix2code_test&lt;br /&gt;
&lt;br /&gt;
To generate DSL code from specific GUI images, first place the image on pix2code_test directory, then do the following&lt;br /&gt;
&lt;br /&gt;
 cd pix2code_test/model&lt;br /&gt;
 ./sample.py ../bin pix2code2 ../test_img.png ../code greedy #to use greedy algorithm, replace greedy with 1,2,3..,k to use beam search with size k.&lt;br /&gt;
&lt;br /&gt;
The GUI code will be inside the pix2code_test/code directory&lt;br /&gt;
&lt;br /&gt;
To generate GUI to HTML:&lt;br /&gt;
 cd compiler&lt;br /&gt;
 ./web_compiler.py ./code/test_img.gui&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While pix2code can preserve the structure of the HTML page quite well, it cannot preserve the contents of the websites. Most of the texts from the original page are distorted in the generated DSL. Moreover, pix2code is extremely expensive to train and the current model only works for very simple GUIs that are similar to ones in the training set. Hence, pix2code model would not be suited for building an information extractor. However, we can learn from the source code how to input and structure GUI data and construct LSTM networks on top of GUI and output DSL code.&lt;/div&gt;</summary>
		<author><name>Hiep</name></author>
		
	</entry>
</feed>