Example #1
0
def main():

    r = raw_input("do you want to analyze the word frequency of files? Y/N:")
    str(r).lower()

    while r == "y":
        file = raw_input("enter the file name you want to analyze its word frequency:")
        analyzeFreq(file)
        r = raw_input("do you want to continue analyzing the word frequency of files? Y/N:")
        str(r).lower()

    probList = GenderProbList()

    maleFile = raw_input("enter the file name of male word frequency list:")
    probList.getWordFreqList(GENDER_M, maleFile)

    femaleFile = raw_input("enter the file name of female word frequency list:")
    probList.getWordFreqList(GENDER_F, femaleFile)

    probList.calProb()
    probList.save()

    maleFile = raw_input("enter the file name of male blog files:")
    femaleFile = raw_input("enter the file name of female word frequency list:")

    mbr = BlogReader()
    maleBlogList = mbr.read(resource_delimiter, maleFile)

    fbr = BlogReader()
    femaleBlogList = fbr.read(resource_delimiter, femaleFile)

    print "begin to reading blogs"
    print "begin to grade every blog!"

    sr = ScoreReporter(NOT_CLEAR_SCORE_EACH_TIME)
    sr.init(wordData, sufData, symData)

    for blog in maleBlogList:
        sr.grade(GENDER_M, str(blog))

    for blog in femaleBlogList:
        sr.grade(GENDER_F, str(blog))

    sr.save("result")
    print "grading is completed!"
Example #2
0
def main():
	
	file = raw_input("please specify the text that will be graded: ")
	
	br = BlogReader()
	blogList = br.read(resource_delimiter, file)
	
	print "begin to reading blogs"
	print "begin to grade every blog!"
	
	sr = ScoreReporter(NOT_CLEAR_SCORE_EACH_TIME)
	sr.init(wordData, sufData, symData)
	
	for blog in blogList:
		sr.grade(GENDER_UNKNOWN, str(blog))
	
	print "grade is completed!"

	sr.save(file)