Skip to content

cschen1205/java-deep-learning-nlp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-deep-learning-nlp

Deep Learning for Natural Language Processing in Java

The current project supports pure Java solution for NLP using Tensorflow. Currently supported features include:

  • Sentiment Analysis

Sentiment Analysis

The sample codes show how to use DeepText to perform sentiment analysis:

import com.github.cschen1205.tensorflow.classifiers.sentiment.models.Sentiment;
import com.github.cschen1205.tensorflow.classifiers.sentiment.utils.ResourceUtils;
import com.github.cschen1205.tensorflow.classifiers.sentiment.utils.ResourceUtils;

import java.io.IOException;
import java.util.List;

public class DeepTextDemo {
    public static void main(String[] args) throws IOException {
        DeepText classifier = new DeepText();

        List<String> lines = ResourceUtils.getLines("data/umich-sentiment-train.txt");

        for(String line : lines){
            String label = line.split("\t")[0];
            String text = line.split("\t")[1];
            Sentiment sentiment = classifier.predictSentiment(text);
            System.out.println("Actual: " + label);
            System.out.println("Predicted: " + sentiment);

        }
    }
}

About

Deep Learning for Natural Language Processing in Java

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages