diff options
13 files changed, 18 insertions, 1506 deletions
diff --git a/app/src/main/java/org/rssin/neurons/FeedSorter.java b/app/src/main/java/org/rssin/neurons/FeedSorter.java index 660c546..4cd5856 100755 --- a/app/src/main/java/org/rssin/neurons/FeedSorter.java +++ b/app/src/main/java/org/rssin/neurons/FeedSorter.java @@ -35,7 +35,7 @@ public class FeedSorter implements Storable {      private Hashtable<String, Integer> wordInputs = new Hashtable<>();
      private Hashtable<String, Integer> authorInputs = new Hashtable<>();
 -    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
 +    private synchronized void writeObject(java.io.ObjectOutputStream stream) throws IOException {
          stream.writeObject(nn);
          SerializationTools.writeList(trainingCases, stream);
          SerializationTools.writeArray(isNthMonthInput, stream);
 diff --git a/app/src/main/java/org/rssin/neurons/MultiNeuralNetwork.java b/app/src/main/java/org/rssin/neurons/MultiNeuralNetwork.java index b53588b..f7a7099 100755 --- a/app/src/main/java/org/rssin/neurons/MultiNeuralNetwork.java +++ b/app/src/main/java/org/rssin/neurons/MultiNeuralNetwork.java @@ -13,7 +13,7 @@ class MultiNeuralNetwork implements Serializable {      private static final long serialVersionUID = 0;
      private NeuralNetwork[] networks;
 -    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
 +    private synchronized void writeObject(java.io.ObjectOutputStream stream) throws IOException {
          SerializationTools.writeArray(networks, stream);
      }
 diff --git a/app/src/main/java/org/rssin/neurons/NeuralNetwork.java b/app/src/main/java/org/rssin/neurons/NeuralNetwork.java index 446e13a..2d35247 100755 --- a/app/src/main/java/org/rssin/neurons/NeuralNetwork.java +++ b/app/src/main/java/org/rssin/neurons/NeuralNetwork.java @@ -16,7 +16,7 @@ class NeuralNetwork implements Serializable {      private Neuron[] hiddenNodes;
      private Neuron outputNode;
 -    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
 +    private synchronized void writeObject(java.io.ObjectOutputStream stream) throws IOException {
          SerializationTools.writeArray(hiddenNodes, stream);
          stream.writeObject(outputNode);
      }
 diff --git a/app/src/main/java/org/rssin/neurons/Neuron.java b/app/src/main/java/org/rssin/neurons/Neuron.java index 760ea77..52fcdba 100755 --- a/app/src/main/java/org/rssin/neurons/Neuron.java +++ b/app/src/main/java/org/rssin/neurons/Neuron.java @@ -18,7 +18,7 @@ class Neuron implements Serializable {      private List<Double> weights = new ArrayList<>();
 -    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
 +    private synchronized void writeObject(java.io.ObjectOutputStream stream) throws IOException {
          SerializationTools.writeList(weights, stream);
      }
 diff --git a/app/src/main/java/org/rssin/serialization/SerializationTools.java b/app/src/main/java/org/rssin/serialization/SerializationTools.java index 7b06f55..1c2d4db 100755 --- a/app/src/main/java/org/rssin/serialization/SerializationTools.java +++ b/app/src/main/java/org/rssin/serialization/SerializationTools.java @@ -47,7 +47,7 @@ public class SerializationTools {          return array;
      }
 -    public static <T> void writeList(List<T> list, ObjectOutputStream stream) throws IOException {
 +    public synchronized static <T> void writeList(List<T> list, ObjectOutputStream stream) throws IOException {
          stream.write(list.size());
          for(T i : list)
          {
 diff --git a/app/src/main/java/org/rssin/summaries/BablukiAPI.java b/app/src/main/java/org/rssin/summaries/BablukiAPI.java index 417a807..2617262 100644 --- a/app/src/main/java/org/rssin/summaries/BablukiAPI.java +++ b/app/src/main/java/org/rssin/summaries/BablukiAPI.java @@ -27,7 +27,7 @@ public class BablukiAPI implements SummaryAPIInterface{      private boolean stripHtml;      /** -     * +     * constructor       */      public BablukiAPI()      { @@ -76,16 +76,11 @@ public class BablukiAPI implements SummaryAPIInterface{       */      private String getSumText(String content, String title)      { -        if (content.isEmpty()) -            android.util.Log.d("No text to summarize", title); -          SentenceScore[] ranks = getSentenceRanks(content); -        String[] paragraphs = splitIntoParagraphs(content); -         -         -        //choose sentences +        String[] paragraphs = splitIntoParagraphs(content);        +        //choose sentences                 ArrayList<String> sents = new ArrayList();          for(String p: paragraphs) @@ -99,8 +94,7 @@ public class BablukiAPI implements SummaryAPIInterface{          int senc = sents.size(); -        //reduce if neccesairy - +        //shorten the summary if needed          ArrayList<String> sents_bu = (ArrayList<String>)sents.clone();          while((lm == LengthMode.LINES || lm == LengthMode.BOTH) && sents.size() > maxlines) { @@ -110,8 +104,7 @@ public class BablukiAPI implements SummaryAPIInterface{          while((lm == LengthMode.CHARACTERS || lm == LengthMode.BOTH) && getTotalSize(sents, sep) > maxchars)              removeLeastSentences(sents, ranks); -        //output the sentences. -         +        //output the sentences.                  String o = "";          for(String p: sents) @@ -124,16 +117,9 @@ public class BablukiAPI implements SummaryAPIInterface{          }          if (o.isEmpty()) { -            if (senc == 0) -                android.util.Log.d("Empty summary", "No sentences could be found: " + title); -            else if (sents.size() == 0) -                android.util.Log.d("Empty summary", "None of the found sentences fits the summary limit: " + title); -            else -                android.util.Log.d("Empty summary", "all sentences are empty: " + title);              return title;          }          return o; -      }      /** @@ -187,7 +173,6 @@ public class BablukiAPI implements SummaryAPIInterface{              }          }          return index; -      }      private void removeLeastSentences(ArrayList<String> sentences, SentenceScore[] ranks) @@ -234,8 +219,7 @@ public class BablukiAPI implements SummaryAPIInterface{              }              ss[i] = s;          } -        return ss; -         +        return ss;              }      private String[] splitIntoParagraphs(String content) @@ -365,6 +349,5 @@ public class BablukiAPI implements SummaryAPIInterface{      @Override      public void setMaxLines(int lines) {          maxlines = lines; -    } -     +    }     } diff --git a/app/src/main/java/org/rssin/summaries/Special.java b/app/src/main/java/org/rssin/summaries/Special.java deleted file mode 100644 index b367ee5..0000000 --- a/app/src/main/java/org/rssin/summaries/Special.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.rssin.summaries; - -import java.io.*; -import java.util.StringTokenizer; - -/** - * - * @author jbernards - */ -public class Special { - -    char spch[]; - -    /** -     * constructor. -     */ -    public Special() { -        spch = new TxtStatic().getSpecial(); -    } - -    /** -     * devides the sentence into different words. -     * -     * @param sen the sentence string -     * @return the first letter of each word. -     */ -    public char[] getTokens(String sen) { -         -        String[] sp = sen.split(" "); -        char[] words = new char[sp.length]; -        for(int i = 0; i < sp.length; i++) -        { -            words[i] = sp[i].charAt(0); -        } -         -        return words; -    } - -    /** -     * removes special words for a give sentence -     * -     * @param sen sentence -     * @return sentences with the words removed. -     */ -    public String remove(String sen) { -        String dsen = sen; - -        for (int j = 0; j < spch.length; j++) { - -            char csh[] = dsen.toCharArray(); -            dsen = ""; -            for (int i = 0; i < csh.length; i++) { -                if (csh[i] != spch[j]) { -                    dsen = dsen + csh[i]; -                } -            } - -        } - -        return dsen; -    } - -} diff --git a/app/src/main/java/org/rssin/summaries/Stemmer.java b/app/src/main/java/org/rssin/summaries/Stemmer.java deleted file mode 100644 index 54a64fb..0000000 --- a/app/src/main/java/org/rssin/summaries/Stemmer.java +++ /dev/null @@ -1,874 +0,0 @@ -package org.rssin.summaries; - -import java.util.*; - -/** - * - * @author jbernards - */ -public class Stemmer { - -    private static boolean m_CompMode = false; -    private static HashMap m_l11 = null; -    private static HashMap m_l10 = null; -    private static HashMap m_l9 = null; -    private static HashMap m_l8 = null; -    private static HashMap m_l7 = null; -    private static HashMap m_l6 = null; -    private static HashMap m_l5 = null; -    private static HashMap m_l4 = null; -    private static HashMap m_l3 = null; -    private static HashMap m_l2 = null; -    private static HashMap m_l1 = null; - -    static { - -        m_l11 = new HashMap(); -        m_l11.put("alistically", "B"); -        m_l11.put("arizability", "A"); -        m_l11.put("izationally", "B"); -        m_l10 = new HashMap(); -        m_l10.put("antialness", "A"); -        m_l10.put("arisations", "A"); -        m_l10.put("arizations", "A"); -        m_l10.put("entialness", "A"); -        m_l9 = new HashMap(); -        m_l9.put("allically", "C"); -        m_l9.put("antaneous", "A"); -        m_l9.put("antiality", "A"); -        m_l9.put("arisation", "A"); -        m_l9.put("arization", "A"); -        m_l9.put("ationally", "B"); -        m_l9.put("ativeness", "A"); -        m_l9.put("eableness", "E"); -        m_l9.put("entations", "A"); -        m_l9.put("entiality", "A"); -        m_l9.put("entialize", "A"); -        m_l9.put("entiation", "A"); -        m_l9.put("ionalness", "A"); -        m_l9.put("istically", "A"); -        m_l9.put("itousness", "A"); -        m_l9.put("izability", "A"); -        m_l9.put("izational", "A"); -        m_l8 = new HashMap(); -        m_l8.put("ableness", "A"); -        m_l8.put("arizable", "A"); -        m_l8.put("entation", "A"); -        m_l8.put("entially", "A"); -        m_l8.put("eousness", "A"); -        m_l8.put("ibleness", "A"); -        m_l8.put("icalness", "A"); -        m_l8.put("ionalism", "A"); -        m_l8.put("ionality", "A"); -        m_l8.put("ionalize", "A"); -        m_l8.put("iousness", "A"); -        m_l8.put("izations", "A"); -        m_l8.put("lessness", "A"); -        m_l7 = new HashMap(); -        m_l7.put("ability", "A"); -        m_l7.put("aically", "A"); -        m_l7.put("alistic", "B"); -        m_l7.put("alities", "A"); -        m_l7.put("ariness", "E"); -        m_l7.put("aristic", "A"); -        m_l7.put("arizing", "A"); -        m_l7.put("ateness", "A"); -        m_l7.put("atingly", "A"); -        m_l7.put("ational", "B"); -        m_l7.put("atively", "A"); -        m_l7.put("ativism", "A"); -        m_l7.put("elihood", "E"); -        m_l7.put("encible", "A"); -        m_l7.put("entally", "A"); -        m_l7.put("entials", "A"); -        m_l7.put("entiate", "A"); -        m_l7.put("entness", "A"); -        m_l7.put("fulness", "A"); -        m_l7.put("ibility", "A"); -        m_l7.put("icalism", "A"); -        m_l7.put("icalist", "A"); -        m_l7.put("icality", "A"); -        m_l7.put("icalize", "A"); -        m_l7.put("ication", "G"); -        m_l7.put("icianry", "A"); -        m_l7.put("ination", "A"); -        m_l7.put("ingness", "A"); -        m_l7.put("ionally", "A"); -        m_l7.put("isation", "A"); -        m_l7.put("ishness", "A"); -        m_l7.put("istical", "A"); -        m_l7.put("iteness", "A"); -        m_l7.put("iveness", "A"); -        m_l7.put("ivistic", "A"); -        m_l7.put("ivities", "A"); -        m_l7.put("ization", "F"); -        m_l7.put("izement", "A"); -        m_l7.put("oidally", "A"); -        m_l7.put("ousness", "A"); -        m_l6 = new HashMap(); -        m_l6.put("aceous", "A"); -        m_l6.put("acious", "B"); -        m_l6.put("action", "G"); -        m_l6.put("alness", "A"); -        m_l6.put("ancial", "A"); -        m_l6.put("ancies", "A"); -        m_l6.put("ancing", "B"); -        m_l6.put("ariser", "A"); -        m_l6.put("arized", "A"); -        m_l6.put("arizer", "A"); -        m_l6.put("atable", "A"); -        m_l6.put("ations", "B"); -        m_l6.put("atives", "A"); -        m_l6.put("eature", "Z"); -        m_l6.put("efully", "A"); -        m_l6.put("encies", "A"); -        m_l6.put("encing", "A"); -        m_l6.put("ential", "A"); -        m_l6.put("enting", "C"); -        m_l6.put("entist", "A"); -        m_l6.put("eously", "A"); -        m_l6.put("ialist", "A"); -        m_l6.put("iality", "A"); -        m_l6.put("ialize", "A"); -        m_l6.put("ically", "A"); -        m_l6.put("icance", "A"); -        m_l6.put("icians", "A"); -        m_l6.put("icists", "A"); -        m_l6.put("ifully", "A"); -        m_l6.put("ionals", "A"); -        m_l6.put("ionate", "D"); -        m_l6.put("ioning", "A"); -        m_l6.put("ionist", "A"); -        m_l6.put("iously", "A"); -        m_l6.put("istics", "A"); -        m_l6.put("izable", "E"); -        m_l6.put("lessly", "A"); -        m_l6.put("nesses", "A"); -        m_l6.put("oidism", "A"); -        m_l5 = new HashMap(); -        m_l5.put("acies", "A"); -        m_l5.put("acity", "A"); -        m_l5.put("aging", "B"); -        m_l5.put("aical", "A"); -        if (!m_CompMode) { -            m_l5.put("alist", "A"); -        } -        m_l5.put("alism", "B"); -        m_l5.put("ality", "A"); -        m_l5.put("alize", "A"); -        m_l5.put("allic", "b"); -        m_l5.put("anced", "B"); -        m_l5.put("ances", "B"); -        m_l5.put("antic", "C"); -        m_l5.put("arial", "A"); -        m_l5.put("aries", "A"); -        m_l5.put("arily", "A"); -        m_l5.put("arity", "B"); -        m_l5.put("arize", "A"); -        m_l5.put("aroid", "A"); -        m_l5.put("ately", "A"); -        m_l5.put("ating", "I"); -        m_l5.put("ation", "B"); -        m_l5.put("ative", "A"); -        m_l5.put("ators", "A"); -        m_l5.put("atory", "A"); -        m_l5.put("ature", "E"); -        m_l5.put("early", "Y"); -        m_l5.put("ehood", "A"); -        m_l5.put("eless", "A"); -        if (!m_CompMode) { -            m_l5.put("elily", "A"); -        } else { -            m_l5.put("elity", "A"); -        } -        m_l5.put("ement", "A"); -        m_l5.put("enced", "A"); -        m_l5.put("ences", "A"); -        m_l5.put("eness", "E"); -        m_l5.put("ening", "E"); -        m_l5.put("ental", "A"); -        m_l5.put("ented", "C"); -        m_l5.put("ently", "A"); -        m_l5.put("fully", "A"); -        m_l5.put("ially", "A"); -        m_l5.put("icant", "A"); -        m_l5.put("ician", "A"); -        m_l5.put("icide", "A"); -        m_l5.put("icism", "A"); -        m_l5.put("icist", "A"); -        m_l5.put("icity", "A"); -        m_l5.put("idine", "I"); -        m_l5.put("iedly", "A"); -        m_l5.put("ihood", "A"); -        m_l5.put("inate", "A"); -        m_l5.put("iness", "A"); -        m_l5.put("ingly", "B"); -        m_l5.put("inism", "J"); -        m_l5.put("inity", "c"); -        m_l5.put("ional", "A"); -        m_l5.put("ioned", "A"); -        m_l5.put("ished", "A"); -        m_l5.put("istic", "A"); -        m_l5.put("ities", "A"); -        m_l5.put("itous", "A"); -        m_l5.put("ively", "A"); -        m_l5.put("ivity", "A"); -        m_l5.put("izers", "F"); -        m_l5.put("izing", "F"); -        m_l5.put("oidal", "A"); -        m_l5.put("oides", "A"); -        m_l5.put("otide", "A"); -        m_l5.put("ously", "A"); -        m_l4 = new HashMap(); -        m_l4.put("able", "A"); -        m_l4.put("ably", "A"); -        m_l4.put("ages", "B"); -        m_l4.put("ally", "B"); -        m_l4.put("ance", "B"); -        m_l4.put("ancy", "B"); -        m_l4.put("ants", "B"); -        m_l4.put("aric", "A"); -        m_l4.put("arly", "K"); -        m_l4.put("ated", "I"); -        m_l4.put("ates", "A"); -        m_l4.put("atic", "B"); -        m_l4.put("ator", "A"); -        m_l4.put("ealy", "Y"); -        m_l4.put("edly", "E"); -        m_l4.put("eful", "A"); -        m_l4.put("eity", "A"); -        m_l4.put("ence", "A"); -        m_l4.put("ency", "A"); -        m_l4.put("ened", "E"); -        m_l4.put("enly", "E"); -        m_l4.put("eous", "A"); -        m_l4.put("hood", "A"); -        m_l4.put("ials", "A"); -        m_l4.put("ians", "A"); -        m_l4.put("ible", "A"); -        m_l4.put("ibly", "A"); -        m_l4.put("ical", "A"); -        m_l4.put("ides", "L"); -        m_l4.put("iers", "A"); -        m_l4.put("iful", "A"); -        m_l4.put("ines", "M"); -        m_l4.put("ings", "N"); -        m_l4.put("ions", "B"); -        m_l4.put("ious", "A"); -        m_l4.put("isms", "B"); -        m_l4.put("ists", "A"); -        m_l4.put("itic", "H"); -        m_l4.put("ized", "F"); -        m_l4.put("izer", "F"); -        m_l4.put("less", "A"); -        m_l4.put("lily", "A"); -        m_l4.put("ness", "A"); -        m_l4.put("ogen", "A"); -        m_l4.put("ward", "A"); -        m_l4.put("wise", "A"); -        m_l4.put("ying", "B"); -        m_l4.put("yish", "A"); -        m_l3 = new HashMap(); -        m_l3.put("acy", "A"); -        m_l3.put("age", "B"); -        m_l3.put("aic", "A"); -        m_l3.put("als", "b"); -        m_l3.put("ant", "B"); -        m_l3.put("ars", "O"); -        m_l3.put("ary", "F"); -        m_l3.put("ata", "A"); -        m_l3.put("ate", "A"); -        m_l3.put("eal", "Y"); -        m_l3.put("ear", "Y"); -        m_l3.put("ely", "E"); -        m_l3.put("ene", "E"); -        m_l3.put("ent", "C"); -        m_l3.put("ery", "E"); -        m_l3.put("ese", "A"); -        m_l3.put("ful", "A"); -        m_l3.put("ial", "A"); -        m_l3.put("ian", "A"); -        m_l3.put("ics", "A"); -        m_l3.put("ide", "L"); -        m_l3.put("ied", "A"); -        m_l3.put("ier", "A"); -        m_l3.put("ies", "P"); -        m_l3.put("ily", "A"); -        m_l3.put("ine", "M"); -        m_l3.put("ing", "N"); -        m_l3.put("ion", "Q"); -        m_l3.put("ish", "C"); -        m_l3.put("ism", "B"); -        m_l3.put("ist", "A"); -        m_l3.put("ite", "a"); -        m_l3.put("ity", "A"); -        m_l3.put("ium", "A"); -        m_l3.put("ive", "A"); -        m_l3.put("ize", "F"); -        m_l3.put("oid", "A"); -        m_l3.put("one", "R"); -        m_l3.put("ous", "A"); -        m_l2 = new HashMap(); -        m_l2.put("ae", "A"); -        m_l2.put("al", "b"); -        m_l2.put("ar", "X"); -        m_l2.put("as", "B"); -        m_l2.put("ed", "E"); -        m_l2.put("en", "F"); -        m_l2.put("es", "E"); -        m_l2.put("ia", "A"); -        m_l2.put("ic", "A"); -        m_l2.put("is", "A"); -        m_l2.put("ly", "B"); -        m_l2.put("on", "S"); -        m_l2.put("or", "T"); -        m_l2.put("um", "U"); -        m_l2.put("us", "V"); -        m_l2.put("yl", "R"); -        m_l2.put("s\'", "A"); -        m_l2.put("\'s", "A"); -        m_l1 = new HashMap(); -        m_l1.put("a", "A"); -        m_l1.put("e", "A"); -        m_l1.put("i", "A"); -        m_l1.put("o", "A"); -        m_l1.put("s", "W"); -        m_l1.put("y", "B"); -    } - -    private String removeEnding(String word) { - -        int length = word.length(); -        int el = 11; - -        while (el > 0) { -            if (length - el > 1) { -                String ending = word.substring(length - el); -                String conditionCode = null; -                switch (el) { -                    case 11: -                        conditionCode = (String) m_l11.get(ending); -                        break; -                    case 10: -                        conditionCode = (String) m_l10.get(ending); -                        break; -                    case 9: -                        conditionCode = (String) m_l9.get(ending); -                        break; -                    case 8: -                        conditionCode = (String) m_l8.get(ending); -                        break; -                    case 7: -                        conditionCode = (String) m_l7.get(ending); -                        break; -                    case 6: -                        conditionCode = (String) m_l6.get(ending); -                        break; -                    case 5: -                        conditionCode = (String) m_l5.get(ending); -                        break; -                    case 4: -                        conditionCode = (String) m_l4.get(ending); -                        break; -                    case 3: -                        conditionCode = (String) m_l3.get(ending); -                        break; -                    case 2: -                        conditionCode = (String) m_l2.get(ending); -                        break; -                    case 1: -                        conditionCode = (String) m_l1.get(ending); -                        break; -                    default: -                } -                if (conditionCode != null) { -                    switch (conditionCode.charAt(0)) { -                        case 'A': -                            return word.substring(0, length - el); -                        case 'B': -                            if (length - el > 2) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'C': -                            if (length - el > 3) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'D': -                            if (length - el > 4) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'E': -                            if (word.charAt(length - el - 1) != 'e') { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'F': -                            if ((length - el > 2) -                                    && (word.charAt(length - el - 1) != 'e')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'G': -                            if ((length - el > 2) -                                    && (word.charAt(length - el - 1) == 'f')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'H': -                            if ((word.charAt(length - el - 1) == 't') -                                    || ((word.charAt(length - el - 1) == 'l') -                                    && (word.charAt(length - el - 2) == 'l'))) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'I': -                            if ((word.charAt(length - el - 1) != 'o') -                                    && (word.charAt(length - el - 1) != 'e')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'J': -                            if ((word.charAt(length - el - 1) != 'a') -                                    && (word.charAt(length - el - 1) != 'e')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'K': -                            if ((length - el > 2) -                                    && ((word.charAt(length - el - 1) == 'l') -                                    || (word.charAt(length - el - 1) == 'i') -                                    || ((word.charAt(length - el - 1) == 'e') -                                    && (word.charAt(length - el - 3) == 'u')))) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'L': -                            if ((word.charAt(length - el - 1) != 'u') -                                    && (word.charAt(length - el - 1) != 'x') -                                    && ((word.charAt(length - el - 1) != 's') -                                    || (word.charAt(length - el - 2) == 'o'))) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'M': -                            if ((word.charAt(length - el - 1) != 'a') -                                    && (word.charAt(length - el - 1) != 'c') -                                    && (word.charAt(length - el - 1) != 'e') -                                    && (word.charAt(length - el - 1) != 'm')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'N': -                            if ((length - el > 3) -                                    || ((length - el == 3) -                                    && ((word.charAt(length - el - 3) != 's')))) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'O': -                            if ((word.charAt(length - el - 1) == 'l') -                                    || (word.charAt(length - el - 1) == 'i')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'P': -                            if (word.charAt(length - el - 1) != 'c') { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'Q': -                            if ((length - el > 2) -                                    && (word.charAt(length - el - 1) != 'l') -                                    && (word.charAt(length - el - 1) != 'n')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'R': -                            if ((word.charAt(length - el - 1) == 'n') -                                    || (word.charAt(length - el - 1) == 'r')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'S': -                            if (((word.charAt(length - el - 1) == 'r') -                                    && (word.charAt(length - el - 2) == 'd')) -                                    || ((word.charAt(length - el - 1) == 't') -                                    && (word.charAt(length - el - 2) != 't'))) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'T': -                            if ((word.charAt(length - el - 1) == 's') -                                    || ((word.charAt(length - el - 1) == 't') -                                    && (word.charAt(length - el - 2) != 'o'))) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'U': -                            if ((word.charAt(length - el - 1) == 'l') -                                    || (word.charAt(length - el - 1) == 'm') -                                    || (word.charAt(length - el - 1) == 'n') -                                    || (word.charAt(length - el - 1) == 'r')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'V': -                            if (word.charAt(length - el - 1) == 'c') { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'W': -                            if ((word.charAt(length - el - 1) != 's') -                                    && (word.charAt(length - el - 1) != 'u')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'X': -                            if ((word.charAt(length - el - 1) == 'l') -                                    || (word.charAt(length - el - 1) == 'i') -                                    || ((length - el > 2) -                                    && (word.charAt(length - el - 1) == 'e') -                                    && (word.charAt(length - el - 3) == 'u'))) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'Y': -                            if ((word.charAt(length - el - 1) == 'n') -                                    && (word.charAt(length - el - 2) == 'i')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'Z': -                            if (word.charAt(length - el - 1) != 'f') { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'a': -                            if ((word.charAt(length - el - 1) == 'd') -                                    || (word.charAt(length - el - 1) == 'f') -                                    || (((word.charAt(length - el - 1) == 'h') -                                    && (word.charAt(length - el - 2) == 'p'))) -                                    || (((word.charAt(length - el - 1) == 'h') -                                    && (word.charAt(length - el - 2) == 't'))) -                                    || (word.charAt(length - el - 1) == 'l') -                                    || (((word.charAt(length - el - 1) == 'r') -                                    && (word.charAt(length - el - 2) == 'e'))) -                                    || (((word.charAt(length - el - 1) == 'r') -                                    && (word.charAt(length - el - 2) == 'o'))) -                                    || (((word.charAt(length - el - 1) == 's') -                                    && (word.charAt(length - el - 2) == 'e'))) -                                    || (word.charAt(length - el - 1) == 't')) { -                                return word.substring(0, length - el); -                            } -                            break; -                        case 'b': -                            if (m_CompMode) { -                                if (((length - el == 3) -                                        && (!((word.charAt(length - el - 1) == 't') -                                        && (word.charAt(length - el - 2) == 'e') -                                        && (word.charAt(length - el - 3) == 'm')))) -                                        || ((length - el > 3) -                                        && (!((word.charAt(length - el - 1) == 't') -                                        && (word.charAt(length - el - 2) == 's') -                                        && (word.charAt(length - el - 3) == 'y') -                                        && (word.charAt(length - el - 4) == 'r'))))) { -                                    return word.substring(0, length - el); -                                } -                            } else { -                                if ((length - el > 2) -                                        && (!((word.charAt(length - el - 1) == 't') -                                        && (word.charAt(length - el - 2) == 'e') -                                        && (word.charAt(length - el - 3) == 'm'))) -                                        && ((length - el < 4) -                                        || (!((word.charAt(length - el - 1) == 't') -                                        && (word.charAt(length - el - 2) == 's') -                                        && (word.charAt(length - el - 3) == 'y') -                                        && (word.charAt(length - el - 4) == 'r'))))) { -                                    return word.substring(0, length - el); -                                } -                            } -                            break; -                        case 'c': -                            if (word.charAt(length - el - 1) == 'l') { -                                return word.substring(0, length - el); -                            } -                            break; -                        default: -                            throw new IllegalArgumentException("Fatal error."); -                    } -                } -            } -            el--; -        } -        return word; -    } - -    private String recodeEnding(String word) { - -        int lastPos = word.length() - 1; - -        // Rule 1 -        if (word.endsWith("bb") -                || word.endsWith("dd") -                || word.endsWith("gg") -                || word.endsWith("ll") -                || word.endsWith("mm") -                || word.endsWith("nn") -                || word.endsWith("pp") -                || word.endsWith("rr") -                || word.endsWith("ss") -                || word.endsWith("tt")) { -            word = word.substring(0, lastPos); -            lastPos--; -        } - -        // Rule 2 -        if (word.endsWith("iev")) { -            word = word.substring(0, lastPos - 2).concat("ief"); -        } - -        // Rule 3 -        if (word.endsWith("uct")) { -            word = word.substring(0, lastPos - 2).concat("uc"); -            lastPos--; -        } - -        // Rule 4 -        if (word.endsWith("umpt")) { -            word = word.substring(0, lastPos - 3).concat("um"); -            lastPos -= 2; -        } - -        // Rule 5 -        if (word.endsWith("rpt")) { -            word = word.substring(0, lastPos - 2).concat("rb"); -            lastPos--; -        } - -        // Rule 6 -        if (word.endsWith("urs")) { -            word = word.substring(0, lastPos - 2).concat("ur"); -            lastPos--; -        } - -        // Rule 7 -        if (word.endsWith("istr")) { -            word = word.substring(0, lastPos - 3).concat("ister"); -            lastPos++; -        } - -        // Rule 7a -        if (word.endsWith("metr")) { -            word = word.substring(0, lastPos - 3).concat("meter"); -            lastPos++; -        } - -        // Rule 8 -        if (word.endsWith("olv")) { -            word = word.substring(0, lastPos - 2).concat("olut"); -            lastPos++; -        } - -        // Rule 9 -        if (word.endsWith("ul")) { -            if ((lastPos - 2 < 0) -                    || ((word.charAt(lastPos - 2) != 'a') -                    && (word.charAt(lastPos - 2) != 'i') -                    && (word.charAt(lastPos - 2) != 'o'))) { -                word = word.substring(0, lastPos - 1).concat("l"); -                lastPos--; -            } -        } - -        // Rule 10 -        if (word.endsWith("bex")) { -            word = word.substring(0, lastPos - 2).concat("bic"); -        } - -        // Rule 11 -        if (word.endsWith("dex")) { -            word = word.substring(0, lastPos - 2).concat("dic"); -        } - -        // Rule 12 -        if (word.endsWith("pex")) { -            word = word.substring(0, lastPos - 2).concat("pic"); -        } - -        // Rule 13 -        if (word.endsWith("tex")) { -            word = word.substring(0, lastPos - 2).concat("tic"); -        } - -        // Rule 14 -        if (word.endsWith("ax")) { -            word = word.substring(0, lastPos - 1).concat("ac"); -        } - -        // Rule 15 -        if (word.endsWith("ex")) { -            word = word.substring(0, lastPos - 1).concat("ec"); -        } - -        // Rule 16 -        if (word.endsWith("ix")) { -            word = word.substring(0, lastPos - 1).concat("ic"); -        } - -        // Rule 17 -        if (word.endsWith("lux")) { -            word = word.substring(0, lastPos - 2).concat("luc"); -        } - -        // Rule 18 -        if (word.endsWith("uad")) { -            word = word.substring(0, lastPos - 2).concat("uas"); -        } - -        // Rule 19 -        if (word.endsWith("vad")) { -            word = word.substring(0, lastPos - 2).concat("vas"); -        } - -        // Rule 20 -        if (word.endsWith("cid")) { -            word = word.substring(0, lastPos - 2).concat("cis"); -        } - -        // Rule 21 -        if (word.endsWith("lid")) { -            word = word.substring(0, lastPos - 2).concat("lis"); -        } - -        // Rule 22 -        if (word.endsWith("erid")) { -            word = word.substring(0, lastPos - 3).concat("eris"); -        } - -        // Rule 23 -        if (word.endsWith("pand")) { -            word = word.substring(0, lastPos - 3).concat("pans"); -        } - -        // Rule 24 -        if (word.endsWith("end")) { -            if ((lastPos - 3 < 0) -                    || (word.charAt(lastPos - 3) != 's')) { -                word = word.substring(0, lastPos - 2).concat("ens"); -            } -        } - -        // Rule 25 -        if (word.endsWith("ond")) { -            word = word.substring(0, lastPos - 2).concat("ons"); -        } - -        // Rule 26 -        if (word.endsWith("lud")) { -            word = word.substring(0, lastPos - 2).concat("lus"); -        } - -        // Rule 27 -        if (word.endsWith("rud")) { -            word = word.substring(0, lastPos - 2).concat("rus"); -        } - -        // Rule 28 -        if (word.endsWith("her")) { -            if ((lastPos - 3 < 0) -                    || ((word.charAt(lastPos - 3) != 'p') -                    && (word.charAt(lastPos - 3) != 't'))) { -                word = word.substring(0, lastPos - 2).concat("hes"); -            } -        } - -        // Rule 29 -        if (word.endsWith("mit")) { -            word = word.substring(0, lastPos - 2).concat("mis"); -        } - -        // Rule 30 -        if (word.endsWith("end")) { -            if ((lastPos - 3 < 0) -                    || (word.charAt(lastPos - 3) != 'm')) { -                word = word.substring(0, lastPos - 2).concat("ens"); -            } -        } - -        // Rule 31 -        if (word.endsWith("ert")) { -            word = word.substring(0, lastPos - 2).concat("ers"); -        } - -        // Rule 32 -        if (word.endsWith("et")) { -            if ((lastPos - 2 < 0) -                    || (word.charAt(lastPos - 2) != 'n')) { -                word = word.substring(0, lastPos - 1).concat("es"); -            } -        } - -        // Rule 33 -        if (word.endsWith("yt")) { -            word = word.substring(0, lastPos - 1).concat("ys"); -        } - -        // Rule 34 -        if (word.endsWith("yz")) { -            word = word.substring(0, lastPos - 1).concat("ys"); -        } - -        return word; -    } - -    /** -     * -     * @param word -     * @return -     */ -    public String stem(String word) { - -        if (word.length() > 2) { -            return recodeEnding(removeEnding(word.toLowerCase())); -        } else { -            return word.toLowerCase(); -        } -    } - -    /** -     * -     * @param str -     * @return -     */ -    public String stemString(String str) { - -        StringBuffer result = new StringBuffer(); -        int start = -1; -        for (int j = 0; j < str.length(); j++) { -            char c = str.charAt(j); -            if (Character.isLetterOrDigit(c)) { -                if (start == -1) { -                    start = j; -                } -            } else if (c == '\'') { -                if (start == -1) { -                    result.append(c); -                } -            } else { -                if (start != -1) { -                    result.append(stem(str.substring(start, j))); -                    start = -1; -                } -                result.append(c); -            } -        } -        if (start != -1) { -            result.append(stem(str.substring(start, str.length()))); -        } -        return result.toString(); -    } - -} diff --git a/app/src/main/java/org/rssin/summaries/Stopword.java b/app/src/main/java/org/rssin/summaries/Stopword.java deleted file mode 100644 index e43d3bd..0000000 --- a/app/src/main/java/org/rssin/summaries/Stopword.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.rssin.summaries; - -import java.io.*; -import java.util.StringTokenizer; - -/** - * - * @author jbernards - */ -public class Stopword { - -    String stwd[]; - -    /** -     * -     */ -    public Stopword() { -        stwd = new TxtStatic().getStopWords(); -    } - -    /** -     * -     * @param word -     * @return -     */ -    public boolean isStopword(String word) { -        boolean flag = false; -        for (int i = 0; i < stwd.length; i++) { -            if (stwd[i].equalsIgnoreCase(word)) { -                flag = true; -                break; -            } -        } -        return flag; -    } - -    /** -     * -     * @param sen -     * @return -     */ -    public String[] getTokens(String sen) { -        int sz = 0, cnt = 0; -        String words[] = null; -        StringTokenizer stk = new StringTokenizer(sen); -        sz = stk.countTokens(); -        words = new String[sz]; -        while (stk.hasMoreTokens()) { -            words[cnt] = new String(stk.nextToken()); -            cnt++; -        } -        return words; -    } - -    /** -     * -     * @param sen -     * @return -     */ -    public String remove(String sen) { -        String dsen = ""; -        String words[] = getTokens(sen); -        for (int j = 0; j < words.length; j++) { -            if (!isStopword(words[j])) { -                dsen = dsen + words[j] + " "; -            } -        } -        return dsen; -    } - -} diff --git a/app/src/main/java/org/rssin/summaries/SummaryAPI.java b/app/src/main/java/org/rssin/summaries/SummaryAPI.java deleted file mode 100644 index 780e613..0000000 --- a/app/src/main/java/org/rssin/summaries/SummaryAPI.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.rssin.summaries; - -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Set; -import org.rssin.rss.FeedItem; - -/** - * Summary API van AST - * - * @author Joep - */ -public class SummaryAPI implements SummaryAPIInterface { - -    LengthMode lm; -    int maxchars, maxlines; - -    /** -     * get a Summary object from a feedItem, using the settings specified. -     * -     * @param f FeedItem containing the text to summarize. -     * @return The summary -     */ -    @Override -    public Summary getSummary(FeedItem f) { -        //todo -        String desc = f.getDescription(); -        String t = getSumText(desc); -        Summary s = new Summary(t); - -        return s; -    } - -    @Override -    public void setHtmlStrip(boolean b) -    { -        //meh -    } - -    /** -     * Constructor -     */ -    public SummaryAPI() { -        lm = LengthMode.NOLIMIT; -        maxchars = Integer.MAX_VALUE; -        maxlines = Integer.MAX_VALUE; -    } - -    /** -     * Generates get a Summary object from a String, using the settings -     * specified. -     * -     * @param desc the text to summarize -     * @return The summary. -     */ -    @Override -    public Summary getSummaryFromText(String desc) { -        String t = getSumText(desc); - -        Summary s = new Summary(t); - -        return s; -    } - -    /** -     * gets the summary string from a text string, using the settings specified. -     * -     * @param desc string to summarize -     * @return the summary text. -     */ -    public String getSumText(String desc) { -        Hashtable hs = new Hashtable(); -        ArrayList<SentenceItem> zinnen = getSentences(desc); - -        //remove stopwords -        Stopword stop = new Stopword(); -        Special specl = new Special(); -        for (int i = 0; i < zinnen.size(); i++) { -            SentenceItem sl = (SentenceItem) zinnen.get(i); -            sl.setSRSentence(specl.remove(sl.getRawSentence())); -            sl.setSRSentence(stop.remove(sl.getSRSentence())); -        } - -        //unique words -        for (int i = 0; i < zinnen.size(); i++) { -            SentenceItem sl = (SentenceItem) zinnen.get(i); -            String sen = sl.getSRSentence(); - -            int wordcount = 0; -            String[] words = sen.split(" "); - -            for (String tok : words) { - -                tok = tok.trim(); - -                wordcount++; - -                if (!hs.containsKey(tok) && tok.length() >= 3) { -                    addword(tok, i, wordcount, hs); -                } else if (hs.containsKey(tok)) { -                    upword(tok, i, wordcount, hs); -                } -            } -        } - -        //stemming -        stemming(hs); - -        //significant -        Enumeration key = hs.keys(); -        while (key.hasMoreElements()) { -            delword(key.nextElement(), hs); -        } - -        //getWeight -        key = hs.keys(); -        while (key.hasMoreElements()) { -            setWeight(key.nextElement(), hs, zinnen); -        } - -        //ranking + return :P -        ranking(zinnen, hs); - -        return chooseSentence(zinnen); -    } - -    private String chooseSentence(ArrayList<SentenceItem> zinnen) { -        String output = ""; -        int lines = zinnen.size(); -        SentenceItem[] z = zinnen.toArray(new SentenceItem[0]); -        if (lm == LengthMode.LINES || lm == LengthMode.BOTH) { -            lines = Math.min(zinnen.size(), maxlines); -            z = new SentenceItem[lines]; -            for (int i = 0; i < zinnen.size(); i++) { -                boolean placed = false; -                int j = 0; -                while (j < lines && !placed) { -                    if (z[j] == null) { -                        z[j] = zinnen.get(i); -                        placed = true; -                    } -                    j++; -                } -                j--; - -                while (!placed && j >= 0) { -                    if (z[j].getWeight() > zinnen.get(i).getWeight()) { -                        z[j] = zinnen.get(i); -                        placed = true; -                    } -                    j--; -                } -            } -        } -         -        if (lm == LengthMode.CHARACTERS || lm == LengthMode.BOTH) { -            //todo -        } -         -        for(SentenceItem zin : z) -        { -            output += zin.getRawSentence(); -        } - -        return output; -    } - -    private void setWeight(Object tok, Hashtable hs, ArrayList zinnen) { -        double wg = 0.0; -        WordItem wl = (WordItem) hs.get(tok); -        double scnt = (double) zinnen.size(); -        double tf = wl.getcount(); -        double df = wl.sentensecount(); -        wg = tf * Math.log10(scnt / df); -        wl.addWeight(wg); -    } - -    /** -     * -     * @param zinnen -     * @param hs -     * @return -     */ -    public String ranking(ArrayList<SentenceItem> zinnen, Hashtable hs) { -        SentenceItem sl = null; -        double max = 0.0; -        int mi = 0; - -        for (int i = 0; i < zinnen.size(); i++) { -            sl = zinnen.get(i); -            String sen = sl.getSRSentence(); -            Enumeration key = hs.keys(); -            while (key.hasMoreElements()) { -                String str = (String) key.nextElement(); -                if (sen.indexOf(str) != -1) { -                    WordItem wl = (WordItem) hs.get(str); -                    sl.addWeight(wl.getWeight()); -                } -            } -        } - -        for (int i = 0; i < zinnen.size(); i++) { -            sl = (SentenceItem) zinnen.get(i); -            if (sl.getWeight() > max) { -                max = sl.getWeight(); -                mi = i; -            } -        } - -        String str1 = sl.getRawSentence(); -        sl = zinnen.get(mi); - -        return str1; -    } - -    private void delword(Object tok, Hashtable hs) { -        WordItem wl = (WordItem) hs.remove(tok); -        if (wl.getcount() > 3) { -            hs.put(tok, wl); -        } -    } - -    private void stemword(String w1, String w2, Hashtable hs) { -        if (!hs.containsKey(w2) || !hs.containsKey(w1)) { -            // System.out.print("return:"); -            return; -        } -        WordItem wl1 = (WordItem) hs.remove(w1); -        WordItem wl2 = (WordItem) hs.remove(w2); - -        ArrayList wp = wl2.getwordpos(); -        ArrayList sp = wl2.getsentensepos(); - -        for (int i = 0; i < wp.size(); i++) { -            String wp2 = (String) wp.get(i); -            String sp2 = (String) sp.get(i); -            wl1.incrcount(Integer.parseInt(wp2), Integer.parseInt(sp2)); -        } - -        hs.put(w1, wl1); -    } - -    private double difpos(String str1, String str2) { -        int sz = Math.min(str1.length(), str2.length()); -        int mz = Math.max(str1.length(), str2.length()); - -        double dp = mz; -        double sm = 0; - -        for (int i = 0; i < mz; i++) { -            if (str1.charAt(i) != str2.charAt(i)) { -                dp = i + 1; -                break; -            } else { -                sm++; -            } -        } -        return (sm * (dp / sz)); -    } - -    private void stemming(Hashtable hs) { -        int sz = hs.size(); - -        double wdis[][] = new double[sz][sz]; - -        Set s1 = hs.keySet(); - -        Object obj[] = s1.toArray(); - -        for (int i = 0; i < sz; i++) { -            String str1 = (String) obj[i]; -            for (int j = 0; j < sz; j++) { -                String str2 = (String) obj[j]; -                if (i != j) { -                    wdis[i][j] = difpos(str1, str2); -                } -            } -        } - -        for (int i = 0; i < sz; i++) { -            String str1 = (String) obj[i]; -            for (int j = 0; j < sz; j++) { -                String str2 = (String) obj[j]; -                if (i != j && wdis[i][j] >= 3.0) { -                    stemword(str1, str2, hs); -                } -            } -        } -    } - -    private void addword(String tok, int sp, int wp, Hashtable hs) { -        WordItem wl = new WordItem(tok); -        wl.incrcount(sp + 1, wp); -        hs.put(tok, wl); -    } - -    private void upword(String tok, int sp, int wp, Hashtable hs) { -        WordItem wl = (WordItem) hs.remove(tok); -        wl.incrcount(sp + 1, wp); -        hs.put(tok, wl); -    } - -    private ArrayList<SentenceItem> getSentences(String doc) { -        ArrayList<SentenceItem> als = new ArrayList(); - -        int fs1 = 0; -        int fs2 = 0; -        int nx = 0; - -        while (nx < (doc.length() - 1)) { -            nx = doc.indexOf(".", fs2); -            if (nx == -1) { -                break; -            } else if (nx == doc.lastIndexOf(".")) { -                String str = (doc.substring(fs1, nx + 1)).toLowerCase(); -                als.add(new SentenceItem(str)); -                fs2 = nx + 1; -                fs1 = fs2; -                break; -            } else if (doc.charAt(nx + 1) == ' ' || doc.charAt(nx + 1) == '\r' || doc.charAt(nx + 1) == '\n') { -                String str = (doc.substring(fs1, nx + 1).toLowerCase()).trim(); -                als.add(new SentenceItem(str)); -                fs2 = nx + 1; -                fs1 = fs2; -            } else { -                fs2 = nx + 1; -            } -        } - -        return als; -    } - -    /** -     * set the lengthmode -_- -     * -     * @param l Mode to use. -     */ -    @Override -    public void setLengthMode(LengthMode l) { -        lm = l; -    } - -    /** -     * set the maximum number of characters of the summary text. -     * -     * @param chars integer value of the amount. -     */ -    @Override -    public void setMaxChars(int chars) { -        maxchars = chars; -    } - -    /** -     * set the maximum number of sentences of the summary text. -     * -     * @param lines integer value of the amount. -     */ -    @Override -    public void setMaxLines(int lines) { -        maxlines = lines; -    } -} diff --git a/app/src/main/java/org/rssin/summaries/TxtStatic.java b/app/src/main/java/org/rssin/summaries/TxtStatic.java deleted file mode 100644 index e31bf8b..0000000 --- a/app/src/main/java/org/rssin/summaries/TxtStatic.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.rssin.summaries; - -/** - * - * @author Joep - */ -public class TxtStatic { - -    private final String[] stopwords = {"a", "about", "above", "across", "after", "afterwards", "again", "against", "all", "almost", "alone", "along", "already", "also", "although", "always", "am", "among", "amongst", "amoungst", "amount", "an", "and", "another", "any", "anyhow", "anyone", "anything", "anyway", "anywhere", "are", "around", "as", "at", "back", "be", "became", "because", "become", "becomes", "becoming", "been", "before", "beforehand", "behind", "being", "below", "beside", "besides", "between", "beyond", "bill", "both", "bottom", "but", "by", "by", "call", "can", "common", "cannot", "cant", "co", "computer", "con", "could", "couldnt", "cry", "de", "describe", "detail", "do", "does", "done", "down", "due", "during", "each", "eg", "eight", "either", "eleven", "else", "elsewhere", "empty", "enough", "etc", "even", "ever", "every", "everyone", "everything", "everywhere", "except", "few", "fifteen", "fify", "fill", "find", "fire", "first", "five", "for", "former", "formerly", "forty", "found", "four", "from", "front", "full", "further", "get", "give", "go", "had", "has", "hasnt", "have", "he", "hence", "her", "here", "hereafter", "hereby", "herein", "hereupon", "hers", "herself", "him", "himself", "his", "how", "however", "hundred", "i", "ie", "if", "in", "inc", "indeed", "interest", "into", "is", "it", "its", "itself", "keep", "last", "latter", "latterly", "least", "less", "ltd", "made", "many", "may", "me", "meanwhile", "might", "mill", "mine", "more", "moreover", "most", "mostly", "move", "much", "must", "my", "myself", "name", "namely", "neither", "never", "nevertheless", "next", "nine", "no", "nobody", "none", "noone", "nor", "not", "nothing", "now", "nowhere", "of", "off", "often", "on", "once", "one", "only", "onto", "or", "other", "others", "otherwise", "our", "ours", "ourselves", "out", "over", "own", "part", "per", "perhaps", "please", "put", "rather", "re", "same", "see", "seem", "seemed", "seeming", "seems", "serious", "several", "she", "should", "show", "side", "since", "sincere", "six", "sixty", "so", "some", "somehow", "someone", "something", "sometime", "sometimes", "somewhere", "still", "such", "system", "take", "ten", "than", "that", "the", "their", "them", "themselves", "then", "thence", "there", "thereafter", "thereby", "therefore", "therein", "thereupon", "these", "they", "thick", "thin", "third", "this", "those", "though", "three", "through", "throughout", "thru", "thus", "to", "together", "too", "top", "toward", "towards", "twelve", "twenty", "two", "un", "under", "until", "up", "upon", "us", "usually", "usual", "very", "via", "was", "we", "well", "were", "what", "whatever", "when", "whence", "whenever", "where", "whereafter", "whereas", "whereby", "whereinwhereupon", "wherever", "whether", "which", "while", "whither", "who", "whoever", "whole", "whom", "whose", "why", "will", "with", "within", "without", "would", "yet", "you", "your", "yours", "yourself", "yourselves", "don't", "won't", "can't", "didn't", "it's", "is'nt", "aren't", "wasn't", "haven't", "hasn't", "hadn't", "you've", "it'hv", "you'd", "you're", "hasn't", "we�ll", "you�re", "we're", "we've"}; - -    private final char[] special = {'"', ',', ';', '!', '&', '/', '$', ':', '|', '%', ')', '(', '[', ']', '�', '�', '\'', '.', ' ', '\n'}; - -    /** -     * -     * @return -     */ -    public String[] getStopWords() { -        return stopwords; -    } - -    /** -     * -     * @return -     */ -    public char[] getSpecial() { -        return special; -    } -} diff --git a/app/src/main/java/org/rssin/summaries/tester.java b/app/src/main/java/org/rssin/summaries/tester.java deleted file mode 100644 index c795c78..0000000 --- a/app/src/main/java/org/rssin/summaries/tester.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.rssin.summaries; - -import java.net.URL; -import java.util.Calendar; -import java.util.Scanner; -import org.rssin.rss.FeedItem; - -/** - * - * @author jbernards - */ -public class tester { - -    /** -     * @param args the command line arguments -     */ -    public static void main(String[] args) { -        Scanner scanner = new Scanner(System.in); - -        System.out.println("Voer een tekst in"); -        String t = ""; -        String s = ""; - -        do { -            t += s + "\n"; -            s = scanner.nextLine(); -        } while (!s.contains("#")); - -        System.out.println("Tekst geaccepteerd."); - -        SummaryAPIInterface sumo = new BablukiAPI(); -        sumo.setLengthMode(LengthMode.LINES); -        sumo.setMaxLines(2); - -        System.out.println("Sumo ingesteld."); -         -        Summary su = sumo.getSummaryFromText(t); -        String k = su.getText(); - -        //k = k.trim(); - -        System.out.println(k); - -        System.out.println(k.length()); -        System.out.println(t.length()); -    } - -} diff --git a/app/src/main/res/layout/item_navigation_drawer.xml b/app/src/main/res/layout/item_navigation_drawer.xml index 6555bb3..7adc547 100755 --- a/app/src/main/res/layout/item_navigation_drawer.xml +++ b/app/src/main/res/layout/item_navigation_drawer.xml @@ -8,23 +8,14 @@      android:orientation="vertical"
      android:layout_marginTop="0dp"
 -    android:background="#121212"
 -    >
 +    android:background="#121212">
 -    <LinearLayout
 +    <TextView
 +        android:id="@+id/item_navigation_drawer_text"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
 -        android:minHeight="55dp"
 -        >
 -
 -        <TextView
 -            android:id="@+id/item_navigation_drawer_text"
 -            android:layout_width="wrap_content"
 -            android:layout_height="wrap_content"
 -            android:layout_margin="10dp"
 -            android:textAppearance="?android:attr/textAppearanceMedium"
 -            android:textColor="#FFFFFF"
 -            />
 -    </LinearLayout>
 +        android:layout_margin="10dp"
 +        android:textAppearance="?android:attr/textAppearanceMedium"
 +        android:textColor="#FFFFFF"/>
  </LinearLayout>
\ No newline at end of file  | 
