Preparations for sunburst chart
This commit is contained in:
parent
a21c19ab75
commit
48a2e9af19
2 changed files with 17 additions and 6 deletions
|
@ -3,10 +3,7 @@ package org.texttechnologylab.project.gruppe_05_1.domain.html;
|
|||
import org.bson.Document;
|
||||
import org.texttechnologylab.project.gruppe_05_1.database.MongoDBHandler;
|
||||
import org.texttechnologylab.project.gruppe_05_1.database.MongoPprUtils;
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.nlp.NlpInfo;
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.nlp.Sentiment;
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.nlp.Token;
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.nlp.Topic;
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.nlp.*;
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.speech.SpeechMetaData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -69,6 +66,7 @@ public class HtmlSpeech {
|
|||
List<Document> dependenciesDocs = nlpDoc.get("dependencies", MongoDBHandler.DOC_LIST_CLASS);
|
||||
|
||||
List<Document> namedEntitiesDocs = nlpDoc.get("namedEntities", MongoDBHandler.DOC_LIST_CLASS);
|
||||
nlp.setNamedEntities(NamedEntity.readNamedEntitiesFromMongo(namedEntitiesDocs));
|
||||
|
||||
List<Document> sentimentsDocs = nlpDoc.get("sentiments", MongoDBHandler.DOC_LIST_CLASS);
|
||||
nlp.setSentiments(Sentiment.readSentimentsFromMongo(sentimentsDocs));
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package org.texttechnologylab.project.gruppe_05_1.domain.nlp;
|
||||
|
||||
import org.bson.Document;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
public class NamedEntity {
|
||||
String type; // PER, LOC etc.
|
||||
// int begin; // TODO: momentan nicht in MongoDB
|
||||
// int end; // TODO: momentan nicht in MongoDB
|
||||
String text;
|
||||
|
||||
public NamedEntity() {
|
||||
|
@ -52,4 +54,15 @@ public class NamedEntity {
|
|||
.add("text='" + text + "'")
|
||||
.toString();
|
||||
}
|
||||
|
||||
public static List<NamedEntity> readNamedEntitiesFromMongo(List<Document> nadocs) {
|
||||
List<NamedEntity> nes = new ArrayList<>();
|
||||
for (Document doc : nadocs) {
|
||||
nes.add(new NamedEntity(
|
||||
doc.getString("type"),
|
||||
doc.getString("text")
|
||||
));
|
||||
}
|
||||
return nes;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue