Package seekfeel.utilities.stanfordwrapper

Examples of seekfeel.utilities.stanfordwrapper.StanfordParser


    String clauseEnds;
    ArrayList<ArrayList<Word>> parsedInverters;

    public SentiPanel() {
        aggregator = new ScoreAggregator();
        sParser = new StanfordParser(Language.English);
        initializeResources();
    }
View Full Code Here


public class SentimentValueComputer extends FeatureValueComputer {

    StanfordParser theParser;

    public SentimentValueComputer() {
        theParser = new StanfordParser(Language.English);
    }
View Full Code Here

    @Override
    public LinkedHashMap<Integer, Double> computeFeatures(DataUnit example, ArrayList<Feature> features, CorpusHolder corpus) {
        LinkedHashMap<Integer, Double> featuresValues = new LinkedHashMap<Integer, Double>();
        ArrayList<Feature> taggedStems = new ArrayList<Feature>();
        TaggedStem temp;
        StanfordParser theParser = new StanfordParser(Language.Arabic);
        ParsingOptions opts = new ParsingOptions();
        opts.setPosTag(true);
        ArrayList<Word> textWords;
        ParsedData parsedOut;
        ArabicStemmerKhoja arabicStemmer = new ArabicStemmerKhoja();
        // Convert the Example into a tagged Stems Array
        textWords = StringToWordsTokenizer.tokenize(example.getDataBody());
        example.getDataBody();
        parsedOut = theParser.parse(textWords, opts);
        for (int i = 0; i < parsedOut.getTaggedWords().size(); i++) {
            temp = new TaggedStem();
            temp.setStemTag(parsedOut.getTaggedWords().get(i).getWordTag());
            temp.setTheStem(arabicStemmer.stem(textWords.get(i).word()));
View Full Code Here

    @Override
    public ArrayList<Feature> extractFeatures(CorpusHolder corpus) {
        // Preprocess the input text : result : ArrayList of words
        // POSTag it : Result Parsed Data Object
        ArrayList<Feature> allFeats = new ArrayList<Feature>();
        StanfordParser theParser = new StanfordParser(Language.English);
        ArrayList<DataUnit> posExamples = corpus.getPositiveExamples();
        ArrayList<DataUnit> negExamples = corpus.getNegativeExamples();
        ArrayList<PosTag> neededTags = new ArrayList<PosTag>();

        neededTags.add(PosTag.RB);
        neededTags.add(PosTag.RBR);
        neededTags.add(PosTag.RBS);
        neededTags.add(PosTag.RP);
        neededTags.add(PosTag.JJ);
        neededTags.add(PosTag.JJR);
        neededTags.add(PosTag.JJS);
        neededTags.add(PosTag.VB);
        neededTags.add(PosTag.VBD);
        neededTags.add(PosTag.VBG);
        neededTags.add(PosTag.VBN);
        neededTags.add(PosTag.VBP);
        neededTags.add(PosTag.VBZ);

        ParsedData parsingResult = null;
        ParsingOptions opts = new ParsingOptions();
        opts.setNeededTags(neededTags);
        opts.setPosTag(true);


        ArrayList<Word> allWords;

        for (DataUnit posReview : posExamples) {
            allWords = StringToWordsTokenizer.tokenize(posReview.getDataBody());
            parsingResult = theParser.parse(allWords, opts);
            updateAllFeatures(allFeats, parsingResult, allWords);
        }

        for (DataUnit negReview : negExamples) {
            allWords = StringToWordsTokenizer.tokenize(negReview.getDataBody());
            parsingResult = theParser.parse(allWords, opts);
            try {
                parsingResult = theParser.parse(allWords, opts);
            } catch (Exception e) {
                System.out.println(e.toString());
            }
            updateAllFeatures(allFeats, parsingResult, allWords);
        }
View Full Code Here

    public ArrayList<Feature> extractFeatures(CorpusHolder corpus) {
        ArrayList<DataUnit> positiveExs = corpus.getPositiveExamples();
        ArrayList<DataUnit> negativeExs = corpus.getNegativeExamples();
        ArrayList<Feature> taggedStems = new ArrayList<Feature>();
        TaggedStem temp;
        StanfordParser theParser = new StanfordParser(Language.Arabic);
        ParsingOptions opts = new ParsingOptions();
        opts.setPosTag(true);
        ArrayList<Word> textWords;
        ParsedData parsedOut;
        ArabicStemmerKhoja arabicStemmer = new ArabicStemmerKhoja();
        for (DataUnit textUnit : positiveExs) {
            textWords = StringToWordsTokenizer.tokenize(textUnit.getDataBody());
            textUnit.getDataBody();
            parsedOut = theParser.parse(textWords, opts);
            for (int i = 0; i < parsedOut.getTaggedWords().size(); i++) {
                temp = new TaggedStem();
                temp.setStemTag(parsedOut.getTaggedWords().get(i).getWordTag());
                temp.setTheStem(arabicStemmer.stem(textWords.get(i).word()));

                if (!taggedStems.contains(temp)) {
                    taggedStems.add(temp);
                }
            }
        }
        for (DataUnit textUnit : negativeExs) {
            textWords = StringToWordsTokenizer.tokenize(textUnit.getDataBody());
            textUnit.getDataBody();
            parsedOut = theParser.parse(textWords, opts);
            for (int i = 0; i < parsedOut.getTaggedWords().size(); i++) {
                temp = new TaggedStem();
                temp.setStemTag(parsedOut.getTaggedWords().get(i).getWordTag());
                temp.setTheStem(arabicStemmer.stem(textWords.get(i).word()));
View Full Code Here

TOP

Related Classes of seekfeel.utilities.stanfordwrapper.StanfordParser

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.