public FeatureExtractionPolarity(String review) { this.review = review; ngrams = new Ngrams(review); this.Lines = new ArrayList<>(); unigramFeatureSet = new HashMap<>(); BagOfWords = ngrams.getWordSplit(); staticObjects(); BreakInLines(); }
public double getTrigramScore() { ArrayList<String> trigrams = ngrams.getNgrams(3); double score = 0; for (String string : trigrams) { if (dictionary.containsKey(string + "#a")) score += dictionary.get(string + "#a"); else if (dictionary.containsKey(string + "#r")) score += dictionary.get(string + "#r"); else if (dictionary.containsKey(string + "#n")) score += dictionary.get(string + "#n"); else if (dictionary.containsKey(string + "#v")) score += dictionary.get(string + "#v"); } return score; }