<jupyter_start><jupyter_text>Creating LSTM Layers for Different Embeddings<jupyter_code># sz_sequence = 10
# n_units = 100
# n_layers = 3
# tf.reset_default_graph()
# #  For Word Embeddings
# with tf.variable_scope("word_lstm1"):
#     inputs = tf.keras.layers.Input(batch_shape=(batch_size, sz_sequence, channels))
#     cells = [tf.keras.layers.GRUCell(n_units) for _ in range(n_layers)]
#     state_series = tf.keras.layers.RNN(cells, stateful=True, return_sequences=True, return_state=False)(inputs)
#     state_series_word1 = tf.reduce_max(state_series, axis=1)
# state_series
word_sz_sequence = 10
n_units = 100
n_layers = 3
channels_word=100
tf.reset_default_graph()

# with grap.as_default():
#  For Word Embeddings
with grap.as_default():
    with tf.variable_scope("word_lstm1"):
        inputs = tf.keras.layers.Input(batch_shape=(batch_size, word_sz_sequence, channels_word))
        cells = [tf.keras.layers.GRUCell(n_units) for _ in range(n_layers)]
        state_series_w1 = tf.keras.layers.RNN(cells, stateful=True, return_sequences=True, return_state=False)(embedded_word[0])
        state_series_word1 = tf.reduce_max(state_series_w1, axis=1)
        init=tf.global_variables_initializer()   # Initializing all Variables within the scope
        print("state_series_w1", state_series_w1)
        print("state_series_word1", state_series_word1)
    #  For Word Embeddings 2
    with tf.variable_scope("word_lstm2"):
        inputs = tf.keras.layers.Input(batch_shape=(batch_size, word_sz_sequence, channels_word))
        cells = [tf.keras.layers.GRUCell(n_units) for _ in range(n_layers)]
        state_series_w2 = tf.keras.layers.RNN(cells, stateful=True, return_sequences=True, return_state=False)(embedded_word[1])
        state_series_word2 = tf.reduce_max(state_series_w1, axis=1)
        init=tf.global_variables_initializer()   # Initializing all Variables within the scope
        print("state_series_w2", state_series_w2)
        print("state_series_word2", state_series_word2)
    
# n_units=100
# n_layers=3
# cells = [tf.keras.layers.GRUCell(n_units) for _ in range(n_layers)]
# cells[0]
#  For POS Embeddings 1
pos_sz_sequence_POS = 10
channels_POS = 25
n_units_POS = 25
with grap.as_default():
    with tf.variable_scope("pos_lstm1"):
        inputs = tf.keras.layers.Input(batch_shape=(batch_size, pos_sz_sequence_POS, channels_POS)) # 10X10X25
        cells = [tf.keras.layers.GRUCell(n_units_POS) for _ in range(n_layers)]
        state_series_p1 = tf.keras.layers.RNN(cells, stateful=True, return_sequences=True, return_state=False)(embedded_pos[0])
        state_series_pos1 = tf.reduce_max(state_series_p1, axis=1)
        init=tf.global_variables_initializer()   # Initializing all Variables within the scope
        print("state_series_p1", state_series_p1)
        print("state_series_pos1", state_series_pos1)

    #  For POS Embeddings 2
    with tf.variable_scope("pos_lstm2"):
        inputs = tf.keras.layers.Input(batch_shape=(batch_size, pos_sz_sequence_POS, channels_POS)) # 10X25X3
        cells = [tf.keras.layers.GRUCell(n_units_POS) for _ in range(n_layers)]
        state_series_p2 = tf.keras.layers.RNN(cells, stateful=True, return_sequences=True, return_state=False)(embedded_pos[1])
        state_series_pos2 = tf.reduce_max(state_series_p2, axis=1)
        init=tf.global_variables_initializer()   # Initializing all Variables within the scope
        print("state_series_w2", state_series_p2)
        print("state_series_pos2", state_series_pos2)
with grap.as_default():
    my_scope = 'pos_lstm2'
    scope_variables=  tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope=my_scope )
    print(scope_variables)
