import re

def getBook(path):
    file = open(path)
    return file.read().lower()

def buildIndex(string):
    index = {}
    iter = re.finditer(r"\w+", string)
    for i in iter:
        word = i.group(0)
        position = i.start(0)

    return index
            

def printConcordance(word, string, index, halfWidth):
    return

s = getBook('C:/Users/kefeilei/Desktop/MobyDick.txt')
index = buildIndex(s)

