Skip to content

Instantly share code, notes, and snippets.

@lievcin
Created February 6, 2018 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lievcin/d26baba5edd4c03b13dcdca855df132c to your computer and use it in GitHub Desktop.
Save lievcin/d26baba5edd4c03b13dcdca855df132c to your computer and use it in GitHub Desktop.
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