Commit 5fe784a4 authored by Seyed Reza  Sajjadinasab's avatar Seyed Reza Sajjadinasab
Browse files

updateArgument

parent 7ea368c0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ public class BasicGraph {
        graph.addEdge(State.ARTICLE,   State.ADJECTIVE);
        graph.addEdge(State.ADJECTIVE, State.DOT);
        graph.addEdge(State.ADJECTIVE, State.NOUN);
        graph.addEdge(State.ADJECTIVE, State.COMMA);
        graph.addEdge(State.NOUN,      State.DOT);
        graph.addEdge(State.NOUN,      State.COMMA);
        graph.addEdge(State.DOT,       State.END);
+8 −10
Original line number Diff line number Diff line
@@ -4,19 +4,16 @@ import DirectedGraph.BasicGraph;
import DirectedGraph.DirectedGraph;
import StateMachine.*;
import DBinterface.DBinterface;
import util.*;

public class Main {
     public static void main(String[] args) {
        //DirectedGraph<State> graph = new DirectedGraph<>();
        
        String sentence;
        if(args.length > 0){
            sentence = args[0];
        }else{
            sentence = "it a very good book, but it is small book.";
            System.out.println("Please enter a sentence. Program used the default sentence:\n" + sentence + "\n--------------------------------------------");
        }
        ArgumentParser argPars = ArgumentParser.of(args);;
        
        if(argPars.isCheckSentence()){
            BasicGraph basicGraphClass = new BasicGraph();
            DirectedGraph<State> graph = basicGraphClass.getGraph();

@@ -26,7 +23,8 @@ public class Main {
        // Tokenize the sentence
            DBinterface dbInterface = new DBinterface();

        dbInterface.checkTokenInDatabase(sentence, graph);
            dbInterface.checkTokenInDatabase(argPars.getSentence(), graph);
        }
          
    }
}
(12 KiB)

File changed.

No diff preview for this file type.

+5 −0
Original line number Diff line number Diff line
@@ -6,13 +6,18 @@ import DirectedGraph.DirectedGraph;
public class StateMachine{
    public int isStateMachineFollowed(DirectedGraph<State> graph, List<State> actions, State initialState, int initialConf) {
        int confidence = initialConf;
        //System.out.println("----------------------------------------------------");
        State currentState = initialState;
        for (State action : actions) {
            //System.out.print(currentState);
            List<State> transitions = graph.getAdjacentNodes(currentState);
            if (!transitions.contains(action)) {
                //System.out.print("? " + action);
                currentState = State.START;
                confidence += 10; // Action not allowed in current state
                
            }
            //System.out.println();
            currentState = action; // Transition to the next state
        }
        return confidence;
+1.27 KiB (13.5 MiB)

File changed.

No diff preview for this file type.

Loading