Created
February 6, 2018 14:54
-
-
Save lievcin/d26baba5edd4c03b13dcdca855df132c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_label(label): | |
if label == '__label2__': | |
return 'real' | |
else: | |
return 'fake' | |
def parse_verification(label): | |
if label == 'N': | |
return 0 | |
else: | |
return 1 | |
# Convert line from input file into an id/text/label tuple | |
def parseReview(reviewLine): | |
# Should return a triple of an integer, a string containing the review, and a string indicating the label | |
return (reviewLine[0], \ | |
reviewLine[8], \ | |
parse_label(reviewLine[1]), \ | |
reviewLine[2], \ | |
parse_verification(reviewLine[3]), \ | |
reviewLine[7]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment