Package com.music.service.text.SentimentAnalyzer

Examples of com.music.service.text.SentimentAnalyzer.SentimentResult


    public void testSentimentAnalyzer() {
        SentimentAnalyzer analyzer = new SentimentAnalyzer();
        analyzer.init();

        TimelineMusic meta = new TimelineMusic();
        SentimentResult result = analyzer.getSentiment(Sets.newHashSet("This sucks", "Too bad it didn't happen", "Not cool, man"), meta);
        assertEquals(SentimentResult.NEGATIVE, result);

        result = analyzer.getSentiment(Sets.newHashSet("Whatever", "I'm coming tomorrow by bus", "Three cities participated in the campagin"), meta);
        assertEquals(SentimentResult.NEUTRAL, result);
View Full Code Here


    private Scale getScale(List<Tweet> tweets, TimelineMusic meta) {
        Set<String> documents = new HashSet<>();
        for (Tweet tweet : tweets) {
            documents.add(tweet.getText());
        }
        SentimentResult sentiment = sentimentAnalyzer.getSentiment(documents, meta);

        double totalLength = 0;
        for (String document : documents) {
            totalLength += document.length();
        }
View Full Code Here

TOP

Related Classes of com.music.service.text.SentimentAnalyzer.SentimentResult

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.