From c3f69325743d6854123afc1156106b7eb6f4f883 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 29 Dec 2020 12:23:50 +0100 Subject: [PATCH] Removed message classification --- ATTRIBUTION.md | 1 - app/build.gradle | 3 -- .../java/eu/faircode/email/WorkerFts.java | 29 ------------------- 3 files changed, 33 deletions(-) diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 4d23e236c5..f60a3a7c0f 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -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). diff --git a/app/build.gradle b/app/build.gradle index c9251f33fd..2fdd1018c5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" } diff --git a/app/src/main/java/eu/faircode/email/WorkerFts.java b/app/src/main/java/eu/faircode/email/WorkerFts.java index 5519fa99b3..28a308a1d7 100644 --- a/app/src/main/java/eu/faircode/email/WorkerFts.java +++ b/app/src/main/java/eu/faircode/email/WorkerFts.java @@ -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 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> classifications = classifier.classifyDetailed(features); - for (Classification 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 {