Esempio n. 1
0
#correctTag = sampleHashTagsWithAnswers.get('#' + aHashTag)
#print correctTag
#matchTag = MaxMatch.maxMatch(aHashTag, lexicon)
#matchTag = MaxMatch.maxMatchImproved(aHashTag, lexicon)

#MaxMatch.maxMatchAllTagsAndOutputToFile(sampleHashTags, lexicon, 'maccoun-out-assgn1.txt')

testFile = open('testSet.txt', 'r')
testSet = []
for line in testFile:
    hashTagWithoutPound = line.replace('#', '')
    correctHashTag = hashTagWithoutPound.replace('\n', '')
    correctHashTag = correctHashTag.lower()
    testSet.append(correctHashTag)

testMaxMatch = MaxMatch.maxMatchAllTagsAndOutputToFile(testSet, lexicon, 'maccoun-out-assgn1.txt')
print "testMaxMatch: " , testMaxMatch

answers = [['london','2012'],
            ['switch','to','chrome'],
            ['iphone', '5'],
            ['team', 'gb'],
            ['47','percent'],
            ['nbc','fail'],
            ['art','of','letter','writing','is','almost','lost'],
            ['conspiracy','theories','for','breakfast'],
            ['doctors', 'without','borders'],
            ['iran','election'],
            ['tomorrows','news','today'],
            ['its','the','thought','that','counts'],
            ['yankees','get','another','call'],
Esempio n. 2
0
#matchTag = MaxMatch.maxMatchImproved(aHashTag, lexicon)

#MaxMatch.maxMatchAllTagsAndOutputToFile(sampleHashTags, lexicon, 'maccoun-out-assgn1.txt')

testFile = open('testSet.txt', 'r')
testSet = []
for line in testFile:
    hashTagWithoutPound = line.replace('#', '')
    correctHashTag = hashTagWithoutPound.replace('\n', '')
    correctHashTag = correctHashTag.lower()
    testSet.append(correctHashTag)

#testMaxMatch = MaxMatch.maxMatchAllTagsAndOutputToFile(testSet, lexicon, 'maccoun-out-assgn1-part1.txt')


testMaxMatchImprove = MaxMatch.maxMatchImprovedAllTagsAndOutputToFile(testSet, lexicon, 'maccoun-out-assgn1-part3.txt')

answers = [['london','2012'],
            ['switch','to','chrome'],
            ['iphone', '5'],
            ['team', 'gb'],
            ['47','percent'],
            ['nbc','fail'],
            ['art','of','letter','writing','is','almost','lost'],
            ['conspiracy','theories','for','breakfast'],
            ['doctors', 'without','borders'],
            ['iran','election'],
            ['tomorrows','news','today'],
            ['its','the','thought','that','counts'],
            ['yankees','get','another','call'],
            ['someone','dropped','the','ball'],