Commit 7c2f17d5 authored by Elodie Gauthier's avatar Elodie Gauthier

Fix minor error when generating the CSV file (for software like Elan)

Delete old screenshots
parent b2b8989e
......@@ -22,6 +22,7 @@ import java.util.LinkedList;
import java.util.UUID;
import static org.getalp.ligaikuma.lig_aikuma.model.RecordingLig.MAP_EXT;
import static org.getalp.ligaikuma.lig_aikuma.ui.RespeakingMetadata.translateMode;
/**
* Facilitates creation of segment mappings (Segments). To be used when
......@@ -197,14 +198,14 @@ public class Mapper {
*/
public void toCSV(int [] index){toCSV(index, mappingFile);}
/** Convert map files to csv file can be processed by softwar like ELAN
/** Convert map files to csv file to be processed by software like ELAN
*
* @param index index used for remap
* @param mapFile Original map file use to create csv
*/
public void toCSV(int [] index, File mapFile)
{
String bufferWrite="", tSplit1[], tSplit2[], tNospeach;
String bufferWrite="", tSplit1[], tSplit2[], tNospeech, t=(translateMode)?"trsl,":"rspk,";
float a,b,c,d;
Arrays.sort(index);
try {
......@@ -218,11 +219,11 @@ public class Mapper {
b = Float.parseFloat(tSplit1[1])/16000;
c = Float.parseFloat(tSplit2[0])/16000;
d = Float.parseFloat(tSplit2[1])/16000;
if(i == index[j]){tNospeach = "non-speech";j++;}
else tNospeach = "";
if(i == index[j]){tNospeech = "non-speech";j++;}
else tNospeech = "";
if(i!=0) bufferWrite+="\n";
bufferWrite += "original,"+ Float.toString(a)+","+Float.toString(b)+","+Float.toString(b-a)+","+tNospeach+"\n"+
"trsl,"+ Float.toString(c)+","+Float.toString(d)+","+Float.toString(d-c)+","+tNospeach;
bufferWrite += "original,"+ Float.toString(a) + "," + Float.toString(b) + "," + Float.toString(b-a) + "," + tNospeech + "\n" +
t + Float.toString(c) + "," + Float.toString(d) + "," + Float.toString(d-c) + "," + tNospeech;
}
FileIO.write(new File(FileIO.getNoSyncPath(),"tmp_elan.csv"), bufferWrite);
} catch (IOException ignored) {}
......@@ -255,7 +256,7 @@ public class Mapper {
for(Object o : tmpidex) {index[k]=(int) o;k++;}
// Build csv file
String bufferWrite="", tSplit1[], tSplit2[], tNospeach;
String bufferWrite="", tSplit1[], tSplit2[], tNospeech, t=(translateMode)?"trsl,":"rspk,";
float a,b,c,d;
try {
// Read original map file and remap it on buffer
......@@ -268,11 +269,11 @@ public class Mapper {
b = Float.parseFloat(tSplit1[1])/16000;
c = Float.parseFloat(tSplit2[0])/16000;
d = Float.parseFloat(tSplit2[1])/16000;
if(i == index[j]){tNospeach = "non-speech";j++;}
else tNospeach = "";
if(i == index[j]){tNospeech = "non-speech";j++;}
else tNospeech = "";
if(i!=0) bufferWrite+="\n";
bufferWrite += "original,"+ Float.toString(a)+","+Float.toString(b)+","+Float.toString(b-a)+","+tNospeach+"\n"+
"trsl,"+ Float.toString(c)+","+Float.toString(d)+","+Float.toString(d-c)+","+tNospeach;
bufferWrite += "original,"+ Float.toString(a)+","+Float.toString(b)+","+Float.toString(b-a)+","+tNospeech+"\n"+
t + Float.toString(c)+","+Float.toString(d)+","+Float.toString(d-c)+","+tNospeech;
}
FileIO.write(destinationFile, bufferWrite);
} catch (IOException ignored) {}
......
......@@ -70,7 +70,7 @@ public class RespeakingMetadata extends AikumaActivity implements OnClickListene
* if translate mode has been selected in ModeSelection.java or not.
* In other words, if it's a respeaking or a translation
*/
private boolean translateMode = false;
public static boolean translateMode = false;
/** Called when the activity is first created. */
@Override
......
......@@ -381,7 +381,7 @@ public class ThumbRespeakSummary extends AikumaActivity implements OnClickListen
@Override
public void run() {
int shift = (original) ? 0 : 1;
if(BuildConfig.DEBUG)Log.i(TAG, "j: " + j + "; shift: " + shift + "; fragmen id: " + (j+1)*1000+shift);
if(BuildConfig.DEBUG)Log.i(TAG, "j: " + j + "; shift: " + shift + "; fragment id: " + (j+1)*1000+shift);
((ListenFragment) ThumbRespeakSummary.this.getFragmentManager().findFragmentById((j+1)*1000+shift)).onMarkedReachedListener();
}
});
......
......@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment