Get Some Free Products at your Door Step. Just feed ur Address in dis Link...!!

Tuesday, September 8, 2015

Networking information Shell script (Linux)

input=$1

if [ $input = "ip" ]
    then
        ifconfig|grep -w inet

elif [ $input = "ip6" ]
    then
        ifconfig|grep inet6

elif [ $input = "mac" ]
    then
        ifconfig|grep HWaddr
elif [ $input = "broadcast" ]
    then
        ifconfig|grep broadcast
elif [ $input = "mask" ]
    then
        ifconfig|grep mask

elif [ $input = "data" ]
    then
        ifconfig|grep bytes

elif [ $input = "help" ]
    then
    echo "ip"
    echo "ip6"
    echo "mac"
    echo "broadcast"
    echo "mask"
    echo "data"
    echo "help"
else
        echo "others"
fi

Monday, August 3, 2015

Project start shell script

input=$1

if [ $input = "stop" ]
    then
        sh /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/bin/shutdown.sh
        #echo pbharti|sudo -S service apache2 stop


elif [ $input = "restart" ]
    then
        sh /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/bin/shutdown.sh
        sh /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/bin/catalina.sh jpda start

        #sudo service apache2 restart

       
elif [ $input = "deploy" ]
    then
        sh /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/bin/shutdown.sh

        echo "--Apache shudown"
        #rm -r /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/webapps/cityguide

        #rm -r /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/webapps/cityguideSchedular


        rm -r /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/webapps/MultilingualServiceImpl.war
        rm -r /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/webapps/MultilingualServiceImpl

        sleep 3s
        echo "--WebApp removed from tomcat"

        cp -r /home/lovebharti/Yatra/Multilingual/MultilingualServiceImpl/trunk/target/MultilingualServiceImpl.war /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/webapps/MultilingualServiceImpl.war

        sleep 3s
        echo "--WebApp copied from target"

        sh /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/bin/catalina.sh jpda start
        echo "restarting apache... "
        sleep 1s

        #terminal -e sh showLog.sh

        echo "starting tomcat in debug mode"

        sleep 1s

        #tail -f /home/lovebharti/Yatra/installed/apache-tomcat-7.0.61/logs/catalina.out
        echo "cleaning logs"   

        > /home/lovebharti/YT/var/log/Multilingual/Multilingual.log
       
        echo "showing log"       
        tail -f /home/lovebharti/YT/var/log/Multilingual/Multilingual.log
        echo "showing tomcat output"
       
else
        echo "others"
fi


#sh multilingual.sh start/stop/restart

Friday, June 7, 2013

Misc.java

package advance;

import com.sun.speech.freetts.Voice;
import com.sun.speech.freetts.VoiceManager;
import java.sql.*;
import java.io.*;

/**
 *
 * @author LoveBharti
 */
public class Misc
{
    public static void convertTextToSound(String texttoConvert)
    {
        String voiceName = "kevin16";
        VoiceManager voiceManager = VoiceManager.getInstance();
        Voice helloVoice = voiceManager.getVoice(voiceName);
        if (helloVoice == null)
        {
            System.err.println("Cannot find a voice named "+ voiceName + ".  Please specify a different voice.");
            return;
        }
        helloVoice.allocate();
        helloVoice.speak(texttoConvert);
        helloVoice.deallocate();
        return;
    }
    public static void appOpener(String fileName)
    {
        try
        {
            Process p = Runtime.getRuntime().exec("Xpad/"+fileName+".exe");
        } catch (Exception e) {e.printStackTrace();}
    }
    public static Connection connect(Connection con) throws ClassNotFoundException, SQLException
    {
        Class.forName("com.mysql.jdbc.Driver");
            con=DriverManager.getConnection("jdbc:mysql://localhost:3306/wordlist","root","");
            return con;
    }
    public static void mergeTable(String db,String table1,String table2) throws ClassNotFoundException, SQLException
    {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/"+db,"root","");
        Statement st=con.createStatement();
        String sqlc="INSERT into "+table1+" (Select * from "+table2+")";
        st.executeUpdate(sqlc);
    }
    public static void fileToDBFeeder() throws ClassNotFoundException, SQLException, FileNotFoundException, IOException
    {
            Connection con=Misc.connect(null);
        Statement st=con.createStatement();
        String tableName="name";

        FileInputStream fis=new FileInputStream("file.txt");         //string -> BufferedReader -> InputStreamReader -> DataInputStream -> FileInputStream
        DataInputStream dis = new DataInputStream(fis);
        InputStreamReader isr = new InputStreamReader(dis);
        BufferedReader br = new BufferedReader(isr);
        String text;
        while((text=br.readLine())!=null)     //fulltext=fulltext+text;
        {
            if(!text.contains("'"))
            {
            String sqlc="insert into "+tableName+" values('"+text.toLowerCase()+"','job title')";
            st.executeUpdate(sqlc);
            }
            System.out.println(text);
        }
        dis.close();
        //return fulltext;
    }

}

Mail.java

package advance;

import java.util.*;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.SendFailedException;
import javax.mail.internet.MimeMessage;

public class Mail
{
        public synchronized static String sendMail(String userName,String passWord,String host,String port,String starttls,String auth,boolean debug,String socketFactoryClass,String fallback,String to,String subject,String text)
        {
                Properties props = new Properties();
                props.put("mail.smtp.user", userName);
                props.put("mail.smtp.host", host);
                if(!"".equals(port))
                    props.put("mail.smtp.port", port);
                if(!"".equals(starttls))
                    props.put("mail.smtp.starttls.enable",starttls);
                props.put("mail.smtp.auth", auth);
                if(debug)
                        props.put("mail.smtp.debug", "true");
                else
                        props.put("mail.smtp.debug", "false");
                if(!"".equals(port))
                        props.put("mail.smtp.socketFactory.port", port);
                if(!"".equals(socketFactoryClass))
                        props.put("mail.smtp.socketFactory.class",socketFactoryClass);
                if(!"".equals(fallback))
                        props.put("mail.smtp.socketFactory.fallback", fallback);
        try
        {
            Session session = Session.getDefaultInstance(props, null);
            session.setDebug(debug);
            MimeMessage msg = new MimeMessage(session);
            msg.setText(text);
            msg.setSubject(subject);
            msg.setFrom(new InternetAddress("prembhaarti@gmail.com"));
                        msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
                        msg.saveChanges();
                        Transport transport = session.getTransport("smtp");
                        transport.connect(host, userName, passWord);

                        transport.sendMessage(msg, msg.getAllRecipients());
                        transport.close();
                        return "Mail Sent";
        }
        catch (javax.mail.SendFailedException sf)
        {
            return "sent Failed";
            }
                catch(Exception ae)
        {
            return "error";
        }
     }
}

