Skip to content
Snippets Groups Projects

Rede wiedergabe dev

Merged Ghost User requested to merge redeWiedergabe_dev into master
4 files
+ 171
79
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -909,88 +909,148 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
@@ -909,88 +909,148 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
}
}
// methods that are required by the view
public void createSpeaker() {
public void createSpeaker() {
int counter = 0;
boolean speakerIDFlag = false;
AnnotationFS selected = null;
for (AnnotationFS speaker : speakerList){
if (editor.getSelectionOfVisibleAnnotations().size() > 0) {
if (speaker.getFeatureValueAsString(speakerIDFeat) == null){
for (AnnotationFS anno : editor.getSelectionOfVisibleAnnotations()) {
JFrame jFrame = new JFrame("Information");
if (anno.getType().equals(speakerType)) {
JOptionPane.showMessageDialog(jFrame, "Please assign an ID to the speaker " + "\"" + speaker.getFeatureValueAsString(speakerFeat) + "\"" + ".", "Attention", JOptionPane.WARNING_MESSAGE);
selected = anno;
speakerIDFlag = true;
 
}
 
}
 
 
if (speakerIDFlag == false)
 
{
 
 
//int counter = 0;
 
AnnotationFS selected = null;
 
if (editor.getSelectionOfVisibleAnnotations().size() > 0) {
 
for (AnnotationFS anno : editor.getSelectionOfVisibleAnnotations()) {
 
if (anno.getType().equals(speakerType)) {
 
selected = anno;
 
}
}
}
}
}
}
// remove vorschlag
// remove vorschlag
CAS cas = editor.getCas();
CAS cas = editor.getCas();
Type t = speakerType;
Type t = speakerType;
// get the selection
// get the selection
if (selected == null) {
if (selected == null) {
Point selection = editor.getActualSelectedText();
Point selection = editor.getActualSelectedText();
if (selection == null || selection.x == selection.y) {
if (selection == null || selection.x == selection.y) {
return;
return;
}
AnnotationFS anno = cas.createAnnotation(t, selection.x, selection.y);
anno.getFeatureValueAsString(speakerFeat);
String speakerFeatValue = anno.getFeatureValueAsString(speakerFeat);
speakerFeatValue = anno.getCoveredText();
updateAnnotation(anno, speakerFeat, speakerFeatValue, true);
for (AnnotationFS frame : frameList)
{
if (anno.getBegin() >= frame.getBegin() && anno.getEnd() <= frame.getEnd())
{
anno.getFeatureValueAsString(speakerFeat);
addAnnotation(anno);
updateAnnotation(anno, speakerIDFeat, frame.getFeatureValueAsString(frameIDFeat), true);
}
}
else
AnnotationFS anno = cas.createAnnotation(t, selection.x, selection.y);
 
 
anno.getFeatureValueAsString(speakerFeat);
 
String speakerFeatValue = anno.getFeatureValueAsString(speakerFeat);
 
speakerFeatValue = anno.getCoveredText();
 
updateAnnotation(anno, speakerFeat, speakerFeatValue, true);
 
addAnnotation(anno);
 
 
for (AnnotationFS frame : frameList)
{
{
counter++;
if (anno.getBegin() >= frame.getBegin() && anno.getEnd() <= frame.getEnd())
 
{
 
anno.getFeatureValueAsString(speakerFeat);
 
addAnnotation(anno);
 
updateAnnotation(anno, speakerIDFeat, frame.getFeatureValueAsString(frameIDFeat), true);
 
}
 
 
for (AnnotationFS stwr : stwrList){
 
if (anno.getBegin() >= stwr.getBegin() && anno.getEnd() <= stwr.getEnd())
 
{
 
anno.getFeatureValueAsString(speakerFeat);
 
addAnnotation(anno);
 
updateAnnotation(anno, speakerIDFeat, stwr.getFeatureValueAsString(stwrIDFeat), true);
 
}
}
}
if (counter == frameList.size())
{
/*
JFrame jFrame = new JFrame("Information");
else
JOptionPane.showMessageDialog(jFrame, "Please mark a string in a frame.", "Attention", JOptionPane.WARNING_MESSAGE);
{
 
counter++;
 
}
 
 
if (counter == frameList.size())
 
{
 
JFrame jFrame = new JFrame("Information");
 
JOptionPane.showMessageDialog(jFrame, "Please mark a string in a frame.", "Attention", JOptionPane.WARNING_MESSAGE);
 
}
 
*/
}
}
}
}
}
/*
/*
Display.getCurrent().asyncExec(() -> {
Display.getCurrent().asyncExec(() -> {
renewPage();
 
});
 
*/
renewPage();
renewPage();
});
}
*/
renewPage();
}
}
public void correctSpeakerExp(AnnotationFS selected)
public void createSpeakerOutsideFrame(AnnotationFS selected)
{
{
List<AnnotationFS> speakerSelection = editor.getCurrentSelectionOfType(speakerType);
List<AnnotationFS> speakerSelection = editor.getCurrentSelectionOfType(speakerType);
List<AnnotationFS> expSelection = editor.getCurrentSelectionOfType(expressionType);
String concatenatedId = "";
 
 
if (speakerSelection != null && speakerSelection.size() > 0)
if (speakerSelection != null && speakerSelection.size() > 0)
{
{
AnnotationFS anno = speakerSelection.get(0);
AnnotationFS anno = speakerSelection.get(0);
updateAnnotation(anno, speakerIDFeat, selected.getFeatureValueAsString(frameIDFeat), true);
if (anno.getFeatureValueAsString(speakerIDFeat) == null)
 
{
 
concatenatedId = selected.getFeatureValueAsString(frameIDFeat);
 
updateAnnotation(anno, speakerIDFeat, concatenatedId, true);
 
}else if (anno.getFeatureValueAsString(speakerIDFeat).matches(".*" + " " + selected.getFeatureValueAsString(frameIDFeat) + " " + ".*")
 
|| anno.getFeatureValueAsString(speakerIDFeat).matches(selected.getFeatureValueAsString(frameIDFeat) + " " + ".*" )
 
|| anno.getFeatureValueAsString(speakerIDFeat).matches(".*" + " " + selected.getFeatureValueAsString(frameIDFeat))
 
|| anno.getFeatureValueAsString(speakerIDFeat).matches(selected.getFeatureValueAsString(frameIDFeat))){
 
JFrame jFrame = new JFrame("Information");
 
JOptionPane.showMessageDialog(jFrame, "The speaker already has the ID " + selected.getFeatureValueAsString(frameIDFeat) + ".", "Attention", JOptionPane.WARNING_MESSAGE);
 
}else {
 
concatenatedId = anno.getFeatureValueAsString(speakerIDFeat) + " " + selected.getFeatureValueAsString(frameIDFeat);
 
updateAnnotation(anno, speakerIDFeat, concatenatedId, true);
 
}
}
}
}
if (expSelection != null && expSelection.size() > 0)
 
public void createSpeakerOutsideStwr(AnnotationFS selected)
 
{
 
List<AnnotationFS> speakerSelection = editor.getCurrentSelectionOfType(speakerType);
 
String concatenatedId = "";
 
 
if (speakerSelection != null && speakerSelection.size() > 0)
{
{
AnnotationFS anno = expSelection.get(0);
AnnotationFS anno = speakerSelection.get(0);
updateAnnotation(anno, expressionIDFeat, selected.getFeatureValueAsString(frameIDFeat), true);
if (anno.getFeatureValueAsString(speakerIDFeat) == null)
}
{
 
concatenatedId = selected.getFeatureValueAsString(stwrIDFeat);
 
updateAnnotation(anno, speakerIDFeat, concatenatedId, true);
 
}else if (anno.getFeatureValueAsString(speakerIDFeat).matches(".*" + " " + selected.getFeatureValueAsString(stwrIDFeat) + " " + ".*")
 
|| anno.getFeatureValueAsString(speakerIDFeat).matches(selected.getFeatureValueAsString(stwrIDFeat) + " " + ".*" )
 
|| anno.getFeatureValueAsString(speakerIDFeat).matches(".*" + " " + selected.getFeatureValueAsString(stwrIDFeat))
 
|| anno.getFeatureValueAsString(speakerIDFeat).matches(selected.getFeatureValueAsString(stwrIDFeat))){
 
JFrame jFrame = new JFrame("Information");
 
JOptionPane.showMessageDialog(jFrame, "The speaker already has the ID " + selected.getFeatureValueAsString(stwrIDFeat) + ".", "Attention", JOptionPane.WARNING_MESSAGE);
 
}else {
 
concatenatedId = anno.getFeatureValueAsString(speakerIDFeat) + " " + selected.getFeatureValueAsString(stwrIDFeat);
 
updateAnnotation(anno, speakerIDFeat, concatenatedId, true);
 
}
 
}
}
}
// methods that are required by the view
public void createExpression() {
public void createExpression() {
int counter = 0;
int frameCounter = 0;
 
int repCounter = 0;
AnnotationFS selected = null;
AnnotationFS selected = null;
if (editor.getSelectionOfVisibleAnnotations().size() > 0) {
if (editor.getSelectionOfVisibleAnnotations().size() > 0) {
for (AnnotationFS anno : editor.getSelectionOfVisibleAnnotations()) {
for (AnnotationFS anno : editor.getSelectionOfVisibleAnnotations()) {
@@ -1001,7 +1061,6 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
@@ -1001,7 +1061,6 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
}
}
}
}
// remove vorschlag
CAS cas = editor.getCas();
CAS cas = editor.getCas();
Type t = expressionType;
Type t = expressionType;
// get the selection
// get the selection
@@ -1018,34 +1077,56 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
@@ -1018,34 +1077,56 @@ public class RedeWiedergabeView extends AEditorSubordinateViewPart {
expFeatValue = anno.getCoveredText();
expFeatValue = anno.getCoveredText();
updateAnnotation(anno, expressionFeat, expFeatValue, true);
updateAnnotation(anno, expressionFeat, expFeatValue, true);
for (AnnotationFS frame : frameList)
for (AnnotationFS frame : frameList){
{
if (anno.getBegin() >= frame.getBegin() && anno.getEnd() <= frame.getEnd()){
if (anno.getBegin() >= frame.getBegin() && anno.getEnd() <= frame.getEnd())
{
anno.getFeatureValueAsString(expressionFeat);
anno.getFeatureValueAsString(expressionFeat);
updateAnnotation(anno, expressionIDFeat, frame.getFeatureValueAsString(frameIDFeat), true);
updateAnnotation(anno, expressionIDFeat, frame.getFeatureValueAsString(frameIDFeat), true);
addAnnotation(anno);
addAnnotation(anno);
}
}
else
else
{
{
counter++;
frameCounter++;
}
}
/*
if (counter == frameList.size())
if (frameCounter == frameList.size())
{
{
JFrame jFrame = new JFrame("Information");
JFrame jFrame = new JFrame("Information");
JOptionPane.showMessageDialog(jFrame, "Please mark a string in a frame.", "Attention", JOptionPane.WARNING_MESSAGE);
JOptionPane.showMessageDialog(jFrame, "Please mark a string in a frame or a reported STWR.", "Attention", JOptionPane.WARNING_MESSAGE);
 
}
 
*/
 
}
 
 
ArrayList<AnnotationFS> repAnnoList = getReportedAnno(stwrList);
 
for (AnnotationFS repAnno : repAnnoList){
 
if (anno.getBegin() >= repAnno.getBegin() && anno.getEnd() <= repAnno.getEnd()){
 
anno.getFeatureValueAsString(expressionFeat);
 
updateAnnotation(anno, expressionIDFeat, repAnno.getFeatureValueAsString(stwrIDFeat), true);
 
addAnnotation(anno);
}
}
 
else
 
{
 
repCounter++;
 
}
 
}
 
if (repCounter == repAnnoList.size() && frameCounter == frameList.size())
 
{
 
JFrame jFrame = new JFrame("Information");
 
JOptionPane.showMessageDialog(jFrame, "Please mark a string in a frame or in a reported STWR.", "Attention", JOptionPane.WARNING_MESSAGE);
}
}
}
}
/*
Display.getCurrent().asyncExec(() -> {
renewPage();
});
*/
renewPage();
renewPage();
}
}
 
public ArrayList<AnnotationFS> getReportedAnno(List<AnnotationFS>stwrList){
 
ArrayList<AnnotationFS> reportedList = new ArrayList<AnnotationFS>();
 
for (AnnotationFS stwr : stwrList){
 
if (stwr.getFeatureValueAsString(rTypeFeat).equals("reported")){
 
reportedList.add(stwr);
 
}
 
}
 
return reportedList;
 
}
 
public void createSpeech() {
public void createSpeech() {
ambigMediumDialog.speechFlag = false;
ambigMediumDialog.speechFlag = false;
ambigMediumDialog.thoughtFlag = false;
ambigMediumDialog.thoughtFlag = false;
Loading