public String classifyText(String inputText) {
    TextParser textParser = new TextParser();
    ArrayList<String> tokens = textParser.tokenizeString(inputText, true);

    DatabaseConnector databaseConnector = new DatabaseConnector();
    Classifier classifier = new Classifier(databaseConnector);
    int classId = classifier.classifyDoc(tokens);
    String assignedClass = "N/A";
    if (classId != -1) {
      assignedClass = databaseConnector.getClassName(classId);
    }
    Log.i("Classifier : ", "I've finished classifying.");
    Log.i("Class is : ", assignedClass);

    databaseConnector.updateClassContents(classId, true);
    Log.i("Classifier : ", "I've finished updating class counts.");

    databaseConnector.updateTermDistribution(
        textParser.getAllTokens(inputText, true), classId, true);
    Log.i("Classifier : ", "I've finished updating term distribution.");

    databaseConnector.closeDBConnection();

    return assignedClass;
  }
 @Override
 public void run() {
   DatabaseConnector databaseConnector = new DatabaseConnector();
   ArrayList<ActivityDao> activityDaos = databaseConnector.getUnclassifiedActivities();
   for (ActivityDao activityDao : activityDaos) {
     String url = activityDao.getActivityInfo().trim();
     activityDao.setAssignedClass(classifyUrl(url));
   }
   databaseConnector.updateActivities(activityDaos);
   databaseConnector.closeDBConnection();
   stopService(new Intent(getBaseContext(), ClassifierService.class));
 }
 @Override
 public void run() {
   DatabaseConnector databaseConnector = new DatabaseConnector();
   Classifier classifier = new Classifier(databaseConnector);
   classifier.recomputeFeatures();
   ArrayList<String> features = databaseConnector.getAllFeaturesList();
   FileWriter fileWriter;
   try {
     fileWriter =
         new FileWriter(
             Environment.getExternalStorageDirectory().getPath()
                 + "/MobileProfilerDatabase/features.txt");
     for (String feature : features) {
       fileWriter.write(feature + "\n");
     }
     fileWriter.close();
   } catch (IOException e) {
     Log.e("Error error : ", "FATAL ERROR");
     e.printStackTrace();
   }
   databaseConnector.closeDBConnection();
   stopService(new Intent(getBaseContext(), FeatureComputationService.class));
 }
 public void closeDBConnection() {
   databaseConnector.closeDBConnection();
 }