473,657 Members | 2,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to count the number of times each word appears and store in table?

1 New Member
Hi,

Please forgive me, I'm new to java.

I've got a hunk of text. I want to count the number of times each word appears. I understand that I should store the keys & values in a hashmap/hashtable. How should I go about doing this?

Thanks so much!
Aug 7 '10 #1
1 2911
Dheeraj Joshi
1,123 Recognized Expert Top Contributor
Please forgive me, I'm new to java.
We all were new once up on a time. :)

Coming back to problem. I suspect you are trying to read the input string from the file. tokenize the input string on space then compare the tokenized strings with the string you need to compare. If they are same increment the count.

This may not suit the large file with hundreds of line of text.

Regards
Dheeraj Joshi
Aug 8 '10 #2

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

Similar topics

2
22412
by: q2005 | last post by:
Hi, all How do I get the number of rows in a table? jack
0
2655
by: DataFreakFromUtah | last post by:
Hello! No question here, just a procedure for the archive. Search critera: count records imported count data imported count number of rows imported count number of records imported record import count automatically import and count records prompt for number of records imported import count auto-import records autoimport records count records before and after
2
15429
by: Lauren Quantrell | last post by:
I am using a stored procedure as the recordsource on an MS-Access2000 form: Forms!frmName.RecordSource = "dbo.myStoredProcedure" The stored procedure creates a temp table #Contacts and then inserts matching KeyID values contacts into it. Then I use a union query in the same stored procedure to create the actual recordset. What I want to know is how I can return the number of records in the temp table #Contacts back to MS Access and...
2
1835
by: MLH | last post by:
Gentlemen: I have declared an array Dim MyTables(14) AS Long Now I want to assign values for MyTables(0) - MyTables(14) equal to the number of records in each table. Catch, I want the code to identify only those tables beginning with the letters "JA". Is this possible? Or, should I break down and manually type in all the table names?
2
1111
by: Matthew Louden | last post by:
I want to count the number of records in a table, and insert a new record with ID increment the count by 1. Heres the code: sqlStmt = "SELECT COUNT(*) As numRecords FROM TimeSlot;" cmd = New SqlCommand(sqlStmt, conn) dr = cmd.ExecuteReader But how to get the value of numRecords? since numRecords is not a field in table TimeSlot
3
2342
by: Advo | last post by:
I've made a small search function as of here: if (stristr($bleh,$search_for)) { if(preg_match('/<title>(*)<\/title>/i', $bleh, $matches)) { $name = str_replace("./","/",$name); echo "<li><a href=$link".$name.">".$matches."</a><br><br>"; }
1
1818
seshu
by: seshu | last post by:
Hi everybody This is seshu i have a small doubt in mysql i have created a table to save the data about dialy attendence i am able to retrive all the as per my needs but the problem at the end of the mounth i want to see who are all absent in that perticular mounth and for how many days ofcourse i have a filed with name to status to say whether they are present are not i hope i am clear to everybody any how i wnt to group all...
5
5705
by: isabelle | last post by:
hi, every body.. I have two program I couldn’t solve them So, can any body help me. please!! 1-Write a program that accepts a character and count number of occurrences in a file. The file should have some text, and the program count how many times the inputted character repeated in the file and prints the result on the screen. (Hint: you have to use continue statement in your solution ) Sample input:
11
14658
by: Mack | last post by:
Hi all, I want to write a program to count number of bits set in a number. The condition is we should not loop through each bit to find whether its set or not. Thanks in advance, -Mukesh
2
9000
by: mfaisalwarraich | last post by:
Hi Everybody, I am using the following code to get the recordset of an external database. Dim dbPatients As Database Dim rsCountPatients As Recordset ' to count number of patients in a table Const strDBPath = "C:\Patients.mdb" ' external database Set dbPatients = OpenDatabase(strDBPath, False, True, ";PWD=abc")
0
8319
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8512
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8612
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.