Commit 199ee44d authored by Seyed Reza  Sajjadinasab's avatar Seyed Reza Sajjadinasab
Browse files

fixBugChecker

parent 65560793
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import javax.swing.text.DefaultHighlighter;
import DBinterface.DBinterface;
import DirectedGraph.BasicGraph;
import HashTableMaker.HashTableMaker;
import util.StringProcessor;

import java.sql.SQLException;
import java.awt.*;
@@ -103,8 +104,8 @@ public class HighlighterGUI extends JFrame {
            }
            BasicGraph basicGraphClass = new BasicGraph();
            for (String phrase : phrases) {
                double conf = dbInterface.checkTokenInDatabase(phrase, basicGraphClass.getGraph())*0.8;   
                conf += manager.nGram(phrase, 3)*0.2;
                double conf = dbInterface.checkTokenInDatabase(StringProcessor.handleApostrophe(phrase), basicGraphClass.getGraph())*0.8;   
                conf += manager.nGram(StringProcessor.handleApostrophe(phrase), 3)*0.2;
                //System.out.println(phrase + "| "+ conf);
                highlightPhrase(phrase, (int)conf);
            }
+1 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ public class HashTableMaker {
    }

    public int nGram(String sentence, int n){
        sentence = sentence.replaceAll("[,.]", "");
        String[] words = sentence.split("\\s+");
        if(words.length<n)
            return -1;