Keyword Density API for Java
Download the latest JAR or grab via Maven:
<dependency>
<groupId>org.brunocvcunha.dense4j</groupId>
<artifactId>dense4j</artifactId>
<version>0.2</version>
</dependency>
or Gradle:
compile 'org.brunocvcunha.dense4j:dense4j:0.2'
Snapshots of the development version are available in Sonatype's snapshots
repository.
Dense4j requires at minimum Java 6.
Java App:
import org.brunocvcunha.dense4j.DenseCalculator;
public class Dense4jMain {
public static void main(String[] args) throws IOException {
String text = "Dense4j is an API developed by Bruno Candido Volpato da Cunha. " +
"Bruno decided to start Dense4j in 2015.";
Map<String, Integer> density = DenseCalculator.getKeywordsMap(text);
System.out.println("Density Map: " + density.toString());
System.out.println("Density for Bruno is: " + density.get("bruno"));
}
}