#  For POS Embeddings 2
dep_sz_sequence = 10
channels_DEP = 25
n_units_DEP = 25
with grap.as_default():
    with tf.variable_scope("dep_lstm1"):
        inputs = tf.keras.layers.Input(batch_shape=(batch_size, dep_sz_sequence, channels_DEP))
        cells = [tf.keras.layers.GRUCell(n_units_DEP) for _ in range(n_layers)]
        state_series_d1 = tf.keras.layers.RNN(cells, stateful=True, return_sequences=True, return_state=False)(embedded_dep[0])
        state_series_dep1 = tf.reduce_max(state_series_d1, axis=1)
        init=tf.global_variables_initializer()   # Initializing all Variables within the scope
        print("state_series_d1", state_series_d1)
        print("state_series_dep1", state_series_dep1)

    with tf.variable_scope("dep_lstm2"):
        inputs = tf.keras.layers.Input(batch_shape=(batch_size, dep_sz_sequence, channels_DEP))#10X10X25
        cells = [tf.keras.layers.GRUCell(n_units_DEP) for _ in range(n_layers)]
        state_series_d2 = tf.keras.layers.RNN(cells, stateful=True, return_sequences=True, return_state=False)(embedded_dep[1])
        state_series_dep2 = tf.reduce_max(state_series_d2, axis=1)
        init=tf.global_variables_initializer()   # Initializing all Variables within the scope
        print("state_series_d2", state_series_d2)
        print("state_series_dep2", state_series_dep2)

ce = [tf.keras.layers.GRUCell(n_units) for _ in range(n_layers)]
ce[0]
with grap.as_default():
    state_series1 = tf.concat([state_series_word1, state_series_pos1, state_series_dep1], 1)
    state_series2 = tf.concat([state_series_word2, state_series_pos2, state_series_dep2], 1)

    state_series = tf.concat([state_series1, state_series2], 1)
    init=tf.global_variables_initializer()   # Initializing all Variables within the scope
    print("state_series", state_series)<jupyter_output>state_series Tensor("concat_2:0", shape=(10, 300), dtype=float32)<jupyter_text>Deprecated RNN-LSTM Code<jupyter_code># hidden_states = tf.zeros([channels, batch_size, state_size], name="hidden_state")
# cell_states = tf.zeros([channels, batch_size, state_size], name="cell_state")

# init_states = [tf.contrib.rnn.LSTMStateTuple(hidden_states[i], cell_states[i]) for i in range(channels)]
# tf.reset_default_graph()
# #  For Word Embeddings
# with tf.variable_scope("word_lstm1"):
#     cell = tf.contrib.rnn.BasicLSTMCell(word_state_size)
#     state_series, current_state = tf.nn.dynamic_rnn(cell, embedded_word[0], sequence_length=path_length[0], initial_state=init_states[0])
#     state_series_word1 = tf.reduce_max(state_series, axis=1)
# #  For Word Embeddings 2
# with tf.variable_scope("word_lstm2"):
#     cell = tf.contrib.rnn.BasicLSTMCell(word_state_size)
#     state_series, current_state = tf.nn.dynamic_rnn(cell, embedded_word[1], sequence_length=path_length[1], initial_state=init_states[0])
#     state_series_word2 = tf.reduce_max(state_series, axis=1)
# #  For POS Embeddings 1
# with tf.variable_scope("pos_lstm1"):
#     cell = tf.contrib.rnn.BasicLSTMCell(other_state_size)
#     state_series, current_state = tf.nn.dynamic_rnn(cell, embedded_pos[0], sequence_length=path_length[0],initial_state=init_states[1])
#     state_series_pos1 = tf.reduce_max(state_series, axis=1)
# #  For POS Embeddings 2
# with tf.variable_scope("pos_lstm2"):
#     cell = tf.contrib.rnn.BasicLSTMCell(other_state_size)
#     state_series, current_state = tf.nn.dynamic_rnn(cell, embedded_pos[1], sequence_length=path_length[1],initial_state=init_states[1])
#     state_series_pos2 = tf.reduce_max(state_series, axis=1)
# #  For POS Embeddings 2
# with tf.variable_scope("dep_lstm1"):
#     cell = tf.contrib.rnn.BasicLSTMCell(other_state_size)
#     state_series, current_state = tf.nn.dynamic_rnn(cell, embedded_dep[0], sequence_length=path_length[0], initial_state=init_states[2])
#     state_series_dep1 = tf.reduce_max(state_series, axis=1)

