Skip to content
Permalink
2a8d5ef95a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
20 lines (20 sloc) 644 Bytes
def load():
filename = "subjclueslen1-HLTEMNLP05.tff"
f = open(filename)
lines = f.readlines()
f.close()
words = []
labels = []
for line in lines:
fields = line.split(" ")
fields = [field for field in fields if "=" in field] #ugh, two lines have a random extra char in them
d = dict([field.rstrip().split("=") for field in fields])
(word, label, pos) = d["word1"], d["priorpolarity"], d["pos1"]
if pos == "adj":
if label == "positive":
words.append(word)
labels.append("pos")
elif label == "negative":
words.append(word)
labels.append("neg")
return (words, labels)