<commit_before>from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SocketServer import ThreadingMixIn
import threading
import cgi
import json
from main import *


class Handler(BaseHTTPRequestHandler):
    
    def do_GET(self):
        rootdir = '/Users/Alex/Desktop/HackCMU217' #file location
        try:
            self.send_response(200)
            self.send_header('Content-type',    'text/html')
            self.end_headers()
            if self.path.endswith('.html'):
                print(rootdir + self.path)
                f = open(rootdir + self.path)
                #send file content to client
                self.wfile.write(f.read())
                f.close()
        except IOError:
            self.send_error(404, 'file not found')
        return

    def parser(self,room):
        building,number=room.split("+")
        name=building+number
        type='Room'
        level=int(number[0])
        number = int(number)
        if level=='A':
            level=0
        return [name,type,building,level,number]


    def do_POST(self):<commit_msg>refine parser from frontend to backend<commit_after>from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SocketServer import ThreadingMixIn
import threading
import cgi
import json
from main import *


class Handler(BaseHTTPRequestHandler):
    
    def do_GET(self):
        rootdir = '/Users/Alex/Desktop/HackCMU217' #file location
        try:
            self.send_response(200)
            self.send_header('Content-type',    'text/html')
            self.end_headers()
            if self.path.endswith('.html'):
                print(rootdir + self.path)
                f = open(rootdir + self.path)
                #send file content to client
                self.wfile.write(f.read())
                f.close()
        except IOError:
            self.send_error(404, 'file not found')
        return

    def parser(self,room):
        if room == "Randy+Pausch+Bridge":
            building = "RPB"
            number = 5000
            type = 'Road'
            level = 5
            name = "<NAME>"
        else:
            building,number=room.split("+")
            name=building+number
            type='Room'
            level=number[0]
            if level=='A':
                level=0
            else:
                level = int(level)
            number = int(number)
        return [name,type,building,level,number]


    def do_POST(self):
{'fraction_non_alphanumeric': 0.09919028340080972, 'fraction_numerical': 0.010931174089068825, 'mean_word_length': 1.8207762557077625, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 4, '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}}
{'dir': 'git-commits-cleaned', 'id': '6358820', 'n_tokens_mistral': 720, 'n_tokens_neox': 676, 'n_words': 155}