Removed message classification

pull/190/head
M66B 4 years ago
parent 6f2d0579aa
commit c3f6932574

@ -29,4 +29,3 @@ FairEmail uses:
* [Over-Scroll Support For Android's RecyclerView, ListView, GridView, ScrollView ...](https://github.com/EverythingMe/overscroll-decor). Copyright (c) 2015, DoAT Media Ltd. [BSD-2-Clause License](https://github.com/EverythingMe/overscroll-decor/blob/master/LICENSE)
* [Compact Encoding Detection](https://github.com/google/compact_enc_det). Copyright 2016 Google Inc. [Apache License 2.0](https://github.com/google/compact_enc_det/blob/master/LICENSE).
* [POI-HMEF](https://poi.apache.org/components/hmef/index.html). Copyright © 2001-2020 The Apache Software Foundation. [Apache Software License v2](https://poi.apache.org/devel/guidelines.html#The+Licensing).
* [Java Naive Bayes Classifier](https://github.com/ptnplanet/Java-Naive-Bayes-Classifier). Copyright (c) 2012-2017 Philipp Nolte. [MIT License](https://github.com/ptnplanet/Java-Naive-Bayes-Classifier#the-mit-license-mit).

@ -443,7 +443,4 @@ dependencies {
// https://poi.apache.org/components/hmef/index.html
// https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad
implementation "org.apache.poi:poi-scratchpad:$apache_poi"
// https://github.com/ptnplanet/Java-Naive-Bayes-Classifier
implementation "com.github.ptnplanet:Java-Naive-Bayes-Classifier:$bayes_version"
}

@ -34,13 +34,10 @@ import androidx.work.WorkerParameters;
import java.io.File;
import java.io.FileNotFoundException;
import java.text.BreakIterator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.TimeUnit;
import de.daslaboratorium.machinelearning.classifier.Classification;
import de.daslaboratorium.machinelearning.classifier.bayes.BayesClassifier;
import io.requery.android.database.sqlite.SQLiteDatabase;
@ -86,32 +83,6 @@ public class WorkerFts extends Worker {
if (TextUtils.isEmpty(text))
throw new FileNotFoundException("Message empty");
if (BuildConfig.DEBUG) {
EntityFolder folder = db.folder().getFolder(message.folder);
if (folder != null && !EntityFolder.isOutgoing(folder.type)) {
List<String> features = new ArrayList<>();
BreakIterator boundary = BreakIterator.getWordInstance();
boundary.setText(text);
int start = boundary.first();
for (int end = boundary.next(); end != BreakIterator.DONE; end = boundary.next()) {
String word = text.substring(start, end);
if (word.length() > 1 && !word.matches(".*\\d.*"))
features.add(word);
start = end;
}
Collection<Classification<String, String>> classifications = classifier.classifyDetailed(features);
for (Classification<String, String> classification : classifications)
Log.i("MMM folder=" + folder.name +
" classified=" + classification.getCategory() +
" probability=" + classification.getProbability() +
" features=" + TextUtils.join(", ", features.subList(0, Math.min(features.size(), 20))));
classifier.learn(EntityFolder.JUNK.equals(folder.type) ? "spam" : "ham", features);
}
}
boolean fts = prefs.getBoolean("fts", false);
if (fts)
try {

Loading…
Cancel
Save