Stemming.java Analisis sentimen data twitter menggunakan K-Means Clustering.
114
} else if dictionary.containst + word.substring3 { word = t + word.substring3;
} else if word.startsWithpeng { if dictionary.containsk + word.substring4 {
word = k + word.substring4; } else if dictionary.containsword.substring4 {
word = word.substring4; }
} else if word.startsWithpeny { if dictionary.containss + word.substring4 {
word = s + word.substring4; }
} }
} }
if dictionary.containsword { if word.startsWithme {
if dictionary.containsword.substring2 { word = word.substring2;
} else if word.startsWithmem { if word.substring3, 4.matches[bpf] {
word = word.substring3; } else if dictionary.containsp + word.substring3 {
word = p + word.substring3; }
} else if word.startsWithmen { if word.substring3, 4.matches[cdj] {
word = word.substring3; } else if dictionary.containst + word.substring3 {
word = t + word.substring3; } else if word.startsWithmeng {
if word.substring4, 5.matches[gh] {
115
word = word.substring4; } else if dictionary.containsk + word.substring4 {
word = k + word.substring4; } else if dictionary.containsword.substring4 {
word = word.substring4; }
} else if word.startsWithmeny { if dictionary.containss + word.substring4 {
word = s + word.substring4; }
} }
} }
if dictionary.containsword { if word.startsWithm {
if dictionary.containsp + word.substring1 { word = p + word.substring1;
} else if dictionary.containsword.substring1 { word = word.substring1;
} } else if word.startsWithng {
if word.startsWithnge { if dictionary.containsnge + word.substring3 {
word = word.substring3; }
} else if dictionary.containsk + word.substring2 { word = k + word.substring2;
} else if dictionary.containsword.substring2 { word = word.substring2;
} } else if word.startsWithny {
if dictionary.containsc + word.substring2 {
116
word = c + word.substring2; } else if dictionary.containss + word.substring2 {
word = s + word.substring2; } else if dictionary.containsword.substring2 {
word = word.substring2; }
} else if word.startsWithn { if dictionary.containst + word.substring1 {
word = t + word.substring1; }
} }
} catch StringIndexOutOfBoundsException e { return word;
} return word;
} private String deleteSuffix {
if dictionary.containsword { if word.endsWithlah {
word = word.substring0, word.length - 3; } else if word.endsWithkah {
word = word.substring0, word.length - 3; } else if word.endsWithtah {
word = word.substring0, word.length - 3; } else if word.endsWithpun {
word = word.substring0, word.length - 3; }
} if dictionary.containsword {
if word.endsWithku { word = word.substring0, word.length - 2;
117
} else if word.endsWithmu { word = word.substring0, word.length - 2;
} else if word.endsWithnya { word = word.substring0, word.length - 3;
} else if word.endsWithny { word = word.substring0, word.length - 2;
} }
if dictionary.containsword { if word.endsWithi {
word = word.substring0, word.length - 1; }
if word.endsWithan { if word.endsWithkan {
word = word.substring0, word.length - 3; } else {
word = word.substring0, word.length - 2; }
} if dictionary.containsword {
if word.endsWithin { word = word.substring0, word.length - 2;
} }
} return word;
} private String deleteReduplicate {
String firstWord; String lastWord;
if word.contains- {
118
firstWord = word.substring0, word.indexOf-; lastWord = word.substringword.indexOf- + 1;
if dictionary.containsfirstWord { word = firstWord;
} else if dictionary.containslastWord { word = lastWord;
} else { word = lastWord;
} }
return word; }
}