Package seekfeel.dataholders

Examples of seekfeel.dataholders.SubjectivityClue


    private static void loadClues() {
        allClues = new ArrayList<SubjectivityClue>();
        ArrayList<String> cluesRecords = FilesReader.getAllLines(PropertiesGetter.getProperty("SubjectivityClues"));
        String[] lineTokens;
        SubjectivityClue currentClue;
        String wordPos;
        double weight = 0;
        String strength;
        String polarity;
        for (String line : cluesRecords) {
            currentClue = new SubjectivityClue();
            lineTokens = line.split(" ");
            currentClue.setTheWord(lineTokens[2].split("=")[1]);
            wordPos = lineTokens[3].split("=")[1];
            if (wordPos.startsWith("adj")) {
                currentClue.setWordTag(PosTag.ADJGeneral);
            } else if (wordPos.startsWith("v")) {
                currentClue.setWordTag(PosTag.VBGeneral);
            } else if (wordPos.startsWith("adv")) {
                currentClue.setWordTag(PosTag.RBGeneral);
            } else if (wordPos.startsWith("n")) {
                currentClue.setWordTag(PosTag.NNGeneral);
            } else {
                currentClue.setWordTag(PosTag.Unknown);
            }
            try {
                strength = lineTokens[0].split("=")[1];
                polarity = lineTokens[5].split("=")[1];
                if (polarity.equals("positive")) {
                    weight = 1;
                } else if (polarity.equals("negative")) {
                    weight = -1;
                }

                weight = strength.startsWith("strong") ? weight : weight * 0.5;
                currentClue.setWeight(weight);
                allClues.add(currentClue);

            } catch (Exception e) {
                System.out.println(currentClue.getTheWord());
            }
        }
    }
View Full Code Here


            }
        }
    }

    public static Double extractWeight(String word, PosTag wordPos) {
        SubjectivityClue candidateClue = new SubjectivityClue();
        candidateClue.setTheWord(word);
        candidateClue.setWordTag(wordPos);
        int clueIndex = allClues.indexOf(candidateClue);
        if (clueIndex == -1) {
            return null;
        } else {
            return allClues.get(clueIndex).getWeight();
View Full Code Here

TOP

Related Classes of seekfeel.dataholders.SubjectivityClue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.