Examples of JasenScanResult


Examples of org.jasen.interfaces.JasenScanResult

                        File[] files = folder.listFiles();
                        File file = null;

                        FileInputStream fin = null;
                        MimeMessage mm = null;
                        JasenScanResult result = null;

                        NumberFormat formatter = new DecimalFormat("0.000");

                        for (int i = 0; i < files.length; i++)
                        {
                            file = files[i];

                            if(file.isFile()) {
                                fin = new FileInputStream(file);
                                mm = new MimeMessage(null, fin);
                                fin.close();

                                System.out.println ("Scanning\t:\t" + file.getName());
                                result = JasenScanner.getInstance().scan(mm);

                                if(result.completed()) {
                                    if(result.getProbability() >= command.high) {

                                        if(command.lspam) {
                                            System.out.print ("Result\t\t:\t");
                                            System.out.println(formatter.format(result.getProbability()));
                                            System.out.print ("Judgement\t:\t");
                                            System.out.println ("Most likely SPAM");
                                            System.out.println ("--------------------------------------------------------");
                                            System.out.println ("");
                                           
                                            if(command.drop != null) {
                                                drop(command.drop, file);
                                            }
                                        }

                                        spam++;
                                    }
                                    else if (result.getProbability() <= command.low) {

                                        if(command.lham) {
                                            System.out.print ("Result\t\t:\t");
                                            System.out.println(formatter.format(result.getProbability()));
                                            System.out.print ("Judgement\t:\t");
                                            System.out.println ("Most likely HAM");
                                            System.out.println ("--------------------------------------------------------");
                                            System.out.println ("");
                                           
                                            if(command.drop != null) {
                                                drop(command.drop, file);
                                            }
                                        }

                                        ham++;
                                    }
                                    else {

                                        if(command.lborder) {
                                            System.out.print ("Result\t\t:\t");
                                            System.out.println(formatter.format(result.getProbability()));
                                            System.out.print ("Judgement\t:\t");
                                            System.out.println ("Can't be sure.  Borderline case");
                                            System.out.println ("--------------------------------------------------------");
                                            System.out.println ("");
                                           
                                            if(command.drop != null) {
                                                drop(command.drop, file);
                                            }
                                        }

                                        borderline++;
                                    }
                                }
                                else
                                {
                                    System.out.print ("Result\t\t:\t");
                                    System.out.println (result.getTestResults()[0][0]);
                                    error++;
                                }
                            }
                        }
View Full Code Here

Examples of org.jasen.interfaces.JasenScanResult

                System.out.println ("Scanning file..." + args[0]);
                System.out.println ("");
                System.out.println ("Test Results");
                System.out.println ("----------------------------------");
                JasenScanResult result = JasenScanner.getInstance().scan(mm);

                NumberFormat formatter = new DecimalFormat("0.000");

                System.out.println ("Prob\t: Time\t\t: Scanner");
                System.out.println ("----------------------------------");

                if(result.getTestResults() != null) {
                    for (int i = 0; i < result.getTestResults().length; i++)
                    {
                        System.out.print (formatter.format(Double.parseDouble(result.getTestResults()[i][Jasen.RESULT_INDEX_PROBABILITY])));
                        System.out.print ("\t: ");
                        System.out.print (formatter.format(Double.parseDouble(result.getTestResults()[i][Jasen.RESULT_INDEX_TIME])));
                        System.out.print (" (ms)\t: ");
                        System.out.print (result.getTestResults()[i][Jasen.RESULT_INDEX_DISPLAY]);
                        System.out.print (" (");
                        System.out.print (result.getTestResults()[i][Jasen.RESULT_INDEX_NAME]);    
                        System.out.println (")");
                    }
                }
                System.out.println ("");
                System.out.println ("Overall (normalized) Result");
                System.out.println ("----------------------------------");
                System.out.println (result.getProbability());
                System.out.println ("");
                System.out.println ("Judgement:");
                System.out.println ("");

                if(result.getProbability() >= 0.9) {
                    System.out.println ("Most likely SPAM");
                }
                else if (result.getProbability() <= 0.1) {
                    System.out.println ("Most likely HAM");
                }
                else {
                    System.out.println ("Can't be sure.  Borderline case");
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.