ngram class in servlet code
I am using ngram to devide text into each two words in an array
the problem is the notice shown in code that tells cannot find symbol ngram
the code is
    

          package web;
           import java.lang.Object;
             import java.io.IOException;
            import java.io.PrintWriter;
             import java.sql.Connection;
             import java.sql.ResultSet;
                import java.sql.SQLException;
           import java.sql.Statement;
        import java.util.Scanner;
        import java.util.logging.Level;
          import java.util.logging.Logger;
           import javax.naming.Context;
           import javax.naming.InitialContext;
           import javax.naming.NamingException;
            import javax.servlet.RequestDispatcher;
                import javax.servlet.ServletException;
            import javax.servlet.http.HttpServlet;
              import javax.servlet.http.HttpServletRequest;
             import javax.servlet.http.HttpServletResponse;
             import javax.sql.DataSource;

                public class Freq1 extends HttpServlet {
               private DataSource dataSource;
              private Connection connection;
               private Statement stat;
               int result;
            int count,id;
    

               @Override
                 public void init() throws ServletException {
              try {
            // Get DataSource
            
            Context initContext  = new InitialContext();
            Context envContext  = (Context)initContext.lookup("java:/comp/env");
            dataSource = (DataSource) envContext.lookup("jdbc/TestDB");
  
        } catch (NamingException e) {
        }
    }

    
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String  s=null ;
         StringBuffer buffer=new StringBuffer();
        try {
            connection = dataSource.getConnection();
             stat = connection.createStatement();
      
        } catch (SQLException ex) {
            Logger.getLogger(Freq1.class.getName()).log(Level.SEVERE, null, ex);
        }
           
 
        try {
             String [] a = null; 
        count=0;
    String word=    new String(request.getParameter("t").getBytes("iso-8859-1"), "UTF-8"); 

    ResultSet   rs = stat.executeQuery("SELECT * FROM file_control ");
            
            while(rs.next()){
                id=rs.getInt(1);
           s= rs.getString(8);
           Scanner input =new Scanner(s);
            while(input.hasNext()){
            String text=input.nextLine();
            NGram ngram=new NGram(text,2);
          
          for(int i=0;i<a.length;++i){
            if(a[i].equals(word)){
                count++;
            }
          } 
        }
           
            }
            
       
       
       
        
            
        } catch (SQLException ex) {
            Logger.getLogger(Freq1.class.getName()).log(Level.SEVERE, null, ex);
        }
        
       // String word=request.getParameter("word");
       
      String  result1=Integer.toString(result);
      String  count1=Integer.toString(count);
        request.setAttribute("result1", count1);
        RequestDispatcher view = request.getRequestDispatcher("result.jsp");
        view.forward(request, response); 
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
     }
  I define the NGram but it is not defined in my code then how can I make the NGram class defined?  
ngram class in servlet code
===

I am using ngram to devide text into each two words in an array
the problem is the notice shown in code that tells cannot find symbol ngram
the code is
    

          package web;
           import java.lang.Object;
             import java.io.IOException;
            import java.io.PrintWriter;
             import java.sql.Connection;
             import java.sql.ResultSet;
                import java.sql.SQLException;
           import java.sql.Statement;
        import java.util.Scanner;
        import java.util.logging.Level;
          import java.util.logging.Logger;
           import javax.naming.Context;
           import javax.naming.InitialContext;
           import javax.naming.NamingException;
            import javax.servlet.RequestDispatcher;
                import javax.servlet.ServletException;
            import javax.servlet.http.HttpServlet;
              import javax.servlet.http.HttpServletRequest;
             import javax.servlet.http.HttpServletResponse;
             import javax.sql.DataSource;

                public class Freq1 extends HttpServlet {
               private DataSource dataSource;
              private Connection connection;
               private Statement stat;
               int result;
            int count,id;
    

               @Override
                 public void init() throws ServletException {
              try {
            // Get DataSource
            
            Context initContext  = new InitialContext();
            Context envContext  = (Context)initContext.lookup("java:/comp/env");
            dataSource = (DataSource) envContext.lookup("jdbc/TestDB");
  
        } catch (NamingException e) {
        }
    }

    
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String  s=null ;
         StringBuffer buffer=new StringBuffer();
        try {
            connection = dataSource.getConnection();
             stat = connection.createStatement();
      
        } catch (SQLException ex) {
            Logger.getLogger(Freq1.class.getName()).log(Level.SEVERE, null, ex);
        }
           
 
        try {
             String [] a = null; 
        count=0;
    String word=    new String(request.getParameter("t").getBytes("iso-8859-1"), "UTF-8"); 

    ResultSet   rs = stat.executeQuery("SELECT * FROM file_control ");
            
            while(rs.next()){
                id=rs.getInt(1);
           s= rs.getString(8);
           Scanner input =new Scanner(s);
            while(input.hasNext()){
            String text=input.nextLine();
            NGram ngram=new NGram(text,2);
          
          for(int i=0;i<a.length;++i){
            if(a[i].equals(word)){
                count++;
            }
          } 
        }
           
            }
            
       
       
       
        
            
        } catch (SQLException ex) {
            Logger.getLogger(Freq1.class.getName()).log(Level.SEVERE, null, ex);
        }
        
       // String word=request.getParameter("word");
       
      String  result1=Integer.toString(result);
      String  count1=Integer.toString(count);
        request.setAttribute("result1", count1);
        RequestDispatcher view = request.getRequestDispatcher("result.jsp");
        view.forward(request, response); 
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
     }
  I define the NGram but it is not defined in my code then how can I make the NGram class defined?  