# with tf.variable_scope("dep_lstm2"):
#     cell = tf.contrib.rnn.BasicLSTMCell(other_state_size)
#     state_series, current_state = tf.nn.dynamic_rnn(cell, embedded_dep[1], sequence_length=path_length[1], initial_state=init_states[2])
#     state_series_dep2 = tf.reduce_max(state_series, axis=1)

# state_series1 = tf.concat([state_series_word1, state_series_pos1, state_series_dep1], 1)
# state_series2 = tf.concat([state_series_word2, state_series_pos2, state_series_dep2], 1)

# state_series = tf.concat([state_series1, state_series2], 1)
# embedded_dep[0], embedded_word
# tf.reset_default_graph()
state_series
# grap = tf.Graph()
with grap.as_default():
    with tf.name_scope("hidden_layer"):
        W = tf.Variable(tf.truncated_normal([300, 100], -0.1, 0.1), name="W")
#         b = tf.Variable(tf.zeros([100]), name="b")
        b = tf.Variable(tf.zeros([100]), name="b")
        y_hidden_layer = tf.matmul(state_series, W) + b
        init=tf.global_variables_initializer()   # Initializing all Variables within the scope

    with tf.name_scope("softmax_layer"):
        W = tf.Variable(tf.truncated_normal([100, relation_classes], -0.1, 0.1), name="W")
        b = tf.Variable(tf.zeros([relation_classes]), name="b")
        logits = tf.matmul(y_hidden_layer, W) + b
        predictions = tf.argmax(logits, 1)
        init=tf.global_variables_initializer()   # Initializing all Variables within the scope

print(logits)
with grap.as_default():
    my_scope = 'hidden_layer'
    scope_variables=  tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope= my_scope )
    for scope_var in scope_variables:
        print(scope_var.name)
     # True Relation btw the entities
#     y = tf.placeholder(tf.int32, [batch_size], name="y")  
# tv_all
with grap.as_default():
    tv_all = tf.trainable_variables()
    tv_regu = []
    non_reg = ["word_embedding/W:0","pos_embedding/W:0",'dep_embedding/W:0',"global_step:0",'hidden_layer/b:0','softmax_layer/b:0']
    for t in tv_all:
        if t.name not in non_reg:
#             if(t.name.find('biases')==-1):
            if(t.name.find('bias')==-1):
                tv_regu.append(t)
for tv in tv_regu:
    print(tv.name)
with grap.as_default():
    with tf.name_scope("loss"):
        l2_loss = lambda_l2 * tf.reduce_sum([ tf.nn.l2_loss(v) for v in tv_regu ])
        loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(logits=logits, labels=y))
        total_loss = loss + l2_loss
        init=tf.global_variables_initializer()   # Initializing all Variables within the scope

    global_step = tf.Variable(0, name="global_step")

    optimizer = tf.train.AdamOptimizer(0.001).minimize(total_loss, global_step=global_step)
    init=tf.global_variables_initializer()  # Initializing the optimizer variables
### y, logits
# tv_regu
print(tv_all)
f = open(data_dir + '/vocab.pkl', 'rb')
vocab = pickle.load(f)
f.close()

word2id = dict((w, i) for i,w in enumerate(vocab))
id2word = dict((i, w) for i,w in enumerate(vocab))

unknown_token = "<PASSWORD>"
word2id[unknown_token] = word_vocab_size -1
id2word[word_vocab_size-1] = unknown_token

pos_tags_vocab = []
for line in open(data_dir + '/pos_tags.txt'):
        pos_tags_vocab.append(line.strip())

dep_vocab = []
for line in open(data_dir + '/dependency_types.txt'):
    dep_vocab.append(line.strip())

relation_vocab = []
for line in open(data_dir + '/relation_types.txt'):
    relation_vocab.append(line.strip())


rel2id = dict((w, i) for i,w in enumerate(relation_vocab))
id2rel = dict((i, w) for i,w in enumerate(relation_vocab))

pos_tag2id = dict((w, i) for i,w in enumerate(pos_tags_vocab))
id2pos_tag = dict((i, w) for i,w in enumerate(pos_tags_vocab))

dep2id = dict((w, i) for i,w in enumerate(dep_vocab))
id2dep = dict((i, w) for i,w in enumerate(dep_vocab))

