Package nl2sql.questionWords

Examples of nl2sql.questionWords.questionType


    }
    ArrayList<String> ColLeft = new ArrayList<String>();
    ArrayList<String> ColRight = new ArrayList<String>();
   
    public QuestionWordAction(String _question, LinguisticComponent _chunk, ArrayList<String> NewLeft, ArrayList<String> NewRight){
        questionType qT = new questionType(_question, _chunk);
        int qType = qT.identifyType();
       
        Database db;
        try {
            db = new Database("đại học công nghệ");
            for (int i = 0; i < NewRight.size(); i++) {
                if (db.attribute.contains(NewRight.get(i))) {
                    ColLeft.add(NewLeft.get(i));
                    ColRight.add(NewRight.get(i));
                }
            }
        } catch (Exception ex) {
            System.err.println(ex.getMessage());
        }
       
       
        String qTarget = qT.identifyTarget(qType, ColLeft);
       
        int pos = ColLeft.indexOf(qTarget);
        String qTargetC;
        if(pos!= -1){
            qTargetC = ColRight.get(pos);
        } else{
            qTargetC = qTarget;
        }
       
        if(qTargetC.equals("*")){
            SELECT += " * ";
        }else
        if(qType == qT.getENTITY()){
            if(qTargetC.isEmpty()){
                qTargetC = "*";
            }
            System.out.println("QuestionType : ENTITY");
            SELECT += " `" + qTargetC+ "`";
        } else
        if(qType == qT.getNUMBER() ){
            if(qTargetC.isEmpty()){
                qTargetC = "stt";
            }
            SELECT += " COUNT(`" + qTargetC+ "`)";
            System.out.println("QuestionType : NUMBER");
        } else
        if(qType == qT.getRATIO() ){
            if(qTargetC.isEmpty()){
                qTargetC = "stt";
            }
            SELECT += " (COUNT(`" + qTargetC+ "`)/594 * 100)";
            System.out.println("QuestionType : RATIO");
View Full Code Here

TOP

Related Classes of nl2sql.questionWords.questionType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.