All Projects → monkeylearn → monkeylearn-java

monkeylearn / monkeylearn-java

Licence: MIT License
Official Java client for the MonkeyLearn API. Build and consume machine learning models for language processing from your Java apps.

Programming Languages

java
68154 projects - #9 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to monkeylearn-java

monkeylearn-php
Official PHP client for the MonkeyLearn API. Build and consume machine learning models for language processing from your PHP apps.
Stars: ✭ 47 (+104.35%)
Mutual labels:  text-classification, language-processing
NLP Quickbook
NLP in Python with Deep Learning
Stars: ✭ 516 (+2143.48%)
Mutual labels:  text-classification, language-processing
HiGRUs
Implementation of the paper "Hierarchical GRU for Utterance-level Emotion Recognition" in NAACL-2019.
Stars: ✭ 60 (+160.87%)
Mutual labels:  text-classification
TorchBlocks
A PyTorch-based toolkit for natural language processing
Stars: ✭ 85 (+269.57%)
Mutual labels:  text-classification
Naive-Resume-Matching
Text Similarity Applied to resume, to compare Resumes with Job Descriptions and create a score to rank them. Similar to an ATS.
Stars: ✭ 27 (+17.39%)
Mutual labels:  text-classification
pytamil
பைந்தமிழ் (pytamil) library is intended to be used in analysis of tamil literary work. A wealth of knowledge is hidden in old literature. They are time machines to past. Ever wondered what is the popular color or food in tamil speaking world in 500AD. The answer is hidden in literature. With right computer tools it becomes possible for us to dig…
Stars: ✭ 41 (+78.26%)
Mutual labels:  language-processing
C90Compiler-EIE2
C90 to MIPS I Compiler done as a coursework for EE2-15
Stars: ✭ 15 (-34.78%)
Mutual labels:  language-processing
nlp classification
Implementing nlp papers relevant to classification with PyTorch, gluonnlp
Stars: ✭ 224 (+873.91%)
Mutual labels:  text-classification
Python-for-Text-Classification
Python for Text Classification with Machine Learning in Python 3.6.
Stars: ✭ 32 (+39.13%)
Mutual labels:  text-classification
MetaLifelongLanguage
Repository containing code for the paper "Meta-Learning with Sparse Experience Replay for Lifelong Language Learning".
Stars: ✭ 21 (-8.7%)
Mutual labels:  text-classification
NewsMTSC
Target-dependent sentiment classification in news articles reporting on political events. Includes a high-quality data set of over 11k sentences and a state-of-the-art classification model.
Stars: ✭ 54 (+134.78%)
Mutual labels:  text-classification
classification
Vietnamese Text Classification
Stars: ✭ 39 (+69.57%)
Mutual labels:  text-classification
MetaCat
Minimally Supervised Categorization of Text with Metadata (SIGIR'20)
Stars: ✭ 52 (+126.09%)
Mutual labels:  text-classification
textgo
Text preprocessing, representation, similarity calculation, text search and classification. Let's go and play with text!
Stars: ✭ 33 (+43.48%)
Mutual labels:  text-classification
small-text
Active Learning for Text Classification in Python
Stars: ✭ 241 (+947.83%)
Mutual labels:  text-classification
HiGitClass
HiGitClass: Keyword-Driven Hierarchical Classification of GitHub Repositories (ICDM'19)
Stars: ✭ 58 (+152.17%)
Mutual labels:  text-classification
extremeText
Library for fast text representation and extreme classification.
Stars: ✭ 141 (+513.04%)
Mutual labels:  text-classification
Product-Categorization-NLP
Multi-Class Text Classification for products based on their description with Machine Learning algorithms and Neural Networks (MLP, CNN, Distilbert).
Stars: ✭ 30 (+30.43%)
Mutual labels:  text-classification
text-classification-small-datasets
Building a text classifier with extremely small datasets
Stars: ✭ 34 (+47.83%)
Mutual labels:  text-classification
NSP-BERT
The code for our paper "NSP-BERT: A Prompt-based Zero-Shot Learner Through an Original Pre-training Task —— Next Sentence Prediction"
Stars: ✭ 166 (+621.74%)
Mutual labels:  text-classification

monkeylearn-java

Official Java client for the MonkeyLearn API. Build and consume machine learning models for language processing from your Java apps.

Install

Using maven:

<dependency>
  <groupId>com.monkeylearn</groupId>
  <artifactId>monkeylearn-java</artifactId>
  <version>0.1.5</version>
  <scope>compile</scope>
</dependency>

Or if you want to compile it yourself:

$ git clone [email protected]:monkeylearn/monkeylearn-java
$ cd monkeylearn-java
$ mvn install       # Requires maven, download from http://maven.apache.org/download.html

You can also download the compiled jar from here.

Usage examples

Here are some examples of how to use the library in order to create and use classifiers:

import com.monkeylearn.MonkeyLearn;
import com.monkeylearn.MonkeyLearnResponse;
import com.monkeylearn.MonkeyLearnException;
import com.monkeylearn.Tuple;

import org.json.simple.JSONObject;
import org.json.simple.JSONArray;

import java.util.ArrayList;

public class App {
    public static void main( String[] args ) throws MonkeyLearnException {

        // Use the API key from your account
        MonkeyLearn ml = new MonkeyLearn("<YOUR API KEY HERE>");

        // Create a new classifier
        MonkeyLearnResponse res = ml.classifiers.create("Test Classifier", "Some description");

        // Get the id of the new module
        String moduleId = (String) ((JSONObject)res.jsonResult.get("classifier")).get("hashed_id");

        // Get the id of the root node
        res = ml.classifiers.detail(moduleId);
        Integer rootId = ((Long) ((JSONObject)((JSONArray)res.jsonResult.get("sandbox_categories")).get(0)).get("id")).intValue();

        // Create two new categories on the root node
        res = ml.classifiers.categories.create(moduleId, "Negative", rootId);
        Integer negativeId = ((Long) ((JSONObject)res.jsonResult.get("category")).get("id")).intValue();
        res = ml.classifiers.categories.create(moduleId, "Positive", rootId);
        Integer positiveId = ((Long) ((JSONObject)res.jsonResult.get("category")).get("id")).intValue();

        // Now let's upload some samples
        ArrayList samples = new ArrayList();
        samples.add(new Tuple<String, Integer>("The movie was terrible, I hated it.", negativeId));
        samples.add(new Tuple<String, Integer>("I love this movie, I want to watch it again!", positiveId));
        res = ml.classifiers.uploadSamples(moduleId, samples);

        // Now let's train the module!
        res = ml.classifiers.train(moduleId);

        // Classify some texts
        String[] textList = {"I love the movie", "I hate the movie"};
        res = ml.classifiers.classify(moduleId, textList, true);

        System.out.println( res.arrayResult );
    }
}

You can also use the sdk with extractors:

import com.monkeylearn.MonkeyLearn;
import com.monkeylearn.MonkeyLearnResponse;
import com.monkeylearn.MonkeyLearnException;
import com.monkeylearn.Tuple;
import com.monkeylearn.ExtraParam;

import org.json.simple.JSONObject;
import org.json.simple.JSONArray;

import java.util.ArrayList;

public class App {
    public static void main( String[] args ) throws MonkeyLearnException {

        // Use the API key from your account
        MonkeyLearn ml = new MonkeyLearn("<YOUR API KEY HERE>");

        // Use the keyword extractor
        String[] textList = {"I love the movie", "I hate the movie"};
        ExtraParam[] extraParams = {new ExtraParam("max_keywords", "30")};
        MonkeyLearnResponse res = ml.extractors.extract("ex_y7BPYzNG", textList, extraParams);
        System.out.println( res.arrayResult );


    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].