Commit bc114965 authored by Mahdi Sellami's avatar Mahdi Sellami
Browse files

initial commit

parent 388022f5
FROM openjdk:8
ADD classification-1.0-SNAPSHOT.jar ./classification-1.0-SNAPSHOT.jar
ADD config.yml ./config.yml
CMD java -jar classification-1.0-SNAPSHOT.jar server ./config.yml
EXPOSE 9000 9001
\ No newline at end of file
# classificationservice
# wrapperservice
How to start the classificationservice application
---
1. Run `mvn clean install` to build your application
1. Start application with `java -jar target/classification-1.0-SNAPSHOT.jar server config.yml`
1. To check that your application is running enter url `http://localhost:9000`
1. Start application with `java -jar target/wrapper-1.0-SNAPSHOT.jar server config.yml`
1. To check that your application is running enter url `http://localhost:9004`
Health Check
---
To see your applications health enter url `http://localhost:9001/healthcheck`
To see your applications health enter url `http://localhost:9005/healthcheck`
......@@ -20,10 +20,10 @@ defaultEmptyResponse: No Data Received
server:
applicationConnectors:
- type: http
port: 9000
port: 9004
adminConnectors:
- type: http
port: 9001
port: 9005
# Database settings.
database:
......@@ -37,4 +37,4 @@ database:
url: jdbc:mysql://localhost:3306/tmms
swagger:
resourcePackage: org.tmms.classification
\ No newline at end of file
resourcePackage: org.tmms.wrapper
\ No newline at end of file
......@@ -7,18 +7,18 @@
<maven>3.0.0</maven>
</prerequisites>
<groupId>org.tmms.classification</groupId>
<artifactId>classification</artifactId>
<groupId>org.tmms.wrapper</groupId>
<artifactId>wrapper</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>classificationservice</name>
<name>wrapperservice</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<dropwizard.version>1.3.0</dropwizard.version>
<mainClass>org.tmms.classification.classificationserviceApplication</mainClass>
<mainClass>org.tmms.wrapper.wrapperserviceApplication</mainClass>
</properties>
<dependencyManagement>
......@@ -37,79 +37,57 @@
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-assets</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-hibernate</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-migrations</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.smoketurner</groupId>
<artifactId>dropwizard-swagger</artifactId>
<version>1.3.1-1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.36</version>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>${dropwizard.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.9.1</version>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-forms</artifactId>
<version>${dropwizard.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.9.1</version>
<classifier>models</classifier> <!-- will get the dependent model jars -->
<groupId>com.smoketurner</groupId>
<artifactId>dropwizard-swagger</artifactId>
<version>1.3.1-1</version>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.9.1</version>
<classifier>models-german</classifier> <!-- will get the dependent model jars -->
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-tools</artifactId>
<version>1.8.4</version>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>de.julielab</groupId>
<artifactId>aliasi-lingpipe</artifactId>
<version>4.1.0</version>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.36</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
......
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>${project.artifactId}</id>
<files>
<file>
<source>target/${project.build.finalName}.jar</source>
<outputDirectory>/</outputDirectory>
</file>
<file>
<source>src/main/resources/docker-config.yml</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
</assembly>
\ No newline at end of file
package org.tmms.classification.api;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* A class to store Categorization data.
*/
@ApiModel(description = "Categorization Model")
@Entity
@Table(name = "categorizations")
@NamedQueries({
@NamedQuery(name = "org.tmms.classification.api.Categorization.findAll", query = "select c from Categorization c"),
@NamedQuery(name = "org.tmms.classification.api.Categorization.findByCategory", query = "select c from Categorization c "
+ "where c.category like :category ") })
public class Categorization implements Serializable {
/**
* Entity's unique identifier.
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
/**
* Input idea.
*/
private String idea;
/**
* output category.
*/
private String category;
/**
* A no-argument constructor.
*/
public Categorization() {
}
/**
* A constructor to create Categorizations. Id is not passed, cause it's
* auto-generated by RDBMS.
*
* @param idea
* the input idea.
* @param category
* the output category.
*/
public Categorization(String idea, String category) {
this.idea = idea;
this.category = category;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((category == null) ? 0 : category.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((idea == null) ? 0 : idea.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Categorization other = (Categorization) obj;
if (category == null) {
if (other.category != null)
return false;
} else if (!category.equals(other.category))
return false;
if (id != other.id)
return false;
if (idea == null) {
if (other.idea != null)
return false;
} else if (!idea.equals(other.idea))
return false;
return true;
}
@JsonProperty
@ApiModelProperty(value = "The Categorization id", example = "1")
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@JsonProperty
@ApiModelProperty(value = "The input idea", example = "This is my idea.")
public String getIdea() {
return idea;
}
public void setIdea(String idea) {
this.idea = idea;
}
@JsonProperty
@ApiModelProperty(value = "The Categorization result", example = "Sports")
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
}
package org.tmms.classification.api;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* A class to store Lemmatization data.
*/
@ApiModel(description = "Lemmatization Model")
@Entity
@Table(name = "lemmas")
@NamedQueries({ @NamedQuery(name = "org.tmms.classification.api.Lemma.findAll", query = "select l from Lemma l"), })
public class Lemma implements Serializable {
/**
* Entity's unique identifier.
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
/**
* Input data.
*/
private String data;
/**
* Lemmatization result.
*/
private String lemma;
/**
* A no-argument constructor.
*/
public Lemma() {
}
/**
* A constructor to create Lemmatizations. Id is not passed, cause it's
* auto-generated by RDBMS.
*
* @param data
* the input data.
* @param lemma
* the Lemmatization result.
*/
public Lemma(String data, String lemma) {
this.data = data;
this.lemma = lemma;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((data == null) ? 0 : data.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((lemma == null) ? 0 : lemma.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Lemma other = (Lemma) obj;
if (data == null) {
if (other.data != null)
return false;
} else if (!data.equals(other.data))
return false;
if (id != other.id)
return false;
if (lemma == null) {
if (other.lemma != null)
return false;
} else if (!lemma.equals(other.lemma))
return false;
return true;
}
@JsonProperty
@ApiModelProperty(value = "The Lemmatization id", example = "1")
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@JsonProperty
@ApiModelProperty(value = "The input data", example = "Input text.")
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@JsonProperty
@ApiModelProperty(value = "The Lemmatization result", example = "Output lemma.")
public String getLemma() {
return lemma;
}
public void setLemma(String lemma) {
this.lemma = lemma;
}
}
package org.tmms.classification.api;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* A class to store Named Entity Recognition data.
*/
@ApiModel(description = "Named-Entity-Recognition Model")
@Entity
@Table(name = "ners")
@NamedQueries({
@NamedQuery(name = "org.tmms.classification.api.NamedEntityRecognition.findAll", query = "select n from NamedEntityRecognition n"), })
public class NamedEntityRecognition implements Serializable {
/**
* Entity's unique identifier.
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
/**
* Input data.
*/
private String data;
/**
* Named Entity Recognition result.
*/
private String ner;
/**
* A no-argument constructor.
*/
public NamedEntityRecognition() {
}
/**
* A constructor to create Named Entity Recognitions. Id is not passed,
* cause it's auto-generated by RDBMS.
*
* @param data
* the input data.
* @param ner
* the Named Entity Recognition result.
*/
public NamedEntityRecognition(String data, String ner) {
this.data = data;
this.ner = ner;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((data == null) ? 0 : data.hashCode());
result = prime * result + (int) (id ^ (id >>> 32));
result = prime * result + ((ner == null) ? 0 : ner.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NamedEntityRecognition other = (NamedEntityRecognition) obj;
if (data == null) {
if (other.data != null)
return false;
} else if (!data.equals(other.data))
return false;
if (id != other.id)
return false;
if (ner == null) {
if (other.ner != null)
return false;
} else if (!ner.equals(other.ner))
return false;
return true;
}
@JsonProperty
@ApiModelProperty(value = "The Named-Entity-Recognition id", example = "1")
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@JsonProperty
@ApiModelProperty(value = "The input data", example = "Input text.")
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
@JsonProperty
@ApiModelProperty(value = "The Named-Entity-Recognition result", example = "Output NERs.")
public String getNer() {
return ner;
}
public void setNer(String ner) {
this.ner = ner;
}
}
package org.tmms.classification.api;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* A class to store Part-Of-Speech Tagging data.
*/
@ApiModel(description = "Part-Of-Speech tagging Model")
@Entity
@Table(name = "poss")
@NamedQueries({
@NamedQuery(name = "org.tmms.classification.api.PartOfSpeech.findAll", query = "select p from PartOfSpeech p"), })
public class PartOfSpeech implements Serializable {