473,396 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to display original form of a verb using java

Dear Friends,
I have a doubt in how to dispaly the original form of a verb using java.ie if the word is arose then the output must be arise.but now in my program there is one text file 'verbs.txt' is caling in that i store 3 forms of words.now the problem is if my text file contains 'is' then it will check the 'verbs.txt' and gives the output as arise. but i want the output as is itself.Can anyone give the suggestion plssssssssss.


Thanking you
Feb 19 '07 #1
4 2065
r035198x
13,262 8TB
Dear Friends,
I have a doubt in how to dispaly the original form of a verb using java.ie if the word is arose then the output must be arise.but now in my program there is one text file 'verbs.txt' is caling in that i store 3 forms of words.now the problem is if my text file contains 'is' then it will check the 'verbs.txt' and gives the output as arise. but i want the output as is itself.Can anyone give the suggestion plssssssssss.


Thanking you
Not very clear. Post your code using code tags and explain your problem again.
Feb 19 '07 #2
????????/this is my some portion of code???????????
Expand|Select|Wrap|Line Numbers
  1.  import java.io.*; 
  2. import java.util.regex.*;
  3. import java.util.*;
  4. import java.util.regex.Matcher;
  5. import java.util.regex.Pattern;
  6. class Copy1
  7. {
  8. public static void main(String[] args)
  9. {
  10. try
  11. {
  12. String str;
  13.             DataInputStream dis = null;
  14.             String c = null;
  15. //int recCount = 0;
  16. File inputFile = new File("net.txt");
  17. File outputFile = new File("again.txt");
  18. FileInputStream fis = new FileInputStream(inputFile);
  19. BufferedInputStream bis = new BufferedInputStream(fis);
  20. dis= new DataInputStream(bis);
  21. FileOutputStream fos = new FileOutputStream(outputFile);
  22. System.out.println("Word by Word Display");
  23. while ((c =dis.readLine())!=null)
  24. {
  25.                  //m.reset(c);
  26.                  //recCount++;
  27.              // String[] x = Pattern.compile(" ").split(c);
  28. String[] x =c.split("\\s");
  29.                  for (int i=0; i<x.length; i++)
  30.                  {
  31.  
  32.  
  33.                         test(x[i]);
  34.  
  35.  
  36.              //System.out.println(x[i]);
  37.          }
  38. // System.out.println(recCount + ": " + c);
  39. //fos.write(c);
  40.  
  41. }
  42. fis.close();
  43. fos.close();
  44. }
  45. catch (FileNotFoundException e)
  46. {
  47. System.err.println("FileStreamsTest: " + e);
  48. }
  49. catch (IOException e)
  50. {
  51. System.err.println("FileStreamsTest: " + e);
  52. }
  53. }
  54. public static void test(String str)
  55.          {
  56.          String output;
  57.                  try
  58.                      {
  59.                      DataInputStream di = null;
  60.                      String record = null;
  61.                      int recCount = 0;
  62.                      String[] words={""};
  63.                      File f = new File("verbs.txt");
  64.                      FileInputStream fi = new FileInputStream(f);
  65.                      BufferedInputStream bi = new BufferedInputStream(fi);
  66.                      di = new DataInputStream(bi);
  67.                      String out;
  68.                   while ( (record=di.readLine()) != null )
  69.                   {
  70.                                   if(str.startsWith(str))
  71.                                          {
  72.                       String regex = str;
  73.                       Pattern p = Pattern.compile(regex);
  74.              Matcher m = p.matcher(record);
  75.                   int c=0;
  76.              if (m.find())
  77.              {
  78.                                              String s = m.replaceAll(regex).trim();
  79.               words = s.split(" ");
  80.  
  81.                                                  System.out.println(words[0]);
  82.  
  83.                                                  break;
  84.                           }
  85.                                   }
  86.                  }
  87.                  //System.out.println(words[0]);
  88.                      if(words[0]!="")
  89.                          {
  90.                                             //System.out.println(words[0]);
  91.                                             return;
  92.                                             }
  93.  
  94.                                             fi.close();
  95.                                             di.close();
  96. bi.close();
  97.          }
  98.          catch (IOException e)
  99.          {
  100.          System.out.println("My Exception!" + e.getMessage());
  101.          }
  102.  
Feb 19 '07 #3
r035198x
13,262 8TB
????????/this is my some portion of code???????????
Expand|Select|Wrap|Line Numbers
  1.  import java.io.*; 
  2. import java.util.regex.*;
  3. import java.util.*;
  4. import java.util.regex.Matcher;
  5. import java.util.regex.Pattern;
  6. class Copy1
  7. {
  8. public static void main(String[] args)
  9. {
  10. try
  11. {
  12. String str;
  13.             DataInputStream dis = null;
  14.             String c = null;
  15. //int recCount = 0;
  16. File inputFile = new File("net.txt");
  17. File outputFile = new File("again.txt");
  18. FileInputStream fis = new FileInputStream(inputFile);
  19. BufferedInputStream bis = new BufferedInputStream(fis);
  20. dis= new DataInputStream(bis);
  21. FileOutputStream fos = new FileOutputStream(outputFile);
  22. System.out.println("Word by Word Display");
  23. while ((c =dis.readLine())!=null)
  24. {
  25.                  //m.reset(c);
  26.                  //recCount++;
  27.              // String[] x = Pattern.compile(" ").split(c);
  28. String[] x =c.split("\\s");
  29.                  for (int i=0; i<x.length; i++)
  30.                  {
  31.  
  32.  
  33.                         test(x[i]);
  34.  
  35.  
  36.              //System.out.println(x[i]);
  37.          }
  38. // System.out.println(recCount + ": " + c);
  39. //fos.write(c);
  40.  
  41. }
  42. fis.close();
  43. fos.close();
  44. }
  45. catch (FileNotFoundException e)
  46. {
  47. System.err.println("FileStreamsTest: " + e);
  48. }
  49. catch (IOException e)
  50. {
  51. System.err.println("FileStreamsTest: " + e);
  52. }
  53. }
  54. public static void test(String str)
  55.          {
  56.          String output;
  57.                  try
  58.                      {
  59.                      DataInputStream di = null;
  60.                      String record = null;
  61.                      int recCount = 0;
  62.                      String[] words={""};
  63.                      File f = new File("verbs.txt");
  64.                      FileInputStream fi = new FileInputStream(f);
  65.                      BufferedInputStream bi = new BufferedInputStream(fi);
  66.                      di = new DataInputStream(bi);
  67.                      String out;
  68.                  while ( (record=di.readLine()) != null )
  69.                  {
  70.                                  if(str.startsWith(str))
  71.                                          {
  72.                      String regex = str;
  73.                      Pattern p = Pattern.compile(regex);
  74.              Matcher m = p.matcher(record);
  75.                  int c=0;
  76.              if (m.find())
  77.              {
  78.                                              String s = m.replaceAll(regex).trim();
  79.              words = s.split(" ");
  80.  
  81.                                                  System.out.println(words[0]);
  82.  
  83.                                                  break;
  84.                          }
  85.                                  }
  86.                  }
  87.                  //System.out.println(words[0]);
  88.                      if(words[0]!="")
  89.                          {
  90.                                             //System.out.println(words[0]);
  91.                                             return;
  92.                                             }
  93.  
  94.                                             fi.close();
  95.                                             di.close();
  96. bi.close();
  97.          }
  98.          catch (IOException e)
  99.          {
  100.          System.out.println("My Exception!" + e.getMessage());
  101.          }
  102.  
You forgot the code tags and another explanation of the problem.
Feb 19 '07 #4
hirak1984
316 100+
well Iam sorry to say that you must write the codes with proper indentation.

This type of posts makes it relly tough for people to comprehend.
and I request you to describe your problem once again and this time in a more clarified way.
God bless
Dear Friends,
I have a doubt in how to dispaly the original form of a verb using java.ie if the word is arose then the output must be arise.but now in my program there is one text file 'verbs.txt' is caling in that i store 3 forms of words.now the problem is if my text file contains 'is' then it will check the 'verbs.txt' and gives the output as arise. but i want the output as is itself.Can anyone give the suggestion plssssssssss.


Thanking you
Feb 19 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: matthewemiclea | last post by:
I am trying to display information in Access on a form that takes information from many different queries and puts them together on a spreadsheet or chart. Some specific info: The information I...
13
by: KMiller | last post by:
I would like to control entry into one or more of the tabs > I have set up on my Tab control based on set rules. Does > anyone know how to grey-out the text so that a user will > see that they do...
10
by: Sarah Smith | last post by:
Hello, I am a bit of a newbie to VB.NET, but not totally new. I took the plunge recently and decided (along with my colleagues), to try to convert/port a VB6 client/server app to .Net. (I'm...
1
by: amir | last post by:
Hi, When compiling a page in VS2005 this morning I received 101 messages regarding schema problems in my web.config file. When I go to view an aspx page in my IIS, IE just displays a blank...
5
by: zlf | last post by:
Hello, I try to use a custom HttpHandler to add something to session, then display the original page. public void ProcessRequest(HttpContext context) { context.Session = "test"; } But, a...
2
by: zoeabraham | last post by:
I am Using STRUTS1.4 in NetBeans5.5 IDE Here we have a JSP Page <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"...
1
by: amritranjan | last post by:
How to retrive image file from MS access database and display this in another JSPpage -------------------------------------------------------------------------------- This is my Jsp code for...
2
by: Abneo | last post by:
Hi all, I am very new to Javascript and I am in some need of some help. I am creating a site that has a madlib. I got the madlib code but now I want the results of the madlib to display in...
3
by: vijaykumardahiya | last post by:
Hello To Every One, I want to know that when I upload the File like a image from html page Its not show on servlet page using appropriate logic. I read the FileUpload Home page.But I am still...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.