pos_tag2id['OTH'] = 9
id2pos_tag[9] = 'OTH'

dep2id['OTH'] = 20
id2dep[20] = 'OTH'

JJ_pos_tags = ['JJ', 'JJR', 'JJS']
NN_pos_tags = ['NN', 'NNS', 'NNP', 'NNPS']
RB_pos_tags = ['RB', 'RBR', 'RBS']
PRP_pos_tags = ['PRP', 'PRP$']
VB_pos_tags = ['VB', 'VBD', 'VBG', 'VBN', 'VBP', 'VBZ']
_pos_tags = ['CC', 'CD', 'DT', 'IN']

def pos_tag(x):
    if x in JJ_pos_tags:
        return pos_tag2id['JJ']
    if x in NN_pos_tags:
        return pos_tag2id['NN']
    if x in RB_pos_tags:
        return pos_tag2id['RB']
    if x in PRP_pos_tags:
        return pos_tag2id['PRP']
    if x in VB_pos_tags:
        return pos_tag2id['VB']
    if x in _pos_tags:
        return pos_tag2id[x]
    else:
        return 9
f = open(data_dir + '/train_paths', 'rb')
word_p1, word_p2, dep_p1, dep_p2, pos_p1, pos_p2 = pickle.load(f)
f.close()

relations = []
for line in open(data_dir + '/train_relations.txt'):
#     print(line.strip().split())
    relations.append(line.strip().split()[0])
print(relations)
# word_p1
# max_len_path
# word_p1_ids.shape
length = len(word_p1)
num_batches = int(length/batch_size)

for i in range(length):
    for j, word in enumerate(word_p1[i]):
        word = word.lower()
        word_p1[i][j] = word if word in word2id else unknown_token 
    for k, word in enumerate(word_p2[i]):
        word = word.lower()
        word_p2[i][k] = word if word in word2id else unknown_token 
    for l, d in enumerate(dep_p1[i]):
        dep_p1[i][l] = d if d in dep2id else 'OTH'
    for m, d in enumerate(dep_p2[i]):
        dep_p2[i][m] = d if d in dep2id else 'OTH'

word_p1_ids = np.ones([length, max_len_path],dtype=int)
word_p2_ids = np.ones([length, max_len_path],dtype=int)
pos_p1_ids = np.ones([length, max_len_path],dtype=int)
pos_p2_ids = np.ones([length, max_len_path],dtype=int)
dep_p1_ids = np.ones([length, max_len_path],dtype=int)
dep_p2_ids = np.ones([length, max_len_path],dtype=int)
rel_ids = np.array([rel2id[rel] for rel in relations])
path1_len = np.array([len(w) for w in word_p1], dtype=int)
path2_len = np.array([len(w) for w in word_p2])

for i in range(length):
    for j, w in enumerate(word_p1[i]):
        word_p1_ids[i][j] = word2id[w]
    for j, w in enumerate(word_p2[i]):
        word_p2_ids[i][j] = word2id[w]
    for j, w in enumerate(pos_p1[i]):
        pos_p1_ids[i][j] = pos_tag(w)
    for j, w in enumerate(pos_p2[i]):
        pos_p2_ids[i][j] = pos_tag(w)
    for j, w in enumerate(dep_p1[i]):
        dep_p1_ids[i][j] = dep2id[w]
    for j, w in enumerate(dep_p2[i]):
        dep_p2_ids[i][j] = dep2id[w]
sess = tf.Session()
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver(defer_build=True)
# tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='dep_embedding')
# f = open('data/word_embedding', 'rb')
# word_embedding = pickle.load(f)
# f.close()
# sess.run(embedding_init, feed_dict={embedding_placeholder:word_embedding})
# word_embedding_saver.save(sess, word_embd_dir + '/word_embd')
for i in tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope='dep_embedding'):
    print(i)
# model_dir = r"E:\The University of Texas at Dallas\Fall 2020\Natural Language Processing- CS 6320.501\NLP Project\Relation-Classification-using-Bidirectional-LSTM-Tree\Relation-Classification-using-Bidirectional-LSTM\checkpoint\modelv1"
model = tf.train.latest_checkpoint(model_dir)
saver.restore(sess, model)
tf.train.latest_checkpoint(model_dir)
model_dir
# latest_embd = tf.train.latest_checkpoint(word_embd_dir)
# word_embedding_saver.restore(sess, latest_embd)
# grap.version
from keras import backend as K