GrammerFinder.java

package advance;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import javax.swing.JOptionPane;
public class GrammerFinder
{
    public static void main(String ar[]) throws ClassNotFoundException, SQLException
    {
        ArrayList al = new ArrayList();

        String s="hello";
        //s.









        //String sent=StringExtractor.stringExtractor("anlyse sentence \"what are you doing \"", "\"", '\"');
        //System.out.println(sent);
    }
    /**
<pre>
Input :
String sentence=>
<b>I am going        to   school</b>
Output:<b>
p,hv,iv|n|adv|adj,prep,pfv|n|adv|adj
</b></pre>
     */
    public static String getPosCombinationSyntax(String sentence) throws ClassNotFoundException, SQLException
    {
        String expression="";
        String cword="";
        int count;
        Object ob[]=StringExtractor.seperater(sentence);

        for(int i=0;i<ob.length;i++)
        {
            count=0;
            cword=((String)ob[i]).toLowerCase();
            //System.out.println(cword);
            if(cword.equals("did")||cword.equals("didn't")||cword.equals("do")||cword.equals("doesn't")||
               cword.equals("could")||cword.equals("couldn't")||cword.equals("can")||cword.equals("can't")||
               cword.equals("shall")||cword.equals("shan't")||cword.equals("will")||cword.equals("won't")||
               cword.equals("has")||cword.equals("hasn't")||cword.equals("have")||cword.equals("had")||
               cword.equals("hadn't")||cword.equals("haven't")||cword.equals("what")||cword.equals("where")||
               cword.equals("why")||cword.equals("who")||cword.equals("how")||cword.equals("when")||cword.equals("should")||
               cword.equals("shouldn't")||cword.equals("does")||cword.equals("i")||cword.equals("not")||cword.equals("been")||
               cword.equals("be")||cword.equals("was")||cword.equals("wasn't")||cword.equals("were")||cword.equals("weren't"))
            {
                expression += cword+",";
                count++;
                //continue;
            }
            if(MeaningFinder.pronounChecker(cword))
            {
                        if(count>0){expression=expression.substring(0, expression.length()-1);expression+="|";}
                        if(MeaningFinder.singularPronounChecker(cword)) expression+="PS,";
                        else expression+="PP,";
                count++;
            }
                       
            if(MeaningFinder.verbChecker(cword))
            {          
                        if(count>0){expression=expression.substring(0, expression.length()-1);expression+="|";}
                if(MeaningFinder.verbFirstFormChecker(cword))
                {
                    if(MeaningFinder.verbSingularChecker(cword)){expression+="VFFS,";}
                    else expression+="VFFP,";
                }
                else if(MeaningFinder.verbSecondFormChecker(cword))
                {
                    if(MeaningFinder.verbSecondFormChecker(cword)&& MeaningFinder.verbThirdFormChecker(cword)) expression+="VSF|VTF,";
                    else expression += "VSF,";
                }
                else if(MeaningFinder.verbThirdFormChecker(cword))expression+="VTF,";
                else if(MeaningFinder.verbIngChecker(cword))expression+="VING,";

                count++;
            }
            if(MeaningFinder.articleChecker(cword))
            {
                        if(count>0){expression=expression.substring(0, expression.length()-1);expression+="|";}
                expression+="ART,";
                count++;
            }
            if(MeaningFinder.prepositionChecker(cword))
            {
                        if(count>0){expression=expression.substring(0, expression.length()-1);expression+="|";}
                expression+="PREP,";
                count++;
            }
            if(MeaningFinder.nounChecker(cword))
            {
                        if(count>0){expression=expression.substring(0, expression.length()-1);expression+="|";}
                expression+="N,";
                count++;
            }
            if(MeaningFinder.adjectiveChecker(cword))
            {
                        if(count>0){expression=expression.substring(0, expression.length()-1);expression+="|";}
                expression+="ADV,";
                count++;
            }
            if(MeaningFinder.adjectiveChecker(cword))
            {
                        if(count>0){expression=expression.substring(0, expression.length()-1);expression+="|";}
                expression+="ADJ,";
                count++;
            }
            if(MeaningFinder.helpingVerbChecker(cword))
            {
                if(count>0){expression=expression.substring(0, expression.length()-1);expression+="|";}
                expression+=cword+",";
                count++;
            }
            if(count==0) expression+="*,";
        }
        expression=expression.substring(0, expression.length()-1);
        if(expression.contains("isn\'t")) expression=expression.replace("isn\'t", "isnt");
        if(expression.contains("amn\'t")) expression=expression.replace("am\'t", "amnt");
        if(expression.contains("hasn\'t")) expression=expression.replace("hasn\'t", "hasnt");
        if(expression.contains("haven\'t")) expression=expression.replace("haven\'t", "havent");
        if(expression.contains("hadn\'t")) expression=expression.replace("hadn\'t", "hadnt");
        if(expression.contains("don\'t")) expression=expression.replace("don\'t", "dont");
        if(expression.contains("doesn't")) expression=expression.replace("doesn't", "doesnt");
        if(expression.contains("didn\'t")) expression=expression.replace("didn\'t", "didnt");
        if(expression.contains("shouldn\'t")) expression=expression.replace("shouldn\'t", "shouldnt");
        if(expression.contains("couldn\'t")) expression=expression.replace("couldn\'t", "couldnt");
        if(expression.contains("can\'t")) expression=expression.replace("can\'t", "cant");
        if(expression.contains("wasn\'t")) expression=expression.replace("wasn\'t", "wasnt");
        if(expression.contains("weren\'t")) expression=expression.replace("weren\'t", "nwerent");
        if(expression.contains("won\'t")) expression=expression.replace("won\'t", "wont");
        if(expression.contains("shan\'t")) expression=expression.replace("shan\'t", "shant");
        return expression;
    }
//--------------------------------grammerCombination---------------------------
    /**
    <pre>
    Note: Needs wordlist database to be active
    INPUT:
    String sentence="<b>What are you doing</b>"
    #Here Grammer for this sentence => {p,hv,p,iv|n}
    OUTPUT:<b>
    p,hv,p,iv
    p,hv,p,n
    </b>#Which is cartesian Product of above grammer
    </pre>
     */
    public static Object[] getPosCombination(String sentence) throws ClassNotFoundException, SQLException
    {
        return StringExtractor.uniqueFilter(StringExtractor.cartesianProduct(StringExtractor.seperaterPattern(GrammerFinder.getPosCombinationSyntax(sentence), ','),'|'));
    }
//-------------------------------------combinationFromCFG---------------------------
/**
<pre>
INPUT:<b>
S  -> B,V|HV,B,not,V
V  -> fsv|psv
B  -> p|n
HV -> do|does
</b>
OUTPUT:<b>
p,fsv
n,fsv
p,psv
n,psv
do,p,not,fsv
does,p,not,fsv
do,n,not,fsv
does,n,not,fsv
do,p,not,psv
does,p,not,psv
do,n,not,psv
does,n,not,psv
</b></pre>
 */

