Skip to content

Commit

Permalink
Merge pull request #109 from SOBotics/develop
Browse files Browse the repository at this point in the history
Release 0.9.0
  • Loading branch information
FelixSFD authored Nov 1, 2017
2 parents df60b6f + dfe700a commit ef5edbe
Show file tree
Hide file tree
Showing 26 changed files with 1,364 additions and 364 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Guttenberg is a bot that searches for plagiarism or duplicated answers on Stack

## Implementation

Every 60 seconds, Guttenberg fetches the most recent answers (the "targets") on Stack Overflow. For each of these answers, possibly related posts (for example answers to related questions) are collected. All those posts will be checked for different characteristics (such as the [Jaro-Winkler distance](https://en.wikipedia.org/wiki/Jaro–Winkler_distance) of the posts). If at least one of the characteristics mets the requirements, a message like this will be posted in chat:
Every 60 seconds, Guttenberg fetches the most recent answers (the "targets") on Stack Overflow. For each of these answers, possibly related posts (for example answers to related questions) are collected. All those posts will be checked for different characteristics (such as the [Jaro-Winkler distance](https://en.wikipedia.org/wiki/Jaro–Winkler_distance) of the posts). If at least one of the characteristics meets the requirements, a message like this will be posted in chat:

![sample chat message](http://i.stack.imgur.com/hB7Hz.png)

Expand Down
223 changes: 114 additions & 109 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,114 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>de.felixsfd.stackoverflow</groupId>
<artifactId>guttenberg</artifactId>
<version>0.8.0</version>
<groupId>de.felixsfd.stackoverflow</groupId>
<artifactId>guttenberg</artifactId>
<version>0.9.0</version>

<dependencies>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>fr.tunaki.stackoverflow</groupId>
<artifactId>chatexchange</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.optimaize.languagedetector</groupId>
<artifactId>language-detector</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-langdetect</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
<dependencies>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>fr.tunaki.stackoverflow</groupId>
<artifactId>chatexchange</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.optimaize.languagedetector</groupId>
<artifactId>language-detector</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-langdetect</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>

<dependency>
<groupId>info.debatty</groupId>
<artifactId>java-string-similarity</artifactId>
<version>0.21</version>
</dependency>
<dependency>
<groupId>org.sobotics</groupId>
<artifactId>redunda-lib</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Tunaki-mvn-repo</id>
<url>https://raw.github.com/Tunaki/chatexchange/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>de.felixsfd.stackoverflow.guttenberg.clients.Client</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependency>
<groupId>info.debatty</groupId>
<artifactId>java-string-similarity</artifactId>
<version>0.21</version>
</dependency>
<dependency>
<groupId>org.sobotics</groupId>
<artifactId>redunda-lib</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-customsearch</artifactId>
<version>v1-rev57-1.23.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>Tunaki-mvn-repo</id>
<url>https://raw.github.com/Tunaki/chatexchange/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>de.felixsfd.stackoverflow.guttenberg.clients.Client</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
6 changes: 6 additions & 0 deletions src/main/java/org/sobotics/guttenberg/clients/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public class Client {

private static final Logger LOGGER = LoggerFactory.getLogger(Client.class);

private Client(){
super();
}

public static void main(String[] args) {
LOGGER.info("Hello, World!");
LOGGER.info("Load properties...");
Expand All @@ -46,6 +50,8 @@ public static void main(String[] args) {
return;
}

Guttenberg.setLoginProperties(prop);

LOGGER.info("Initialize chat...");
StackExchangeClient seClient = new StackExchangeClient(prop.getProperty("email"), prop.getProperty("password"));

Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/sobotics/guttenberg/clients/Guttenberg.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Guttenberg {
private static final Logger LOGGER = LoggerFactory.getLogger(Guttenberg.class);

private final List<Room> chatRooms;
private static Properties loginProperties;

public Guttenberg(List<Room> rooms) {
this.chatRooms = rooms;
Expand Down Expand Up @@ -139,5 +140,17 @@ public void execute() throws Throwable {
StatusUtils.lastExecutionFinished = Instant.now();
LOGGER.info("Finished at - "+StatusUtils.lastExecutionFinished);
}

public static Properties getLoginProperties() {
if (loginProperties==null){
throw new NullPointerException("The login properties have not been instanced");
}

return loginProperties;
}

public static void setLoginProperties(Properties loginProperties) {
Guttenberg.loginProperties = loginProperties;
}

}
Loading

0 comments on commit ef5edbe

Please sign in to comment.