Arash Alborz commited on
Commit
7d1eb13
·
1 Parent(s): 1226569
feature_extraction/liwc_from_text.py CHANGED
@@ -4,7 +4,7 @@ import numpy as np
4
  import re
5
  from collections import defaultdict, Counter
6
 
7
- # Load the LIWC dictionary once
8
  def load_liwc_dic(dic_path="models/output.dic"):
9
  category_map = defaultdict(list)
10
  with open(dic_path, 'r', encoding='utf-8') as f:
@@ -17,7 +17,7 @@ def load_liwc_dic(dic_path="models/output.dic"):
17
  category_map[category] = words
18
  return category_map
19
 
20
- # Get LIWC vector from one input text
21
  def liwc_vector(text, category_map):
22
  tokens = re.findall(r"\b\w+\b", text.lower())
23
  counts = Counter()
 
4
  import re
5
  from collections import defaultdict, Counter
6
 
7
+ # Load the LIWC dictionary
8
  def load_liwc_dic(dic_path="models/output.dic"):
9
  category_map = defaultdict(list)
10
  with open(dic_path, 'r', encoding='utf-8') as f:
 
17
  category_map[category] = words
18
  return category_map
19
 
20
+ # getting LIWC vector from input text
21
  def liwc_vector(text, category_map):
22
  tokens = re.findall(r"\b\w+\b", text.lower())
23
  counts = Counter()