    public static Object[] combinationFromCFG(String source)
    {
        Object production[]=StringExtractor.seperaterPattern(source.replace("->",":"), '\n');
            HashMap repTable=new HashMap();
            Object parts[]=null,elements[]=null;
            String language="";
            for(int i=0;i<production.length;i++)
            {
                parts=StringExtractor.seperaterPattern((String)production[i], ':');
                repTable.put(((String)parts[0]).trim(),((String)parts[1]).trim());
            }
            Object languages[]=StringExtractor.seperaterPattern((String) repTable.get("S"), '|');
            for(int j=0;j<languages.length;j++)
            {
                language=(String)languages[j];
                elements=StringExtractor.seperaterPattern(language,',');
                for(int k=0;k<elements.length;k++)
                {
                    if(repTable.containsKey((String)elements[k]))
                    {
                        elements[k]=(String)repTable.get((String)elements[k]);
                    }
                }
                language="";
                for(int k=0;k<elements.length;k++)
                {
                   language+=(String)elements[k]+",";
                }
                languages[j]=language.substring(0, language.length()-1);
            }
            Object[] ob=null;
            ArrayList al=new ArrayList();
            for(int j=0;j<languages.length;j++)
            {
                ob=StringExtractor.cartesianProduct((StringExtractor.seperaterPattern((String) languages[j], ',')),'|');
                for(int i=0;i<ob.length;i++)
                    al.add((String)ob[i]);
            }
            return al.toArray();
    }
//---------------------------------------------------------------------------------------------------
    /**
     *
     * @param filename
     * @return
     * @throws FileNotFoundException
     * @throws IOException
     * @throws ClassNotFoundException
     */
    public static String feedCFGCombination(String filename,String type) throws FileNotFoundException, IOException, ClassNotFoundException
    {
            Object ob[]=GrammerFinder.combinationFromCFG(Creater.ReadFile(filename));
            for(int i=0;i<ob.length;i++)
            {
                try
                {
                String seq=(String)ob[i];
                Connection con=Misc.connect(null);
                Statement st=con.createStatement();
                String sql="insert into grammer values('"+seq+"','"+type+"')";
                st.executeUpdate(sql);              
                }catch(SQLException s){}
            }
            return "done";
    }
//---------------------------------------------------------------------------------------------------------
    /**
     *
     * @param filename
     * @param type
     * @return
     * @throws FileNotFoundException
     * @throws IOException
     * @throws ClassNotFoundException
     */
    public static String refreshAndFeedCFGCombination(String filename,String type) throws FileNotFoundException, IOException, ClassNotFoundException, SQLException
    {
            Object ob[]=GrammerFinder.combinationFromCFG(Creater.ReadFile("PresentPerfectContinuous.txt"));
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sql="delete from grammer where type='"+type+"'";
            st.executeUpdate(type);
            for(int i=0;i<ob.length;i++)
            {
                try
                {
                String seq=(String)ob[i];
                st.executeUpdate(sql);
                sql="insert into grammer value('"+seq+"','present perfect continuous')";
                st.executeUpdate(sql);
                }catch(SQLException s){}
            }
            return "done";
    }
/**
<pre>
Tags Correct Parts of Speech for each word
INPUT: String
<b>what will you do</b>
OUTPUT: Object[]  (array of set of correct parts of speech set possible
<b>what,will,PP,VFFP</b>
</pre>
 */
    public static Object[] getCorrectPos(String sentence) throws ClassNotFoundException, SQLException
    {
            Connection con=Misc.connect(null);
            Statement st2=con.createStatement();
            Statement st=con.createStatement();
            ArrayList seqList=new ArrayList();
            Object ob[]=GrammerFinder.getPosCombination(sentence);
            String sql="";
            for(int i=0;i<ob.length;i++)
            {
                sql="select sequence from grammer where sequence ='"+((String)ob[i])+"'";
                //System.out.println(ob[i]) ;
                ResultSet rs=st.executeQuery(sql);
                String seq="",type="";
                while(rs.next())
                {
                    seq=rs.getString("sequence");
                    //type=rs.getString("type");
                    seqList.add(seq);                  
                }
            }
            return seqList.toArray();
    }
/**
 <pre>
 INPUT: String (Sentence)
 <b> what will you do </b>
 OUTPUT: Object[] (set of tense related to tense)
 <b> future indefinite </b>
 ---It actually gets answer for you if
    matches list of syntax in your database---
 </pre>
 */
    public static Object[] getTense(String sentence) throws ClassNotFoundException, SQLException
    {
            Connection con=Misc.connect(null);  
            Statement st=con.createStatement();
            ArrayList seqList=new ArrayList();
            Object ob[]=GrammerFinder.getPosCombination(sentence);          
            String sql="";
            for(int i=0;i<ob.length;i++)
            {
                sql="select * from grammer where sequence ='"+((String)ob[i])+"'";
                //System.out.println(ob[i]) ;
                ResultSet rs=st.executeQuery(sql);
                String seq="",type="";
                while(rs.next())
                {
                    seq=rs.getString("sequence");
                    type=rs.getString("type");
                    seqList.add(type);
                    //System.out.println(seq+" => "+type);
                }
            }
            return StringExtractor.uniqueFilter(seqList.toArray());
    }
    /**
<pre>
INPUT:String (Sentence)
<b> what will you do </b>
OUTPUT:Object[] (sets of sequential combination from length 2 to total no. of words)
<b>what,will,you,do
will,you,do
what,will,you
you,do
will,you
what,will </b>
</pre>
     */
    public static Object[] getSentenceSubPhrases(String s)
    {
        String st="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        HashMap h=new HashMap();
        Object words[]=StringExtractor.seperater(s);
        for(int i=0;i<words.length;i++)
            h.put(st.charAt(i),(String)words[i]);
        Object ob[]=GrammerFinder.getSymbolSubPhrases(words.length);
        ArrayList phrases=new ArrayList();
        for(int i=0;i<ob.length;i++)
        {
            String symbolPhrase=(String)ob[i];
            String realPhrase="";

            for(int j=0;j<symbolPhrase.length();j++)
            {
                realPhrase+=(String)h.get(symbolPhrase.charAt(j))+",";
            }
            phrases.add(realPhrase.substring(0, realPhrase.length()-1));
        }
        Collections.reverse(phrases);
        return phrases.toArray();
    }
/**
<pre>
INPUT: int l (no. of characters for sequencial combination)
<b>4</b>
OUTPUT: Object[] (sets of sequences of symbol from len 2 to l)
<b>ab
bc
cd
abc
bcd
abcd</b>
</pre>
 */
    public static Object[] getSymbolSubPhrases(int l)
    {
        String s="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
        String st=s.substring(0, l),temp="";
        int len=st.length();
        ArrayList phrases=new ArrayList();
        for(int k=2;(k<=len)&& (k>=2);k++)
            for(int i=0,j=0;i<=len-k;i++)
            {
                j=i+k;
                temp=st.substring(i, j);
                phrases.add(temp);
            }
        return phrases.toArray();
    }
/**
 <pre>
 INPUT: String (Sentence)
 <b> what will you do with your twisted bone </b>
 OUTPUT: Object[] (set of tense related to sentence)
 <b> future indefinite </b>
 ---This function, we call when we don't get help directly from
 sets of sequences in database. So, We break this problem into sets
 of smaller sets sequential combination and again check the tense and
 return possible tenses.---
 </pre>
*/
    public static Object[] getPossibleTense(String sentence) throws ClassNotFoundException, SQLException
    {
        sentence=sentence.toLowerCase();
        Object subPhrases[]=GrammerFinder.getSentenceSubPhrases(sentence);
        ArrayList tense=new ArrayList();
        String current="";
        for(int i=0;i<subPhrases.length;i++)
        {
            Object tempTense[]=GrammerFinder.getTense((String)subPhrases[i]);
            for(int j=0;j<tempTense.length;j++)
                tense.add((String)tempTense[j]);
            if(tempTense.length>0)break;
        }
        return StringExtractor.uniqueFilter(tense.toArray());
    }
}