#Before prediction
K.clear_session()
# tf.convert_to_tensor(word_dict)
# word_dict
# grap
import numpy as np
from tensorflow.python.layers import base
import tensorflow as tf
import tensorflow.contrib.slim as slim
def model_summary():
    model_vars = tf.trainable_variables()
    slim.model_analyzer.analyze_vars(model_vars, print_info=True)

model_summary()
with tf.Session() as sess:
    print(tf.trainable_variables())
with tf.Session() as sess:
    print(tf.global_variables())
# path_dict
# type(y_dict)
# word_dict[0].shape
# dep_dict[0].shape
# path_dict[0].shape
# relations
sess = tf.Session()
sess.run(tf.local_variables_initializer())
init = tf.global_variables_initializer()
with tf.Session() as sess:
    sess.run(init)
# tf.global_variables_initializer()
# init_op = tf.initialize_all_variables()

# sess = tf.Session()
# sess.run(init_op)
with grap.as_default():
    init_g = tf.global_variables_initializer()
    init_l = tf.local_variables_initializer()
    with tf.Session() as sess:
        sess.run(init_g)
        sess.run(init_l)
# with tf.Session() as sess:
#     tf.initialize_all_variables().run()
# Add an op to initialize the variables.
init_op = tf.initialize_all_variables()

# Later, when launching the model
with tf.Session() as sess:
    print(sess.run(init_op))
  # Run the init operation

num_epochs = 1
for i in range(num_epochs):
    for j in range(num_batches):
        path_dict = [path1_len[j*batch_size:(j+1)*batch_size], path2_len[j*batch_size:(j+1)*batch_size]]
        word_dict = [word_p1_ids[j*batch_size:(j+1)*batch_size], word_p2_ids[j*batch_size:(j+1)*batch_size]]
        pos_dict = [pos_p1_ids[j*batch_size:(j+1)*batch_size], pos_p2_ids[j*batch_size:(j+1)*batch_size]]
        dep_dict = [dep_p1_ids[j*batch_size:(j+1)*batch_size], dep_p2_ids[j*batch_size:(j+1)*batch_size]]
        y_dict = rel_ids[j*batch_size:(j+1)*batch_size]
        
#         path_dict = tf.convert_to_tensor(path_dict)
#         word_dict = tf.convert_to_tensor(word_dict)
#         pos_dict = tf.convert_to_tensor(pos_dict)
#         dep_dict = tf.convert_to_tensor(dep_dict)
#         y_dict = tf.convert_to_tensor(y_dict)
        
        feed_dict = {
            path_length:path_dict,
            word_ids:word_dict,
            pos_ids:pos_dict,
            dep_ids:dep_dict,
            y:y_dict}
        with grap.as_default():
            with tf.Session(graph=grap) as sess:
                print("Sess Running")
                _, loss, step = sess.run([optimizer, total_loss, global_step], feed_dict)
            if step%10==0:
                print("Step:", step, "loss:",loss)
            if step % 1000 == 0:
                saver.save(sess, model_dir + '/model')
                print("Saved Model")<jupyter_output>Sess Running<jupyter_text>Prediction<jupyter_code># training accuracy
all_predictions = []
for j in range(num_batches):
    path_dict = [path1_len[j*batch_size:(j+1)*batch_size], path2_len[j*batch_size:(j+1)*batch_size]]
    word_dict = [word_p1_ids[j*batch_size:(j+1)*batch_size], word_p2_ids[j*batch_size:(j+1)*batch_size]]
    pos_dict = [pos_p1_ids[j*batch_size:(j+1)*batch_size], pos_p2_ids[j*batch_size:(j+1)*batch_size]]
    dep_dict = [dep_p1_ids[j*batch_size:(j+1)*batch_size], dep_p2_ids[j*batch_size:(j+1)*batch_size]]
    y_dict = rel_ids[j*batch_size:(j+1)*batch_size]

    feed_dict = {
        path_length:path_dict,
        word_ids:word_dict,
        pos_ids:pos_dict,
        dep_ids:dep_dict,
        y:y_dict}
    batch_predictions = sess.run(predictions, feed_dict)
    all_predictions.append(batch_predictions)

y_pred = []
for i in range(num_batches):
    for pred in all_predictions[i]:
        y_pred.append(pred)

count = 0
for i in range(batch_size*num_batches):
    count += y_pred[i]==rel_ids[i]
accuracy = count/(batch_size*num_batches) * 100

print("training accuracy", accuracy)
f = open(data_dir + '/test_paths', 'rb')
word_p1, word_p2, dep_p1, dep_p2, pos_p1, pos_p2 = pickle.load(f)
f.close()

relations = []
for line in open(data_dir + '/test_relations.txt'):
    relations.append(line.strip().split()[0])

length = len(word_p1)
num_batches = int(length/batch_size)

for i in range(length):
    for j, word in enumerate(word_p1[i]):
        word = word.lower()
        word_p1[i][j] = word if word in word2id else unknown_token 
    for k, word in enumerate(word_p2[i]):
        word = word.lower()
        word_p2[i][k] = word if word in word2id else unknown_token 
    for l, d in enumerate(dep_p1[i]):
        dep_p1[i][l] = d if d in dep2id else 'OTH'
    for m, d in enumerate(dep_p2[i]):
        dep_p2[i][m] = d if d in dep2id else 'OTH'

word_p1_ids = np.ones([length, max_len_path],dtype=int)
word_p2_ids = np.ones([length, max_len_path],dtype=int)
pos_p1_ids = np.ones([length, max_len_path],dtype=int)
pos_p2_ids = np.ones([length, max_len_path],dtype=int)
dep_p1_ids = np.ones([length, max_len_path],dtype=int)
dep_p2_ids = np.ones([length, max_len_path],dtype=int)
rel_ids = np.array([rel2id[rel] for rel in relations])
path1_len = np.array([len(w) for w in word_p1], dtype=int)
path2_len = np.array([len(w) for w in word_p2])

for i in range(length):
    for j, w in enumerate(word_p1[i]):
        word_p1_ids[i][j] = word2id[w]
    for j, w in enumerate(word_p2[i]):
        word_p2_ids[i][j] = word2id[w]
    for j, w in enumerate(pos_p1[i]):
        pos_p1_ids[i][j] = pos_tag(w)
    for j, w in enumerate(pos_p2[i]):
        pos_p2_ids[i][j] = pos_tag(w)
    for j, w in enumerate(dep_p1[i]):
        dep_p1_ids[i][j] = dep2id[w]
    for j, w in enumerate(dep_p2[i]):
        dep_p2_ids[i][j] = dep2id[w]
y_dict
# test 
all_predictions = []
for j in range(num_batches):
    path_dict = [path1_len[j*batch_size:(j+1)*batch_size], path2_len[j*batch_size:(j+1)*batch_size]]
    word_dict = [word_p1_ids[j*batch_size:(j+1)*batch_size], word_p2_ids[j*batch_size:(j+1)*batch_size]]
    pos_dict = [pos_p1_ids[j*batch_size:(j+1)*batch_size], pos_p2_ids[j*batch_size:(j+1)*batch_size]]
    dep_dict = [dep_p1_ids[j*batch_size:(j+1)*batch_size], dep_p2_ids[j*batch_size:(j+1)*batch_size]]
    y_dict = rel_ids[j*batch_size:(j+1)*batch_size]

    feed_dict = {
        path_length:path_dict,
        word_ids:word_dict,
        pos_ids:pos_dict,
        dep_ids:dep_dict,
        y:y_dict}
    batch_predictions = sess.run(predictions, feed_dict)
    all_predictions.append(batch_predictions)

y_pred = []
for i in range(num_batches):
    for pred in all_predictions[i]:
        y_pred.append(pred)

count = 0
for i in range(batch_size*num_batches):
    count += y_pred[i]==rel_ids[i]
accuracy = count/(batch_size*num_batches) * 100

print("test accuracy", accuracy)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13228761799000555, 'fraction_numerical': 0.02059041273366648, 'mean_word_length': 4.500890811911428, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '66691', 'license': 'MIT', 'n_tokens_mistral': 8421, 'n_tokens_neox': 8173, 'n_words': 1430, 'path': 'LCA Shortest Path/LSTM_Version1.ipynb', 'repo_name': 'sadam-99/Relationship-Extractor-NLP', 'size': '21615'}