Package seekfeel.utilities.stanfordwrapper

Examples of seekfeel.utilities.stanfordwrapper.DependencyTree


        nouns.addAll(resultData.getPronouns());
        double totalScore = 0;

        ArrayList<Integer> visistedWords = new ArrayList<Integer>();
        for (WordPos noun : nouns) {
            DependencyTree currentTree = resultData.getDependencyTree(noun, visistedWords, null);
            totalScore += computeTreeWeight(currentTree, allWords);
        }

        return evaluateSentiment(totalScore);
    }
View Full Code Here


    public double computeTreeWeight(DependencyTree root, ArrayList<Word> originalWords) {
        double totalWeight = 0;
        int signMultiplier;
        Stack<DependencyTree> s = new Stack<DependencyTree>();
        DependencyTree iterator;
        for (int i = 0; i < root.getChilds().size(); i++) {
            s.push(root.getChild(i));
        }
        while (!s.empty()) {
            iterator = s.pop();
            signMultiplier = iterator.isNegated() ? -1 : 1;
            totalWeight += (signMultiplier * aggregator.getWordScore(iterator.getWord(), originalWords));
            for (int i = 0; i < iterator.getChilds().size(); i++) {
                s.push(iterator.getChild(i));
            }
        }
        return totalWeight;
    }
View Full Code Here

TOP

Related Classes of seekfeel.utilities.stanfordwrapper.DependencyTree

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.