# ACT2-4 functions.

'''This Program returns the vocabulary size of Moby Dick.'''

def readMobyDickShort():
    '''Reads the text file MobyDick.txt and returns a list of words from the first 1000 characters'''
    fileName = 'MobyDick.txt'
    myFile = open(fileName,'r')
    fileString = myFile.read()
    myFile.close()
    fileString = fileString[0:1000]
    myList = fileString.split()
    return myList

def readMobyDickAll():
    '''Reads the text file MobyDick.txt and returns a list of words from the entire text'''
    fileName = 'MobyDick.txt'
    myFile = open(fileName,'r')
    fileString = myFile.read()
    myFile.close()
    print 'Warning! Returning the entire list of words!'
    myList = fileString.split()
    return myList

def vocabSize():
    '''Gets the vocabulary size of Moby Dick'''
    myList = readMobyDickShort()
    uniqueList = noReplicates(myList)
    return len(uniqueList)

# Remove the '#' characters as you write the functions below.

#def noReplicates(wordList):
#    '''takes a list as argument, returns a list free of replicate items.
#    slow implementation.'''

#def testNoReplicates():
#    '''Test for the noReplicates() function'''
#    testList = ['apple','banana','carrot','carrot','banana','apple']
        
#def isElementOf(myElement,myList):
#    '''takes a string and a list and returns True if the string is
#    in the list and False otherwise.'''

#def testIsElementOf():
#    '''Test for the isElementOfFunction'''
#    testList = ['a','b','c']