MeaningFinder.java

import java.sql.*;
import java.util.ArrayList;
import java.util.Collection;
import javax.swing.JEditorPane;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;

public class MeaningFinder
{
    public static void main(String ar[]) throws ClassNotFoundException, SQLException
    {
        System.out.println(MeaningFinder.spinner("What are you doing", 1));
        /*
        String word="do";
        ArrayList<Integer> al=new ArrayList();
        int index=0,index2;
        String source=WebPageAnalyser.fetchSource("oxforddictionaries.com/definition/"+word+"?q="+word);
        String subSource=source;
        //System.out.println(source);
        ArrayList def=new ArrayList();
        index=source.indexOf("<h3 class=\"partOfSpeech\"> <span class=\"partOfSpeech\">");
        System.out.println(index);
       
        if(index!=-1)
        {
            int i=index;
            while(i<source.length())
            {
                if(index!=-1)
                {
                    i=index;
                    System.out.println(i);
                    i++;
                    index2=source.indexOf("<h3 class=\"partOfSpeech\"> <span class=\"partOfSpeech\">",i);
                    if(index2<0) index2=source.length()-1;
                    subSource=source.substring(index,index2);
                    def.add("#"+StringExtractor.stringExtractor(subSource,"<h3 class=\"partOfSpeech\"> <span class=\"partOfSpeech\">" , '<'));
                //                StringExtractor.arrayListConvert(StringExtractor.stringArrayExtractor(WebPageAnalyser.fetchSource("oxforddictionaries.com/definition/"+word+"?q="+word),"<span class=\"definition\">",'<'));
                    def.addAll(StringExtractor.arrayListConvert(StringExtractor.stringArrayExtractor(subSource,"<span class=\"definition\">",'<')));

                    al.add(index);
                    index=index2;
                    if(index2==source.length()-1)break;
                }
                else break;
            }
        }
        ArrayList def2=new ArrayList();
        for(int i=0;i<def.size();i++)
        {
            String line=def.get(i).toString();
            if(line!="")
            {
                int j=0;
                for(;line.charAt(j)==' ';j++){}
                line=line.substring(j,line.length()-1);
                System.out.println(line);
                def2.add(line);
            }
        }

*/
//        String source=WebPageAnalyser.fetchSource("oxforddictionaries.com/definition/"+word+"?q="+word);
        //String sub1=source.indexOf(word)
    }
/**
<pre>
INPUT:String (word)
<b>well</b>
OUTPUT:Boolean
<b>true</b>

INPUT:String (word)
<b>eat</b>
OUTPUT:Boolean
<b>false</b>

</pre>
 */
    public static boolean adjectiveChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="Select adjectives from adjectives where adjectives='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
    /**
<pre>
INPUT:String (word)
<b>well</b>
OUTPUT:Boolean
<b>true</b>

INPUT:String (word)
<b>eat</b>
OUTPUT:Boolean
<b>false</b>
</pre>
 */
    public static boolean adverbChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {          
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="Select adverbs from adverbs where adverbs='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
/**
<pre>
INPUT:String (word)
<b>an</b>
OUTPUT:Boolean
<b>true</b>

INPUT:String (word)
<b>the</b>
OUTPUT:Boolean
<b>false</b>
#Checks only a,an,the article
 </pre>
 */

    public static boolean articleChecker(String word)
    {
        if(word.equals("a")||word.equals("an")||word.equals("the"))return true;
        else return false;
    }
/**
<pre>
INPUT:String (sentence/source string)
<b>He plays well</b>
OUTPUT:Boolean
<b>true</b>

INPUT:String (sentence/Source string)
<b>He is a watchman</b>
OUTPUT:Boolean
<b>false</b>
 </pre>
 */
    public static boolean containsVerb(String source)
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Object ob[]=StringExtractor.seperater(source);
            for(int i=0;i<ob.length;i++)
            {
                //if(!MeaningFinder.helpingVerbChecker((String)ob[i]))
                flag=flag||MeaningFinder.verbChecker((String)ob[i]);
            }
        }catch(Exception e){}
        return flag;
    }
