Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sarnthil committed Nov 4, 2019
1 parent 63af978 commit 856bc74
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions create_unified_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,31 +360,28 @@ def extract_emotion_cause(folder):
"split": None,
}


def extract_emo_bank(folder):
def unstr(string):
if string.startswith('"') and string.endswith('"'):
return string[1:-1]
return string
with open(folder + "/corpus/emobank.csv") as f:
reader = csv.DictReader(f)
for row in reader:
Id = unstr(row['id'])
Text = unstr(row['text'])
V = unstr(row['V'])
A = unstr(row['A'])
D = unstr(row['D'])
text = row["text"]
valence = float(row["V"])
arousal = float(row["A"])
dominance = float(row["D"])
yield {
"source": "emobank",
"text": Text,
"text": text,
"emotions": emotion_mapping({}, []),
"VAD": {
"valence": V,
"arousal": A,
"dominance": D
"valence": valence,
"arousal": arousal,
"dominance": dominance,
},
"split": None
"split": None,
}


def extract_affectivetext(folder):
tag_pattern = re.compile(r"<[^>]+?>")
# need to change the columns?
Expand Down Expand Up @@ -592,6 +589,7 @@ def handle_line(line):
for line in f:
yield from handle_line(line)


def extract_fb_va(folder):
with open(folder + "/dataset-fb-valence-arousal-anon.csv") as f:
reader = csv.DictReader(f)
Expand Down Expand Up @@ -647,7 +645,7 @@ def extract_EGK(folder):
"MELD": extract_meld("meld"),
"MELD_Dyadic": extract_meld("meld-dya"),
"emorynlp": extract_meld("emorynlp"),
"jointMultitaskEmo" : extract_jointMultitaskEmo,
"jointMultitaskEmo": extract_jointMultitaskEmo,
"README.md": None,
}
meta_info = {
Expand All @@ -665,7 +663,7 @@ def extract_EGK(folder):
"VA": ["fb-valence-arousal-anon"],
"Plutchik": ["ssec", "EGK", "jointMultitaskEmo"],
"Ekman+ne": ["emotiondata-aman"],
"VAD": ["EmoBank"], #
"VAD": ["EmoBank"], #
"Ekman-disgust-surprise": ["emoint"],
"Ekman+CF": ["crowdflower"],
"Ekman+ET": ["electoraltweets"],
Expand All @@ -686,7 +684,7 @@ def extract_EGK(folder):
"grounded_emotions",
],
"facebook-messages": ["fb-valence-arousal-anon"],
"headlines": ["affectivetext","emobank"], # emobank,
"headlines": ["affectivetext", "EmoBank"],
"conversations": ["dailydialog", "MELD", "MELD_Dyadic", "emorynlp"],
"blogposts": ["emotiondata-aman"],
"emotional_events": ["isear"],
Expand Down

0 comments on commit 856bc74

Please sign in to comment.