-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatureLoader.java
More file actions
62 lines (46 loc) · 1.43 KB
/
Copy pathFeatureLoader.java
File metadata and controls
62 lines (46 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.deft.sarcasm.features;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
abstract public class FeatureLoader
{
public abstract Map<Integer, Double> loadFeatures(String[] tokens) ;
public abstract Map<String, Double> loadNonLexFeatures(String[] tokens) ;
// public abstract void close() throws IOException ;
public List<Integer> getFeatureVector(Map<Integer, Integer> featureMap)
{
// TODO Auto-generated method stub
// sort the columns using TreeMap
TreeMap<Integer, Integer> featureMapSorted = new TreeMap<Integer, Integer>(
featureMap);
String f = null ;
List<Integer> features = new ArrayList<Integer>() ;
for (Integer feature : featureMapSorted.keySet())
{
Integer val = featureMapSorted.get(feature);
if (null == val)
{
// something wrong - throw exception later
System.out.println("something wrong in feature value, check");
continue;
}
// f = feature + ":" + "1" ; //1 = binary
features.add((feature));
}
return features;
}
public List<Integer> getPuncFVs(int xclm, int ques, int quotes)
{
// TODO Auto-generated method stub
return null;
}
public Map<Integer, Double> loadFeatures(String[] tokens, String target) {
// TODO Auto-generated method stub
return null;
}
}