Skip to content

Commit

Permalink
Some system and loading fixes + started to rework the READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasBluebaum committed Apr 10, 2019
1 parent 0c9efba commit a0b25b8
Show file tree
Hide file tree
Showing 32 changed files with 193 additions and 69 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ log.out.*
qa.datasets/src/main/resources/annotated_wd_data_valid_full.json
qa.datasets/src/main/resources/lcquad_qaldformat.json
qa.datasets/src/main/resources/qrels-v2.txt
qa.datasets/src/main/resources/queries-v2.txt
qa.datasets/src/main/resources/webservice_25_06_2017.json
qa.datasets/src/main/resources/QALD
qa.datasets/src/main/resources/QALD-master
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

Collection of tools, utilities, datasets and approaches towards realizing natural language interfaces for the Web of Data. Currently, we are focusing on Question Answering (QA) utilities.

Especially, this repository contains
Especially, this repository contains
* QA Systems: A set of existing online webservices of QA systems all executable via a simple Java interface.
* QA Datasets: A collection of existing Question Answering datasets
* QA Machine Learning: This projects aims at learning a ML-based algorithm to combine multiple QA systems into one
* QA Commons: A collection to ease handling of QA datasets. It allows to load, store and evaluate datasets and systems.
* QA Commons: A collection to ease handling of QA datasets. It allows to load, store and evaluate datasets and systems.

We aim at providing a fast entrance to the field of natural language interfaces (search, question answering, ranking). Thus, we will offer here Maven dependencies and source code for using many available datasets, systems and techniques.
We aim at providing a fast entrance to the field of natural language interfaces (search, question answering, ranking). Thus, we will offer here Maven dependencies and source code for using many available datasets, systems and techniques.

More interesting Question Answering and Natural Language Generation projects can be found here:
* SemWeb2NL https://github.com/aksw/semweb2nl: This repository provides means to verbalize triples, entities, SPARQL queries and many more RDF dataset. This is especially useful to allow users understand Web of Data content.
Expand All @@ -34,4 +34,10 @@ Add the following repository to your project:

Artifacts are described in the sub-modules.

Look for more interesting libraries here: http://maven.aksw.org/archiva/#browse/org.aksw.qa
Look for more interesting libraries here: http://maven.aksw.org/archiva/#browse/org.aksw.qa


## Papers using NLIWOD
* https://doi.acm.org/10.1145/3178876.3186023
* https://github.com/dice-group/goose
* https://arxiv.org/abs/1809.10044
28 changes: 28 additions & 0 deletions qa.annotation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Question Answering (QA) annotation


## Maven Dependency
This library is available as a snapshot here: https://maven.aksw.org/archiva/#artifact~snapshots/org.aksw.qa/annotation

```
<dependency>
<groupId>org.aksw.qa</groupId>
<artifactId>annotation</artifactId>
<version>0.3.4</version>
</dependency>
```
Add the following repository:
```
<repository>
<id>maven.aksw.internal</id>
<name>University Leipzig, AKSW Maven2 Repository</name>
<url>http://maven.aksw.org/archiva/repository/internal</url>
</repository>
<repository>
<id>maven.aksw.snapshots</id>
<name>University Leipzig, AKSW Maven2 Repository</name>
<url>http://maven.aksw.org/archiva/repository/snapshots</url>
</repository>
```

Look for more interesting libraries here: http://maven.aksw.org/archiva/#browse/org.aksw.qa
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.qa.commons.knowledgeCard;
package org.aksw.qa.commons.knowledgecard;