/**
<pre>
INPUT:String (sentence/source string)
<b>My name is Prem Bharti</b>
OUTPUT:Object[] (Sets of incorrect words)
<b>Prem
Bharti </b>
 </pre>
 */
    public static Object[] wrongSpellExtractor(String source)
    {
        Object words[]=StringExtractor.seperater(source);
        ArrayList al=new ArrayList();
        for(int i=0;i<words.length;i++)
            if(!MeaningFinder.isWordCorrect((String)words[i]))al.add((String)words[i]);
        return al.toArray();
    }
        public static Object[] findMeaning(String word)
    {
        return StringExtractor.stringArrayExtractor(WebPageAnalyser.fetchSource("oxforddictionaries.com/definition/"+word+"?q="+word),"<span class=\"definition\">",'<');
    }
    public static Object[] findMeaningf(String word) throws ClassNotFoundException, SQLException
    {
            Connection con= Misc.connect(null);
            Statement st=con.createStatement();
            String sqlxp="Select meaning from m"+word.toLowerCase().charAt(0)+" where words='"+word+"'";
            ResultSet rs=st.executeQuery(sqlxp);
            ArrayList a=new ArrayList();
                while(rs.next())  a.add(rs.getString("meaning"));
            return a.toArray();
    }
    public static Object[] findSynonym(String word)
    {
        String source=WebPageAnalyser.fetchSource("www.synonym.com/synonyms/"+word+"/");
        Object[] ob=StringExtractor.stringArrayExtractor(source, "span class=\"equals\">", '<');
        ArrayList a=new ArrayList();
        for(int i=0;i<ob.length;i++)
        {
            a.add((String)ob[i]);
        }
        return a.toArray();
    }
    public static Object[] findSynonymf(String word) throws ClassNotFoundException, SQLException
    {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlxp="Select synonyms from s"+word.toLowerCase().charAt(0)+" where words='"+word+"'";
            ResultSet rs=st.executeQuery(sqlxp);
            ArrayList a=new ArrayList();
                while(rs.next())  a.add(rs.getString("synonyms"));
            return a.toArray();
    }
    public static boolean helpingVerbChecker(String word)throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="Select hvs from hvs where hvs='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
    public static boolean isInterrogative(String word) throws ClassNotFoundException, SQLException
    {
        Connection con=Misc.connect(null);
        Statement st=con.createStatement();
        String sqlc="Select * from interro where interro='"+word+"'";
        ResultSet rs=st.executeQuery(sqlc);
        return rs.next();
    }
    public static boolean nounChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="Select nouns from nouns where nouns='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
       public static boolean singularPronounChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="Select spronouns from spronouns where spronouns='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
       public static boolean pluralPronounChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="Select ppronouns from ppronouns where ppronouns='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
    public static Object[] partsOfSpeech(String word)
    {
        return StringExtractor.stringArrayExtractor(WebPageAnalyser.fetchSource("oxforddictionaries.com/definition/"+word+"?q="+word),"<span class=\"partOfSpeech\">",'<');
    }
    public static Object[] partsOfSpeechf(String word) throws ClassNotFoundException, SQLException
    {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlxp="Select pos from p"+word.toLowerCase().charAt(0)+" where words='"+word+"'";
            ResultSet rs=st.executeQuery(sqlxp);
            ArrayList a=new ArrayList();
                while(rs.next())  a.add(rs.getString("pos"));
            return a.toArray();
    }
    public static boolean prepositionChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="Select prepositions from prepositions where prepositions='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
    public static boolean pronounChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="Select pronouns from pronouns where pronouns='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
    public static Object[] senseSynonym(String source,int CaretPosition) throws ClassNotFoundException, SQLException
    {
        ArrayList a = new ArrayList();
        try
        {
        String word;
        int i,j,k=0;
        int c;
        char ch=' ';
        if(CaretPosition!=0)
        {
            ch=source.charAt(CaretPosition-1);
            i=j=CaretPosition;
            while(i>0 && source.charAt(i-1)!=' ')  i--;
            while(j<source.length()-1 && source.charAt(j-1)!=' ')  j++;
            word=source.substring(i,j);
            c=word.toLowerCase().charAt(0);
            if((c>96 && k<123))
            {
                Object syno[]=MeaningFinder.findSynonymf(word);
                for(i=0;i<syno.length;i++)
                    a.add((String)syno[i]);
                return a.toArray();
            }
        }
        }catch(Exception e){}            // TODO add your handling code here:
        return a.toArray();
    }
    public static Object[] senseWord(String source,int CaretPosition) throws ClassNotFoundException, SQLException
    {
        ArrayList a = new ArrayList();
        try
        {
        Connection con=Misc.connect(null);
        Statement st=con.createStatement();
        String sqlc="",word;
        int i,j,k=0,counter=0;
        int c;
        char ch=' ';
        if(CaretPosition!=0)
        {
            ch=source.charAt(CaretPosition-1);
            i=j=CaretPosition;
            while(i>0 && source.charAt(i-1)!=' ')  i--;
            while(j<source.length()-1 && source.charAt(j-1)!=' ')  j++;
            word=source.substring(i,j);
            c=word.toLowerCase().charAt(0);
            if((c>96 && k<123))
            {
                sqlc="Select word from "+(char)c+" where word like '"+word+"%'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next()&& counter<11)
                {
                    a.add(rs.getString("word"));
                    counter++;
                }
                return a.toArray();
            }
        }
        }catch(Exception e){}            // TODO add your handling code here:
        a.clear();
        return a.toArray();
    }

    public static Object[] senseWords(String source,int CaretPosition) throws ClassNotFoundException, SQLException
    {
        ArrayList a = new ArrayList();
        try
        {
        Connection con=Misc.connect(null);
        Statement st=con.createStatement();
        String sqlc="",word;
        int i,j,k=0,counter=0;
        int c;
        char ch=' ';
        if(CaretPosition!=0)
        {
            ch=source.charAt(CaretPosition-1);
            i=j=CaretPosition;
            while(i>0 && source.charAt(i-1)!=' ')  i--;
            while(j<source.length()-1 && source.charAt(j-1)!=' ')  j++;
            word=source.substring(i,j);
            c=word.toLowerCase().charAt(0);
            if((c>96 && k<123))
            {
                sqlc="Select word from allword where word like '"+word+"%'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next()&& counter<11)
                {
                    a.add(rs.getString("word"));
                    counter++;
                }
                return a.toArray();
            }
        }
        }catch(Exception e){}            // TODO add your handling code here:
        a.clear();
        return a.toArray();
    }
