mirror of
https://github.com/Team4388/RidgeScout.git
synced 2026-06-09 08:38:03 -06:00
Make everything use fragments
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.astatin3.scoutingapp2025.utility;
|
||||
|
||||
import com.astatin3.scoutingapp2025.SettingsVersionStack.latestSettings;
|
||||
import com.astatin3.scoutingapp2025.scoutingData.fields;
|
||||
import com.astatin3.scoutingapp2025.scoutingData.transfer.transferType;
|
||||
import com.astatin3.scoutingapp2025.types.frcEvent;
|
||||
import com.astatin3.scoutingapp2025.types.input.inputType;
|
||||
|
||||
public class DataManager {
|
||||
public static String evcode;
|
||||
public static frcEvent event;
|
||||
public static void reload_event(){
|
||||
evcode = getevcode(); event = frcEvent.decode(fileEditor.readFile(evcode + ".eventdata"));
|
||||
}
|
||||
|
||||
public static String getevcode() {
|
||||
return latestSettings.settings.get_evcode();
|
||||
}
|
||||
|
||||
public static inputType[][] match_values;
|
||||
public static inputType[] match_latest_values;
|
||||
public static transferType[][] match_transferValues;
|
||||
public static void reload_match_fields(){
|
||||
match_values = fields.load(fields.matchFieldsFilename);
|
||||
match_latest_values = match_values[match_values.length-1];
|
||||
match_transferValues = transferType.get_transfer_values(match_values);
|
||||
}
|
||||
|
||||
public static inputType[][] pit_values;
|
||||
public static inputType[] pit_latest_values;
|
||||
public static transferType[][] pit_transferValues;
|
||||
public static void reload_pit_fields(){
|
||||
pit_values = fields.load(fields.pitsFieldsFilename);
|
||||
pit_latest_values = pit_values[pit_values.length-1];
|
||||
pit_transferValues = transferType.get_transfer_values(pit_values);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.astatin3.scoutingapp2025.utility;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.tensorflow.lite.support.label.Category;
|
||||
import org.tensorflow.lite.task.text.nlclassifier.NLClassifier;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SentimentAnalysis {
|
||||
private static NLClassifier textClassifier;
|
||||
|
||||
public static void init(Context context){
|
||||
try {
|
||||
textClassifier = NLClassifier.createFromFile(context, "text_classification_v2.tflite");
|
||||
} catch (Exception e) {
|
||||
AlertManager.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public interface resultCallback {
|
||||
public void onFinish(float data);
|
||||
}
|
||||
|
||||
public static void analyse(String input, resultCallback result){
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<Category> results = textClassifier.classify(input);
|
||||
|
||||
for(int i = 0; i < results.size(); i++){
|
||||
Category cat = results.get(i);
|
||||
switch (cat.getLabel()){
|
||||
case "Positive":
|
||||
result.onFinish(cat.getScore());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static float analyse_sync(String input){
|
||||
List<Category> results = textClassifier.classify(input);
|
||||
|
||||
for(int i = 0; i < results.size(); i++){
|
||||
Category cat = results.get(i);
|
||||
switch (cat.getLabel()){
|
||||
case "Positive":
|
||||
return cat.getScore();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user