<jupyter_start><jupyter_text><jupyter_code>from pickle import load
import matplotlib.pyplot as plt
from matplotlib import patches
plt.style.use('fivethirtyeight')
from os import system

# Run this program in Linux command line since it won't return anything on Google Colab
# This program will read line by line of names and extract XY coordinates from screen 

system("/content/1.jpg")
def predict(x_mid,
            y_mid,):
 pickle_in=open("dict.pickle",
                "rb",)
 regr=load(pickle_in)
 x=regr.predict([[x_mid,
                  y_mid,]])
 pickle_in.close()
 pickle_in=open("dict1.pickle",
                "rb",)
 regr=load(pickle_in)
 y=regr.predict([[x_mid,
                  y_mid,]])
 pickle_in.close()
 return(x,
        y,)
 
def search_keyword_person(line):
    v=line.split(':')
    if v[0]=='person':
        return(1)
    else:
        return(0)
    
def parser(string):
    q=string.split(':')
    q=q[1].split(',')
    ak_lis=[]
    for i in q:
        j=i.split('=')
        ak_lis.append(int(j[1]))
    return(ak_lis)   
    
fh = open('coo_extract',
          'r',)

k=0
count=0
imp_lis=[]
while True:
    line = fh.readline()
    j=search_keyword_person(line)
    if j==1:
        imp_lis.append(k+2)
        count=count+1
    if not line:
        #print(count)
        break
    k=k+1

fh.close()
with open("coo_extract") as f:
    lines = f.readlines()
coo_lis=[]
for i  in imp_lis:
    v=parser(lines[int(i)-1])
    coo_lis.append(v)
f.close()

# print(coo_lis,
#    ' count : '
#     + str(count),)
# print(coo_lis)

for i in coo_lis:
    a=(i[0]+i[2])/2
    b=(i[1]+i[3])/2
    x,y=predict(int(a),
                int(b),)
    print(x,
          y,)
    
f = open("coo_extract",
         "w",)
f.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15640880858272163, 'fraction_numerical': 0.01129305477131564, 'mean_word_length': 2.536926147704591, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '607402', 'license': 'MIT', 'n_tokens_mistral': 719, 'n_tokens_neox': 695, 'n_words': 139, 'path': 'coo_extractor.ipynb', 'repo_name': 'wanderloop/wanderlust', 'size': '1771'}