Skip to content

Commit

Permalink
Bugfix in Simplification. Changed to version 1.0.1. (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mischn authored and Bernhard Bermeitinger committed Feb 23, 2017
1 parent e1694fc commit b515ef7
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 41 deletions.
2 changes: 1 addition & 1 deletion graphene-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<artifactId>graphene</artifactId>
<groupId>org.lambda3.graphene</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion graphene-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<artifactId>graphene</artifactId>
<groupId>org.lambda3.graphene</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,42 +50,32 @@ public Simplification() {
log.info("Simplification initialized");
}

private static CoreSentence getCoreSentence(DCore dCore, Map<DCore, CoreSentence> dCoreMapping, Map<Integer, List<CoreSentence>> sentenceMapping) {
CoreSentence res;

if (dCoreMapping.containsKey(dCore)) {
res = dCoreMapping.get(dCore);
} else {
res = new CoreSentence(
dCore.getText(),
DiscourseType.DISCOURSE_CORE,
dCore.getNotSimplifiedText(),
dCore.getSContexts()
.stream()
.map(c -> new ContextSentence(c.getText(), c.getRelation()))
.collect(Collectors.toList())
);

// add to dCoreMapping
dCoreMapping.put(dCore, res);

}

addToSentenceMapping(sentenceMapping, dCore.getSentenceIndex(), res);

return res;
}

private static void addToSentenceMapping(Map<Integer, List<CoreSentence>> sentenceMapping, Integer sentenceIndex, CoreSentence result) {
// add to sentenceMapping
if (sentenceMapping.containsKey(sentenceIndex)) {
sentenceMapping.get(sentenceIndex).add(result);
} else {
List<CoreSentence> lst = new ArrayList<>();
lst.add(result);
sentenceMapping.put(sentenceIndex, lst);
}
}
private static CoreSentence getCoreSentence(DCore dCore, Map<DCore, CoreSentence> dCoreMapping, Map<Integer, List<CoreSentence>> sentenceMapping) {
CoreSentence res;

if (dCoreMapping.containsKey(dCore)) {
res = dCoreMapping.get(dCore);
} else {
res = new CoreSentence(
dCore.getText(),
DiscourseType.DISCOURSE_CORE,
dCore.getNotSimplifiedText(),
dCore.getSContexts()
.stream()
.map(c -> new ContextSentence(c.getText(), c.getRelation()))
.collect(Collectors.toList())
);

// add to dCoreMapping
dCoreMapping.put(dCore, res);

// add to sentenceMapping
sentenceMapping.putIfAbsent(dCore.getSentenceIndex(), new ArrayList<>());
sentenceMapping.get(dCore.getSentenceIndex()).add(res);
}

return res;
}

private static CoreSentence getCoreSentence(DContext dContext, Map<DContext, CoreSentence> dContextMapping, Map<Integer, List<CoreSentence>> sentenceMapping) {
CoreSentence res;
Expand All @@ -103,7 +93,9 @@ private static CoreSentence getCoreSentence(DContext dContext, Map<DContext, Cor
// add to dContextMapping
dContextMapping.put(dContext, res);

addToSentenceMapping(sentenceMapping, dContext.getSentenceIndex(), res);
// add to sentenceMapping
sentenceMapping.putIfAbsent(dContext.getSentenceIndex(), new ArrayList<>());
sentenceMapping.get(dContext.getSentenceIndex()).add(res);
}

return res;
Expand Down
2 changes: 1 addition & 1 deletion graphene-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<parent>
<artifactId>graphene</artifactId>
<groupId>org.lambda3.graphene</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<groupId>org.lambda3.graphene</groupId>
<artifactId>graphene</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>

<packaging>pom</packaging>

Expand Down

0 comments on commit b515ef7

Please sign in to comment.