/**
<pre>
INPUT:String (word)
<b>What are you doing</b>
OUTPUT:Object[] (list of Synonyms of word if it's Verb of any form)
<b>What are you accomplishing</b>
</pre>
 */
    public static String spinner(String Sentence,int k) throws ClassNotFoundException, SQLException
        {
            Connection con=Misc.connect(null);
            try
            {
            Statement st=con.createStatement();
            String sqlc="Select * from samesame";
            ResultSet rs=st.executeQuery(sqlc);
            while(rs.next())
            {
                String x=rs.getString("word");
                String y=rs.getString("samesame");
                if(Sentence.contains(x))Sentence=Sentence.replaceAll(x, y);
            }
        }catch(SQLException s){System.err.print(s.toString());}
        Object ob[]=StringExtractor.commaSeperater(Sentence);
            Sentence="";
            String word;
            try
            {
            for(int i=0;i<ob.length;i++)
            {
                word=(String) ob[i];
                if (MeaningFinder.verbChecker(word)) //confirms a word is verb
                {
                    Object syno[]=MeaningFinder.synonymExtractor(word); //extract list of synonym for that verb
                    if(k<syno.length)
                       ob[i]=(String)syno[k];
                    else ob[i]=(String)syno[1];
                    Sentence=Sentence+" "+ob[i];
                }
                else Sentence=Sentence+" "+(String)ob[i];
            }
            }catch(Exception abe){ return "error";};
            Sentence=Sentence.replace(" /n","");
            Sentence=Sentence.replace("\n ", " ");
            return Sentence.replace(" ,",",");
        }
   
    public static String spinnerVA(String Sentence,int k) throws ClassNotFoundException, SQLException
        {
            Connection con=Misc.connect(null);
            try
            {
            Statement st=con.createStatement();
            String sqlc="Select * from samesame";
            ResultSet rs=st.executeQuery(sqlc);
            while(rs.next())
            {
                String x=rs.getString("word");
                String y=rs.getString("samesame");
                if(Sentence.contains(x))Sentence=Sentence.replaceAll(x, y);
            }
        }catch(SQLException s){System.err.print(s.toString());}
        Object ob[]=StringExtractor.commaSeperater(Sentence);
            Sentence="";
            String word;
            try
            {
            for(int i=0;i<ob.length;i++)
            {
                word=(String) ob[i];
                if (MeaningFinder.verbChecker(word)) //confirms a word is verb
                {
                    Object syno[]=MeaningFinder.synonymExtractor(word); //extract list of synonym for that verb
                    if(syno.length!=k)
                       ob[i]=(String)syno[k];
                    Sentence=Sentence+" "+ob[i];
                }
                else Sentence=Sentence+" "+(String)ob[i];
            }
            }catch(Exception abe){ return "error";};
            Sentence=Sentence.replace(" /n","");
            Sentence=Sentence.replace("\n ", " ");
            return Sentence.replace(" ,",",");
        }
/**
<pre>
INPUT:String (word)
<b>do</b>
OUTPUT:Object[] (list of Synonyms of word if it's Verb of any form)
<b>accomplish
execute
proceed
make
satisfy
fulfil
create
spend
groom</b>

INPUT:String (word)
<b>doing</b>
OUTPUT:Object[] (list of Synonyms of word if it's Verb of any form)
<b>accomplishing
executing
proceeding
making
satisfying
fulfilling
creating
spending
grooming</b>
</pre>
 */
    public static Object[] synonymExtractor(String word) throws ClassNotFoundException, SQLException
    {          
            Connection con2=Misc.connect(null);
            Connection con3=Misc.connect(null);
            ArrayList syno=new ArrayList();
            try
            {    
                Statement st2=con2.createStatement();
                Statement st3=con3.createStatement();
                String sqlc,sqlc2,sqlc3,verb,form,synonym;
                ResultSet rs2,rs3;
                verb="";form="";
//-----------------------------------------------------------------------------------------
                if(MeaningFinder.verbFirstFormChecker(word))
                {
                    verb=word;
                    form="present";
                    sqlc2="Select syno from synolist where word='"+verb+"'"; //extracting relevant synonym of verb
                    rs2=st2.executeQuery(sqlc2);
                        while(rs2.next())
                        {
                            synonym=rs2.getString("syno");
                            if(form.equals("past participle"))form="participle";
                            sqlc3="Select "+form+" from formsofverb where present='"+synonym+"'";
                            rs3=st3.executeQuery(sqlc3);
                            while(rs3.next())    syno.add(rs3.getString(form));
                        }
                }
                else
                {
                    sqlc="Select * from verbform where verbform='"+word+"'"; //checking for verbs and taking out verb and forms
                    rs2=st2.executeQuery(sqlc);
                    while(rs2.next())
                    {
                        verb=rs2.getString("verb");
                        form=rs2.getString("form"); //getting verb and forms
                    }
                        sqlc2="Select syno from synolist where word='"+verb+"'"; //extracting relevant synonym of verb
                         rs2=st2.executeQuery(sqlc2);
                        while(rs2.next())
                        {
                            synonym=rs2.getString("syno");
                            if(form.equals("past participle"))form="participle";
                            sqlc3="Select "+form+" from formsofverb where present='"+synonym+"'";
                            rs3=st3.executeQuery(sqlc3);
                            while(rs3.next())    syno.add(rs3.getString(form));
                        }
                }
        }catch(SQLException s){System.err.print(s.toString());}
        return syno.toArray();
    }