public class ExplorerProperties {
private String className;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.qa.commons.knowledgeCard;
package org.aksw.qa.commons.knowledgecard;

import java.util.LinkedHashMap;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.qa.commons.knowledgeCard;
package org.aksw.qa.commons.knowledgecard;

import java.io.BufferedReader;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static InputStream mapDatasetToPath(final Dataset set) {
case INEX:
case QALD2:
case TREC_Entity:
return loadingAnchor.getResourceAsStream("/queries-v22.txt");
return loadingAnchor.getResourceAsStream("/queries-v2.txt");
case Simple_Question_Wikidata:
return loadingAnchor.getResourceAsStream("/annotated_wd_data_valid_full.json");
case Wdaqua_Core0_Logs:
Expand Down Expand Up @@ -262,7 +262,7 @@ public static List<IQuestion> load(final Dataset data, final String deriveUri, f
// two files.
case QALD3_Test_esdbpedia:
is.close();
out = qald3_test_esdbpedia_loader(deriveUri, questionLang);
out = qald3TestEsdbpediaLoader(deriveUri, questionLang);
break;

case QALD5_Test_Hybrid:
Expand Down Expand Up @@ -368,7 +368,7 @@ public static List<IQuestion> load(final Dataset data, final String deriveUri, f
* Use this to load answers from server:{@link AnswerSyncer}
*/
@Deprecated //TODO refactor this so that answersyncing is no longer in this class
private static List<IQuestion> qald3_test_esdbpedia_loader(final String deriveUri, final String questionLang) {
private static List<IQuestion> qald3TestEsdbpediaLoader(final String deriveUri, final String questionLang) {
List<IQuestion> answerList = null;
try {
InputStream sparqlIs = null;
Expand Down Expand Up @@ -686,7 +686,7 @@ public static void main(final String[] args) throws ParseException {

public static List<IQuestion> loadTSV(InputStream queries, String name) throws IOException {
List<IQuestion> out = new ArrayList<>();
out = LoadTsv.readTSV(queries,getLoadingAnchor().getResourceAsStream("/qrels-v21.txt"),name);
out = LoadTsv.readTSV(queries,getLoadingAnchor().getResourceAsStream("/qrels-v2.txt"),name);
return out;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public static List<IQuestion> readTSV(InputStream queriesStream, InputStream qre
String[] lineparts;
if (line.startsWith(data)) {
lineparts = line.split("\t");
String result = lineparts[2].replaceAll("<dbpedia:", "<http://dbpedia.org/resource/");
String result = lineparts[2].replaceAll("<dbpedia:", "http://dbpedia.org/resource/");
result = result.substring(0, result.length()-1);
results.computeIfAbsent(lineparts[0], k -> new HashSet<>()).add(result);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static double precision(Set<String> systemAnswer, IQuestion question) {
if (systemAnswer.size() == 1) {
String ans = systemAnswer.iterator().next();
String goldstandardAns = goldenStrings.iterator().next();
if (ans.toString().equals(goldstandardAns.toString())) {
if (ans.equals(goldstandardAns.toString())) {
precision = 1;
}
}
Expand All @@ -43,7 +43,7 @@ public static double precision(Set<String> systemAnswer, IQuestion question) {
if (systemAnswer.size() == 1) {
String ans = systemAnswer.iterator().next();
String goldstandardAns = goldenStrings.iterator().next();
if (ans.toString().equals(goldstandardAns)) {
if (ans.equals(goldstandardAns)) {
precision = 1;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ protected static Column ignore() {
return new Column(ColEnum.__IGNORE);
}

protected static Column ID() {
protected static Column iD() {
return new Column(ColEnum.ID);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static void qald8train() throws Exception {

CSVWriter wr = new CSVWriter(fw, ';', '"');

IQuestionCsvParser.questionListToCsv(wr, true, questions, Column.ID(), Column.question("en"), Column.sparqlQuery(), Column.goldenAnswers());
IQuestionCsvParser.questionListToCsv(wr, true, questions, Column.iD(), Column.question("en"), Column.sparqlQuery(), Column.goldenAnswers());
wr.flush();
fw.close();

Expand All @@ -161,7 +161,7 @@ public static void qald8train() throws Exception {

CSVWriter wr2 = new CSVWriter(fw2, ';', '"');

IQuestionCsvParser.questionListToCsv(wr2, true, failQuestions, Column.ID(), Column.question("en"), Column.sparqlQuery(), Column.goldenAnswers());
IQuestionCsvParser.questionListToCsv(wr2, true, failQuestions, Column.iD(), Column.question("en"), Column.sparqlQuery(), Column.goldenAnswers());
wr2.flush();
fw2.close();
System.out.println("done qald8train");
Expand Down Expand Up @@ -239,7 +239,7 @@ public static void qald8test() throws Exception {

CSVWriter wr2 = new CSVWriter(fw2, ';', '"');

IQuestionCsvParser.questionListToCsv(wr2, true, que, Column.ID(), Column.question("en"), Column.sparqlQuery(), Column.goldenAnswers());
IQuestionCsvParser.questionListToCsv(wr2, true, que, Column.iD(), Column.question("en"), Column.sparqlQuery(), Column.goldenAnswers());

wr2.close();
fw2.close();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package org.aksw.qa.commons.knowledgeCard;
package org.aksw.qa.commons.knowledgecard;


import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;

import org.aksw.qa.commons.knowledgecard.Field;
import org.aksw.qa.commons.knowledgecard.KnowledgeCardCreator;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void loadQALD5Test() {
}

@Test
public void loadQALD6Train_Multilingual() throws IOException {
public void loadQALD6TrainMultilingual() throws IOException {
List<IQuestion> load = LoaderController.load(Dataset.QALD6_Train_Multilingual);
List<Integer> expectedIncompletes = Arrays.asList(100, 118, 136, 137, 147, 152, 94, 95, 96, 97, 98, 99, 249, 250, 312, 342);
log.debug("Number of Loaded Questions:" + load.size());
Expand Down Expand Up @@ -123,10 +123,10 @@ public void loadQALD6Train_Multilingual() throws IOException {
Assert.assertTrue((q.getPseudoSparqlQuery() != null) || (q.getSparqlQuery() != null));
// log.debug(q.getLanguageToQuestion().get("en") + "\t" +
// "Answer:" + "\t" + q.getSparqlQuery());
} else {
} // else {
// log.debug(q.getLanguageToQuestion().get("en") + "\t" +
// "No Answer, known incomplete question.");
}
// }
}

}
Expand Down
14 changes: 14 additions & 0 deletions qa.datasets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@
<outputDirectory>src/main/resources/</outputDirectory>
</configuration>
</execution>
<execution>
<id>Dbpedia-Entity-V2-Queries</id>
<phase>package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>https://raw.githubusercontent.com/iai-group/DBpedia-Entity/master/collection/v2/queries-v2.txt</url>
<overwrite>true</overwrite>
<skipCache>true</skipCache>
<outputFileName>queries-v2.txt</outputFileName>
<outputDirectory>src/main/resources/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.mlqa.analyzer.entityType;
package org.aksw.mlqa.analyzer.entitytype;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.mlqa.analyzer.entityType;
package org.aksw.mlqa.analyzer.entitytype;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.mlqa.analyzer.entityType;
package org.aksw.mlqa.analyzer.entitytype;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.mlqa.analyzer.entityType;
package org.aksw.mlqa.analyzer.entitytype;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.mlqa.analyzer.entityType;
package org.aksw.mlqa.analyzer.entitytype;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.mlqa.analyzer.entityType;
package org.aksw.mlqa.analyzer.entitytype;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.aksw.mlqa.analyzer.numberOfToken;
package org.aksw.mlqa.analyzer.numberoftoken;

import org.aksw.mlqa.analyzer.IAnalyzer;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ public static void main(String[] args) throws Exception {
JSONObject systemdata = (JSONObject) allsystemsdata.get(system.name());
if(new Double(systemdata.get("fmeasure").toString()) > 0)
switch (system.name()){
case "hawk": tmp.setValue(hawkatt, 1);
case "yoda": tmp.setValue(yodaatt, 1);
case "sina": tmp.setValue(sinaatt, 1);
case "qakis": tmp.setValue(qakisatt, 1);
case "hawk": tmp.setValue(hawkatt, 1); break;
case "yoda": tmp.setValue(yodaatt, 1); break;
case "sina": tmp.setValue(sinaatt, 1); break;
case "qakis": tmp.setValue(qakisatt, 1); break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class ComperativeTest {

@Test
public void ThisContainsComperative() {
public void thisContainsComperative() {
Comperative superlative = new Comperative();
ArrayList<Attribute> fvWekaAttributes = new ArrayList<Attribute>();
fvWekaAttributes.add(superlative.getAttribute());
Expand All @@ -25,7 +25,7 @@ public void ThisContainsComperative() {
}

@Test
public void ThisContainsNoComperative(){
public void thisContainsNoComperative(){
Comperative superlative = new Comperative();
ArrayList<Attribute> fvWekaAttributes = new ArrayList<Attribute>();
fvWekaAttributes.add(superlative.getAttribute());
Expand Down
Loading

0 comments on commit a0b25b8

Please sign in to comment.