-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPunctFeatureLoader.java
More file actions
76 lines (62 loc) · 1.36 KB
/
Copy pathPunctFeatureLoader.java
File metadata and controls
76 lines (62 loc) · 1.36 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.deft.sarcasm.features;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import com.deft.sarcasm.util.TextUtility;
public class PunctFeatureLoader extends FeatureLoader
{
@Override
public Map<Integer, Double> loadFeatures(String[] tokens) {
// TODO Auto-generated method stub
return null;
}
public List<Integer> getPuncFVs(int xclm, int ques, int quotes)
{
// TODO Auto-generated method stub
List<Integer> puncs = new ArrayList<Integer>() ;
if(xclm > 1)
{
puncs.add(90) ;
}
if(ques > 1)
{
puncs.add(91) ;
}
if(quotes > 1)
{
puncs.add(92) ;
}
return puncs;
}
public TreeMap<String,Double> getPuncFVs(String line)
{
// TODO Auto-generated method stub
double xclm = 0.0 ;
double ques = 0.0 ;
double quotes = 0.0 ;
xclm = TextUtility.countChars(line,'!');
ques = TextUtility.countChars(line,'?');
quotes = TextUtility.countChars(line,'"');
TreeMap<String,Double> puncs = new TreeMap<String,Double>() ;
if(xclm > 0)
{
puncs.put("!_"+xclm,1.0) ;
}
if(ques > 0)
{
puncs.put("?_"+ques,1.0) ;
}
if(quotes > 1)
{
puncs.put("\"_"+quotes,1.0) ;
}
return puncs;
}
@Override
public Map<String, Double> loadNonLexFeatures(String[] tokens) {
// TODO Auto-generated method stub
return null;
}
}