/**
<pre>
INPUT:String (word)
<b>eats</b>
OUTPUT:Boolean
<b>true</b>

INPUT:String (word)
<b>he</b>
OUTPUT:Boolean
<b>false</b>

</pre>
 */  
    public static boolean verbChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="Select verbform from verbform where verbform='"+word+"' or verb='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
/**
<pre>
INPUT:String (word)
<b>eats</b>
OUTPUT:Boolean
<b>true </b>

INPUT:String (word)
<b>eating</b>
OUTPUT:Boolean
<b>false </b>

</pre>
 */
    public static boolean verbSingularChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="SELECT * FROM verbform WHERE verbform='"+word+"' AND form='plural'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
/**
<pre>
INPUT:String (word)
<b>playing</b>
OUTPUT:String (Required Singular verb form)
<b>play</b>
INPUT:String (word)
<b>eaten</b>
OUTPUT:String (Required Singular verb form)
<b>eat</b>
INPUT:String (word)
<b>laugh</b>
OUTPUT:String (Required Singular verb form)
<b>laugh</b>
</pre>
 */
    public static String verbToNormalVerb(String word) throws ClassNotFoundException, SQLException
    {      
        String sqlc="SELECT verb FROM verbform WHERE verbform='"+word+"'",verb="";
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();          
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next()) verb=rs.getString("verb");
        }catch(Exception e){}
        return verb;
    }
/**
<pre>
INPUT: String (Word)
<b> eat </b>
OUTPUT: Boolean
<b> true </b>
-----------------------
INPUT: String (Word)
<b> eaten </b>
OUTPUT: Boolean
<b> false </b>
</pre>
 */
    public static boolean verbFirstFormChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="SELECT * FROM verbform WHERE (verbform='"+word+"' AND form='plural') OR verb='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
/**
 <pre>
INPUT: String (Word)
<b> eat </b>
OUTPUT: Boolean
<b> true </b>
-----------------------
INPUT: String (Word)
<b> eats </b>
OUTPUT: Boolean
<b> false </b>
 </pre>
 */
    public static boolean verbPluralChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="SELECT * FROM verbform WHERE verb='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
/**
<pre>
INPUT:String (word)
<b>playing</b>
OUTPUT:String (Required Singular verb form)
<b>plays</b>
INPUT:String (word)
<b>eaten</b>
OUTPUT:String (Required Singular verb form)
<b>eats</b>
INPUT:String (word)
<b>laugh</b>
OUTPUT:String (Required Singular verb form)
<b>laughs</b>
</pre>
 */
    public static String verbToSingular(String word) throws ClassNotFoundException, SQLException
    {
        String verb=MeaningFinder.verbToNormalVerb(word);
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="",plural="";
                sqlc="SELECT verbform FROM verbform WHERE verb='"+verb+"' AND form='plural'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next()) return rs.getString("verbform");
        }catch(Exception e){}
        return "";
    }
/**
<pre>
INPUT:String (word)
<b>playing</b>
OUTPUT:String (Required Ing verb form)
<b>playing</b>
INPUT:String (word)
<b>eaten</b>
OUTPUT:String (Required Ing verb form)
<b>eating</b>
INPUT:String (word)
<b>laugh</b>
OUTPUT:String (Required Ing verb form)
<b>laughing</b>
</pre>
 */
    public static String verbToIng(String word) throws ClassNotFoundException, SQLException
    {
        String verb=MeaningFinder.verbToNormalVerb(word);
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="",plural="";
                sqlc="SELECT verbform FROM verbform WHERE verb='"+verb+"' AND form='ing'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next()) return rs.getString("verbform");
        }catch(Exception e){}
        return "";
    }
/**
<pre>
INPUT:String (word)
<b>playing</b>
OUTPUT:String (Required Third verb form)
<b>played</b>
INPUT:String (word)
<b>eaten</b>
OUTPUT:String (Required Third verb form)
<b>eaten</b>
INPUT:String (word)
<b>laugh</b>
OUTPUT:String (Required Second verb form)
<b>laughed</b>
</pre>
 */
    public static String verbToThirdForm(String word) throws ClassNotFoundException, SQLException
    {
        String verb=MeaningFinder.verbToNormalVerb(word);
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="",plural="";
                sqlc="SELECT verbform FROM verbform WHERE verb='"+verb+"' AND form='past participle'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next()) return rs.getString("verbform");
        }catch(Exception e){}
        return "";
    }
/**
<pre>
INPUT:String (word)
<b>playing</b>
OUTPUT:String (Required Second verb form)
<b>played</b>
INPUT:String (word)
<b>eaten</b>
OUTPUT:String (Required Second verb form)
<b>ate</b>
INPUT:String (word)
<b>laugh</b>
OUTPUT:String (Required Second verb form)
<b>laughed</b>
</pre>
 */
    public static String verbToSecondForm(String word) throws ClassNotFoundException, SQLException
    {
        String verb=MeaningFinder.verbToNormalVerb(word);
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="",secForm="";
                sqlc="SELECT verbform FROM verbform WHERE verb='"+verb+"' AND form='past participle'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next()) secForm=rs.getString("verbform");
                if(!MeaningFinder.verbSecondFormChecker(secForm));
                {
                    sqlc = "SELECT verbform FROM verbform WHERE verb='" + verb + "' AND form='past'";
                    rs=st.executeQuery(sqlc);
                    while(rs.next()) secForm=rs.getString("verbform");
                }
                return secForm;
        }catch(Exception e){}
        return "";
    }
