io.github.crew102:rapidrake

A fast version of the Rapid Automatic Keyword Extraction (RAKE) algorithm

License

License

GroupId

GroupId

io.github.crew102
ArtifactId

ArtifactId

rapidrake
Last Version

Last Version

0.1.4
Release Date

Release Date

Type

Type

jar
Description

Description

io.github.crew102:rapidrake
A fast version of the Rapid Automatic Keyword Extraction (RAKE) algorithm
Project URL

Project URL

https://github.com/crew102/rapidrake-java
Source Code Management

Source Code Management

http://github.com/crew102/rapidrake-java/tree/master

Download rapidrake

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.crew102/rapidrake/ -->
<dependency>
    <groupId>io.github.crew102</groupId>
    <artifactId>rapidrake</artifactId>
    <version>0.1.4</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.crew102/rapidrake/
implementation 'io.github.crew102:rapidrake:0.1.4'
// https://jarcasting.com/artifacts/io.github.crew102/rapidrake/
implementation ("io.github.crew102:rapidrake:0.1.4")
'io.github.crew102:rapidrake:jar:0.1.4'
<dependency org="io.github.crew102" name="rapidrake" rev="0.1.4">
  <artifact name="rapidrake" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.crew102', module='rapidrake', version='0.1.4')
)
libraryDependencies += "io.github.crew102" % "rapidrake" % "0.1.4"
[io.github.crew102/rapidrake "0.1.4"]

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.opennlp : opennlp-tools jar 1.8.1
org.apache.maven.plugins : maven-javadoc-plugin jar 2.9.1
org.jetbrains : annotations jar RELEASE

test (1)

Group / Artifact Type Version
junit : junit jar 4.13.1

Project Modules

There are no modules declared in this project.

rapidrake

A fast version of the Rapid Automatic Keyword Extraction (RAKE) algorithm

Linux Build Status Maven Central

Installation

Assuming you're using Maven, follow these two steps to use rakidrake in your Java project:

  1. Include a dependency on rapidrake in your POM:
<dependency>
    <groupId>io.github.crew102</groupId>
    <artifactId>rapidrake</artifactId>
    <version>0.1.4</version>
</dependency>
  1. Download the opennlp trained models for sentence detection and part-of-speech tagging. You can find these two models (trained on various languages) on opennlp's model page. For example, you could use the English versions of the sentence detection and POS-tagger models. You'll specify the file paths to these models when you instantiate a RakeAlgorithm object (see below for example).

Basic usage

import io.github.crew102.rapidrake.RakeAlgorithm;
import io.github.crew102.rapidrake.data.SmartWords;
import io.github.crew102.rapidrake.model.RakeParams;
import io.github.crew102.rapidrake.model.Result;

public class Example {

  public static void main(String[] args) throws java.io.IOException {
    
    // Create an object to hold algorithm parameters
    String[] stopWords = new SmartWords().getSmartWords(); 
    String[] stopPOS = {"VB", "VBD", "VBG", "VBN", "VBP", "VBZ"}; 
    int minWordChar = 1;
    boolean shouldStem = true;
    String phraseDelims = "[-,.?():;\"!/]"; 
    RakeParams params = new RakeParams(stopWords, stopPOS, minWordChar, shouldStem, phraseDelims);
    
    // Create a RakeAlgorithm object
    String POStaggerURL = "model-bin/en-pos-maxent.bin"; // The path to your POS tagging model
    String SentDetecURL = "model-bin/en-sent.bin"; // The path to your sentence detection model
    RakeAlgorithm rakeAlg = new RakeAlgorithm(params, POStaggerURL, SentDetecURL);
    
    // Call the rake method
    String txt = "dogs are great, don't you agree? I love dogs, especially big dogs";
    Result result = rakeAlg.rake(txt);
    
    // Print the resulting keywords (not stemmed)
    System.out.println(result.distinct());
    
  }
}

// [dogs (1.33), great (1), big dogs (3.33)]

Learning more

You can learn more about how RAKE works and the various parameters you can set by visiting slowraker's website.

Versions

Version
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0