/**
<pre>
INPUT:String (word)
<b>eaten</b>
OUTPUT:Boolean
<b>true
</pre>
 */
    public static boolean verbThirdFormChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="SELECT * FROM verbform WHERE verbform='"+word+"' AND form='past participle'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
/**
<pre>
INPUT:String (word)
<b>playing</b>
OUTPUT:Boolean
<b>true
</pre>
 */
    public static boolean verbIngChecker(String word) throws ClassNotFoundException, SQLException
    {
        Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="SELECT * FROM verbform WHERE verbform='"+word+"' AND form='ing'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
        }catch(Exception e){}
        return flag;
    }
/**
<pre>
INPUT:String (word)
<b>ate</b>
OUTPUT:Boolean
<b>true</b>
INPUT:String (word)
<b>eaten</b>
OUTPUT:Boolean
<b>false</b>
</pre>
 */
    public static boolean verbSecondFormChecker(String word) throws ClassNotFoundException, SQLException
    {
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            Statement st2=con.createStatement();
            String sqlc="",sqlc2="",sqlc3="";
                sqlc="SELECT * FROM verbform WHERE verbform='"+word+"' AND form='past'";
                sqlc3="Select * FROM verbform Where verb='"+MeaningFinder.verbToNormalVerb(word)+"' AND form='past'";
                sqlc2="SELECT * FROM verbform WHERE verbform='"+word+"' AND form='past participle'";
                ResultSet rs=st.executeQuery(sqlc);
                if(rs.next()) return true;
                else
                {
                    rs=st.executeQuery(sqlc3);
                    ResultSet rs2=st2.executeQuery(sqlc2);
                    if(rs2.next()&& !rs.next()) return true ;
                    else return false;
                }
        }catch(Exception e){}
        return false;
    }
/**
<pre>
INPUT:String (sentence)
<b> what did you like playing or smoking </b>
OUTPUT:Object[] (list of verbs in any form (present,past,past participle,ving,plural)
<b>did
like
playing
smoking
</pre>
 */
    public static Object[] verbExtractor(String sentence) throws ClassNotFoundException, SQLException
    {
            Connection con=Misc.connect(null);
            ArrayList verbs=new ArrayList();
            try
            {
                Statement st=con.createStatement();
                Object words[]=StringExtractor.seperater(sentence);
                String word="",sqlc;
                ResultSet rs;
            for(int i=0;i<words.length;i++)
            {
                sqlc="Select verb,verbform from verbform where verbform='"+words[i]+"' or verb='"+words[i]+"'";
                rs=st.executeQuery(sqlc);
                while(rs.next()) verbs.add((String)words[i]);
            }
        }catch(SQLException s){System.err.print(s.toString());}
            return StringExtractor.uniqueFilter(verbs.toArray());
    }
/**
 <pre>
 INPUT: String (verb=>must be present), String (form: present/past/participle/ing/(plural=>for singular mistaken))
 INPUT:<b>eat,past</b> OUTPUT:<b>ate</b>
 INPUT:<b>eat,participle</b> OUTPUT:<b>eaten</b>
 INPUT:<b>eat,plural</b> OUTPUT:<b>eats</b>
 INPUT:<b>eat,ing</b> OUTPUT:<b>eating</b>
 </pre>
 */
    public static String verbFormExtractor(String verb,String form) throws SQLException, ClassNotFoundException
    {
            Connection con=Misc.connect(null);
            try
            {
                Statement st=con.createStatement();
                String sqlc="Select "+form+" from formsofverb where present='"+verb+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    form=rs.getString(form);
            }catch(SQLException s){System.err.print(s.toString());}
            return form;
    }
/**
 <pre>
 INPUT:String (verb of any form)
 <b> ate </b>
 OUTPUT:String[] (at String[0] => form of verb and String[1] => present form
 <b> past
 eat </b>
 </pre>
 */
    public static String[] verbFormSensor(String verbform) throws ClassNotFoundException, SQLException
    {
            Connection con=Misc.connect(null);
            String form="",verb="";
            try
            {
                Statement st=con.createStatement();
                String sqlc="Select form,verb from verbform where verbform='"+verbform+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                {
                    form=rs.getString("form");
                    verb=rs.getString("verb");
                }
            }catch(SQLException s){System.err.print(s.toString());}
            String result[]={form,verb};
            return result;          
    }
/**
 <pre>
INPUT: String (Word)
<b> zassdgf </b>
OUTPUT: Boolean
<b> false </b>

INPUT: String (Word)
<b> tiger </b>
OUTPUT: Boolean
<b> true </b>
 </pre>
 */
    public static boolean isWordCorrect(String word)
    {
       Boolean flag=false;
        try
        {
            Connection con=Misc.connect(null);
            Statement st=con.createStatement();
            String sqlc="";
                sqlc="Select words from wordlist where words='"+word+"'";
                ResultSet rs=st.executeQuery(sqlc);
                while(rs.next())
                    if(rs.getRow()!=0)
                        flag=true;
         }catch(Exception e){}
            return flag;
    }
        public static String whatIs(Object ob[])
        {
            String word="",source="";
                JEditorPane je=new JEditorPane();
                je.setText("");
                je.setContentType("text/html");
//what section---------------------------------------------------------------------------------
                for(int i=0; i<ob.length;i++)
                {
                    word=(String)ob[i];
                    try
                    {
                        if (!(MeaningFinder.helpingVerbChecker(word) || MeaningFinder.prepositionChecker(word) || MeaningFinder.pronounChecker(word) || word.equals("?")|| word.equals("??")))
                        source=WebPageAnalyser.fetchSource("en.wikipedia.org/wiki/"+word);
                        source=StringExtractor.stringExtractor(source, "<p><b>", "</p>");
                        je.setText(source);
                        System.out.println(source);
                        JTextArea j=new JTextArea();
                        je.setText(source);
                                    je.setText(source);
                                    je.selectAll();
                                    je.copy();
                                    j.paste();
                                    return j.getText();
                    } catch (Exception e) {}
                }
                return "";
        }
}