Word Frequency Counter

Status
Not open for further replies.

Roger J Carlson

Moderator In Name Only
Super Member
Registered
Joined
Feb 19, 2005
Messages
12,799
Reaction score
2,500
Location
West Michigan
In another thread (Red, Blue, Green--other? ), someone expressed an interest in a program that would count word frequency in a document. Since I'm a computer programmer in real life, the idea got under my skin and I wrote one.

The program is written in a MS Word 2000 document (yes, you can do that) and it allows you to find the word frequency of any Word document (.doc), text file (.txt), or Rich Text document (.rtf). It should work with higher versions of Word, but I haven't tested it. In additon to word frequency, it also calculates the closest proximity of any two instances of the same word, so you can see if you are using words too close to each other.

I have a copy on my website, here:
http://www.rogerjcarlson.com/WritingHelp/TechTips.html
I was going to attach it here, but it's too big (77K). I'd appreciate your feedback. The document is zipped so you'll have to unzip it. There are instructions on the document itself which explain how to use it.
 

Jamesaritchie

Super Member
Registered
Joined
Feb 13, 2005
Messages
27,863
Reaction score
2,313
Frequency

Roger J Carlson said:
In another thread (Red, Blue, Green--other? ), someone expressed an interest in a program that would count word frequency in a document. Since I'm a computer programmer in real life, the idea got under my skin and I wrote one.

The program is written in a MS Word 2000 document (yes, you can do that) and it allows you to find the word frequency of any Word document (.doc), text file (.txt), or Rich Text document (.rtf). It should work with higher versions of Word, but I haven't tested it. In additon to word frequency, it also calculates the closest proximity of any two instances of the same word, so you can see if you are using words too close to each other.

I have a copy on my website, here:
http://www.rogerjcarlson.com/WritingHelp/TechTips.html
I was going to attach it here, but it's too big (77K). I'd appreciate your feedback. The document is zipped so you'll have to unzip it. There are instructions on the document itself which explain how to use it.

Pretty cool! I especially like the proximity display. And it does work well with Word 2003.
 

Euan H.

Unspeakable
Super Member
Registered
Joined
Feb 13, 2005
Messages
530
Reaction score
106
Location
London
Website
euanharvey.com
Hi Roger,

I can't get the program to work with the copy of word that came with my copy of Word (2002), which is a crying shame, because it sounds like a really useful thing. Problem is: nothing happens when I click the button--even with Macro security set to 'low'.

Cheers,

Euan
 

stace001

Look into my eyes
Super Member
Registered
Joined
Apr 20, 2005
Messages
293
Reaction score
27
Location
Queensland, Australia
Proximity Alert

Will it work with Windows XP? It sounds fabulous! I'm always worried that I've used some words too often, and this would save me having to go back and reread chapter after chapter to find out.
 

Euan H.

Unspeakable
Super Member
Registered
Joined
Feb 13, 2005
Messages
530
Reaction score
106
Location
London
Website
euanharvey.com
stace001 said:
Will it work with Windows XP?
Windows XP is what I'm using, so I don't think it does...unless I'm doing somethign stupid (which is not altogether unlikely).

It sounds fabulous! I'm always worried that I've used some words too often, and this would save me having to go back and reread chapter after chapter to find out.
Yup. All of the people who beta-read my WIP said I had certain pet words I used waaay too much. Whenever my character's had a problem, frex, they 'worried at' it. Which I still think sounds okay...but not *every* *single* flipping time they have a problem!
 

Jamesaritchie

Super Member
Registered
Joined
Feb 13, 2005
Messages
27,863
Reaction score
2,313
XP

stace001 said:
Will it work with Windows XP? It sounds fabulous! I'm always worried that I've used some words too often, and this would save me having to go back and reread chapter after chapter to find out.

It works with the Word XP I have, which is Word 2002.
 

Jamesaritchie

Super Member
Registered
Joined
Feb 13, 2005
Messages
27,863
Reaction score
2,313
2002

Euan H. said:
Hi Roger,

I can't get the program to work with the copy of word that came with my copy of Word (2002), which is a crying shame, because it sounds like a really useful thing. Problem is: nothing happens when I click the button--even with Macro security set to 'low'.

Cheers,

Euan

I'm not sure what the problem is. I use Word 2003, but I also have Word 2002 here, and it works fine with it.
 

Roger J Carlson

Moderator In Name Only
Super Member
Registered
Joined
Feb 19, 2005
Messages
12,799
Reaction score
2,500
Location
West Michigan
stace001 said:
Will it work with Windows XP? It sounds fabulous! I'm always worried that I've used some words too often, and this would save me having to go back and reread chapter after chapter to find out.
Windows XP or Word XP? People get them confused. Regardless, it should work with Windows XP, since my computer uses WinXP. Others have reported that it works with Word XP (or Word 2002, same thing) and Word 2003.
 

Roger J Carlson

Moderator In Name Only
Super Member
Registered
Joined
Feb 19, 2005
Messages
12,799
Reaction score
2,500
Location
West Michigan
Euan H. said:
Hi Roger,

I can't get the program to work with the copy of word that came with my copy of Word (2002), which is a crying shame, because it sounds like a really useful thing. Problem is: nothing happens when I click the button--even with Macro security set to 'low'.

Cheers,

Euan
Hmmmm...
This is troubling. What exactly DOES happen. For instance, when you click it, do you get a shaded gray box around the button? Or do you get a solid line around the button with little black boxes in the corners and in the middle of each side (called 'handles')?
 

bkrrh85

Super Member
Registered
Joined
Apr 21, 2005
Messages
65
Reaction score
4
Location
Southern States
Roger--

It sounds great, but when I click on the button (it saved itself as a Word Document), I don't get a "file open" window; instead, about four or five different sized windows open, and I don't see any kind of option to open a different word document.

Now, I'm rather computer challenged, and don't do well adapting to new and different programs. I don't really understand how this thing is to work, and I'm not sure what I'm seeing is what I'm supposed to see.

Can you take me step-by-step through the thing? I know, hand-holding and all that, but I would dearly love to be able to figure out how to use this. I have XP, Word 2003 (I think that's the latest edition; bought my in Feb. '05).

Thanks in advance for your help.
 

Roger J Carlson

Moderator In Name Only
Super Member
Registered
Joined
Feb 19, 2005
Messages
12,799
Reaction score
2,500
Location
West Michigan
zornhau said:
Any chance you could make the code public so I can tweak it for my own purposes?
The code is already publc. It's right in the document. With the document open, go to Tools > Macro > Visual Basic Editor. You should find a section off to the left that looks like the attached bitmap file (vb.bmp). Most of the code is in Module 1. There is a tiny bit behind ThisDocument. Module 2 has code written by a fellow named Ken Getz and it is the code for opening the OpenSave dialog box.
 

Roger J Carlson

Moderator In Name Only
Super Member
Registered
Joined
Feb 19, 2005
Messages
12,799
Reaction score
2,500
Location
West Michigan
Roger--

It sounds great, but when I click on the button (it saved itself as a Word Document), I don't get a "file open" window; instead, about four or five different sized windows open, and I don't see any kind of option to open a different word document.

Now, I'm rather computer challenged, and don't do well adapting to new and different programs. I don't really understand how this thing is to work, and I'm not sure what I'm seeing is what I'm supposed to see.

Can you take me step-by-step through the thing? I know, hand-holding and all that, but I would dearly love to be able to figure out how to use this. I have XP, Word 2003 (I think that's the latest edition; bought my in Feb. '05).

Thanks in advance for your help.
OK. Let's start at the beginning. The file that you download is a compresses (Zipped) file. I do that to make it smaller and faster to download. The first thing you have to do is extract the document from the zip file. I don't know what kind of software you have, but I use WinZip.

Once you have extracted it to a folder, open the document. By this I mean WordFrequency.doc. It starts out like this:
Word Frequency Counter


What is this?

This document contains a program to count the frequency of word usage in a document. It works with Word documents, Text documents, and Rich Text documents.
...(and so forth)

Part way down the screen is a button that says: "Click here to open document to be counted"

Is this the button you are clicking?

Now I can't see what is happening on your screen, but what SHOULD happen at this point is a dialog box with the title:"Find Document to Word Count" should open. This box looks EXACTLY like the box that opens when you go to File > Open. This is where you select a .doc, .txt, or .rtf file. From that point, it should be automatic.

If this is NOT happening, can you describe the boxes that are coming up? What is in the title bar? What is displaying in the window?

Hope this helps.
 

bkrrh85

Super Member
Registered
Joined
Apr 21, 2005
Messages
65
Reaction score
4
Location
Southern States
Roger, here's what I did and here's what happened.

First, uninstalled old download so could start fresh.
Went back to AW thread; our link on AW thread wouldn't connect me to your web site; couldn't copy and paste it either
Went to your web site
Chose Word Freq. Ctr
Open vs. Save:
When clicked Open, window said "folder is invalid or corrupted"
clicked ok
Back to W Freq. Ctr
Save
Saved "Word Freq." to Desktop
Save
Download Complete
Choices: Open, Open Folder, Close -- I chose "Open Folder", and window came up that said "target on desktop"
I clicked OK
Dialogue Box disappears
Your web site reappears
Closed it
WFreq icon on desktop
Left click on icon (before did a R click, then open, but result was same)
Window opens w/option to extract all files. clicked on "extract all files"
Folders Extraction Wizard window opens
Clicked "next"
In select destination, chose default setting, that was desktop (1st time changed it to my doc.; end result same)
Clicked "next"
Clicked "finish" (with "show extracted files" box checked)
Same window reopens, that gave me the option to extract: shows the WFreq. file; when place cursor over it, shows as a Word Doc.
Left click on icon
Opens a MS Word window
Your document shows up, like you said in your email
Clicked on "click here to open document to be counted"
Then everything goes bonkers!
It opens several stacked windows in middle of screen (top one first): WFreq. - This Doc (Code); WFeq. - Module 1 (Code); WFreq. - Module 2(Code)
On the left of the screen, see window that says "Project - Template Project"
Title of this whole opened document is: MS Visual Basic - PALMAPP [design]

When click on the top window, "WFreq. - This Doc (Code)" window to move it so the "x" box shows, it opens another window on the left:
Command Button w/ "Alphabetic" and "Command Button" with tables beneath it.

When close all open windows, find a second icon has been added to my desktop.

Even if, after I do the extracted files thing and go through the wizard, I close all the windows and go directly to the Word document, click on your "click here to open doc. to be counted", I get the same gobbledegook.

Any suggestions? Again, I have Windows XP, home edition; latest edition of MS Office

Thanks
 

Roger J Carlson

Moderator In Name Only
Super Member
Registered
Joined
Feb 19, 2005
Messages
12,799
Reaction score
2,500
Location
West Michigan
Roger, here's what I did and here's what happened.

First, uninstalled old download so could start fresh.
Went back to AW thread; our link on AW thread wouldn't connect me to your web site; couldn't copy and paste it either
Went to your web site
Chose Word Freq. Ctr
Open vs. Save:
When clicked Open, window said "folder is invalid or corrupted"
clicked ok
Back to W Freq. Ctr
Save
Saved "Word Freq." to Desktop
Save
Download Complete
Choices: Open, Open Folder, Close -- I chose "Open Folder", and window came up that said "target on desktop"
I clicked OK
Dialogue Box disappears
Your web site reappears
Closed it
WFreq icon on desktop
Left click on icon (before did a R click, then open, but result was same)
Window opens w/option to extract all files. clicked on "extract all files"
Folders Extraction Wizard window opens
Clicked "next"
In select destination, chose default setting, that was desktop (1st time changed it to my doc.; end result same)
Clicked "next"
Clicked "finish" (with "show extracted files" box checked)
Same window reopens, that gave me the option to extract: shows the WFreq. file; when place cursor over it, shows as a Word Doc.
Left click on icon
Opens a MS Word window
Your document shows up, like you said in your email
Clicked on "click here to open document to be counted"
Up to this point, you are OK. You had some false starts with the extraction, but you've got the document now.

Then everything goes bonkers!
It opens several stacked windows in middle of screen (top one first): WFreq. - This Doc (Code); WFeq. - Module 1 (Code); WFreq. - Module 2(Code)
On the left of the screen, see window that says "Project - Template Project"
Title of this whole opened document is: MS Visual Basic - PALMAPP [design]

When click on the top window, "WFreq. - This Doc (Code)" window to move it so the "x" box shows, it opens another window on the left:
Command Button w/ "Alphabetic" and "Command Button" with tables beneath it.
OK, where you are now is the Visual Basic Editor. You are seeing the actual code behind the document. You probably also have another button/icon on your taskbar called "Microsoft Visual Basic". You can close the whole thing by clicking the Close "X" button in the far upper right. Now you will see your document again.

In all likelyhood, you are in "Form Design Mode". This is not something you would ordinarily deal with when creating a document. This only comes into play when you have buttons and such on the document (as I have). To fix this, go to View > Toolbars. If there is NOT a check mark next to Control Toolbox, click it (Control Toolbox). This will open the Control Toolbox toolbar. (If there IS already a check mark there, that means the toolbar is already open and you can just use it as below.)

In the upper left corner of this toolbar there will be a button that looks like a green triangle with a ruler and pencil. This button looks like it is depressed if you are in Design Mode. If you hover your pointer over it, you should get a tooltip that says "Exit Design Mode". Click the button so it looks like it is "unpressed". You are now out of Design Mode and you can close that toolbox. The button on my document should now work.

Whew!

Give that a try.
 

bkrrh85

Super Member
Registered
Joined
Apr 21, 2005
Messages
65
Reaction score
4
Location
Southern States
I'll give it a try and get back to you. Got a couple other things to do first. Thanks!

Oh, BTW, Jenna was kind enough to readjust my username; don't know how I managed to stick my whole email address on there before, so it's still me!!
 
Last edited:

bkrrh85

Super Member
Registered
Joined
Apr 21, 2005
Messages
65
Reaction score
4
Location
Southern States
Roger--

Opened the document off the desktop, extracted files and sent them to Word. Opened the Word doc. named "Word Frequency".

Clicked on your button, saw all the gobbledegook, closed it like you said.
Then with your WFreq. doc once again in front of me, I went to veiw, clicked the Control Toolbox and the toolbar showed up.

Saw the button, and exited "design mode." Closed the toolbox.

The button on your document does NOT work. Single click, double click. Nothing.

Any more ideas?

Thanks,
Ranneh
 

bkrrh85

Super Member
Registered
Joined
Apr 21, 2005
Messages
65
Reaction score
4
Location
Southern States
Roger--

Yippee!! I got it!! I actually read (I know...) part of your Word Freq. doc and did the macro thing.

The only thing was, even though I made the changes in the security setting, I had to restart my computer for it take effect (I'm slowly getting used to that to enable/disenable things). You may want to add that to your handy macro security sheet.

Ranneh
 

bkrrh85

Super Member
Registered
Joined
Apr 21, 2005
Messages
65
Reaction score
4
Location
Southern States
Roger--

Yippee!! I got it!! I actually read (I know...) part of your Word Freq. doc and did the macro thing.

The only thing was, even though I made the changes in the security setting, I had to restart my computer for it take effect (I'm slowly getting used to that to enable/disenable things). You may want to add that to your handy macro security sheet.

BTW, when I restarted the computer, now the enable/disable macros comes up with every screen. Is that because I changed the security setting, and will it always come up even if I click on disable for a certain program?

Thanks! The program is COOLY AWESOME!!! Oh, one last question, the "closest proximity" column--does that mean how close that word is to the last time it was used?

Ranneh
 

cwfgal

On the rocks
Super Member
Registered
Joined
Feb 12, 2005
Messages
1,173
Reaction score
156
Location
In a state of psychosis
Website
www.bethamos.com
I had the same problem with the button not working but after closing everything down, rebooting, and trying it again, it worked. I didn't get the macro box until after rebooting so maybe that's an issue. Very cool program! Thanks!

Beth
 

stace001

Look into my eyes
Super Member
Registered
Joined
Apr 20, 2005
Messages
293
Reaction score
27
Location
Queensland, Australia
I need help...

Roger,

I have read all of the posts here, and followed their directions (and yours) but it keeps coming up as a "read only" document. I'm about to throw the computer out the closest window!! What am i doing wrong? I'm not a complete idiot when it comes to computers, but this program is going to get me there fast.
 

bkrrh85

Super Member
Registered
Joined
Apr 21, 2005
Messages
65
Reaction score
4
Location
Southern States
Hee, hee, retired Demon hunter--pretty good! I like that . . .
BTW, I have a "cheat" drawer to my left, full of a nice, big (and very fat) bag of Hershey's kisses. Yum, yum!!!

I hear you about the computer program. One thing I HATE worse than about anything is a computer not working the way it's supposed to . . . or me not understanding WHY it's not working the way it is supposed to!!!

Most things are easy - if you know the solution, but sometimes getting there can be a real pain in the, ah, hiney.

Hope you figure out your problem.

Ranneh
 

Roger J Carlson

Moderator In Name Only
Super Member
Registered
Joined
Feb 19, 2005
Messages
12,799
Reaction score
2,500
Location
West Michigan
bkrrh85 said:
Roger--

Yippee!! I got it!! I actually read (I know...) part of your Word Freq. doc and did the macro thing.

The only thing was, even though I made the changes in the security setting, I had to restart my computer for it take effect (I'm slowly getting used to that to enable/disenable things). You may want to add that to your handy macro security sheet.

BTW, when I restarted the computer, now the enable/disable macros comes up with every screen. Is that because I changed the security setting, and will it always come up even if I click on disable for a certain program?

Thanks! The program is COOLY AWESOME!!! Oh, one last question, the "closest proximity" column--does that mean how close that word is to the last time it was used?

Ranneh
Well, this is something of an experiment for me. Normally, I develop applications in MS Access. It is a much more robust development environment, but not everyone has it. I figured everyone who uses Word HAS Word, so that was the best way to do it. I'm still discovering glitches like we've seen here and I am very interested in any reported problems.

It will continue to ask you to enable/disable macros until you change your setting back to High. I don't know if you will have to reboot or not. It would be interesting to know. If enabling the macros is a hassle, you might want to set it back to High and only set it to Medium when you want to run this program. I wouldn't set it to Low because you might forget to set it back.

The "closest proximity" is the shortest distance (in number of words) between ANY consecutive pair of the word. It doesn't matter where it occurs. You can use the Find feature to find every instance of it. In fact, a better thing would be to use Find and Replace to replace every instance of the word with the same word highlighted in yellow (or some such). Then go to Print Preview and change the size to 25%. Then you can scan through the pages in the document to see where they all occur.

I've got ideas for a couple of other programs that might be helpful, but I'd be grateful for suggestions. I don't guarantee I'll do it, but if anyone has any ideas, let me know.
 

Roger J Carlson

Moderator In Name Only
Super Member
Registered
Joined
Feb 19, 2005
Messages
12,799
Reaction score
2,500
Location
West Michigan
stace001 said:
Roger,

I have read all of the posts here, and followed their directions (and yours) but it keeps coming up as a "read only" document. I'm about to throw the computer out the closest window!! What am i doing wrong? I'm not a complete idiot when it comes to computers, but this program is going to get me there fast.
Hmmm... This is unusual. Is the WordFrequency.doc document itself Read-Only? It shouldn't really matter because the program should still run.

Have you tried running the program? Does it work? If not, what exactly happens (or doesn't happen) and what exact steps are you taking?

You can see how ranneh91 described her problem. With that level of detail, I was easily able to see the problem.
 

HConn

Whore for genre
Super Member
Registered
Joined
Feb 12, 2005
Messages
814
Reaction score
182
Location
Inside a cursed painting
Website
www.harryjconnolly.com
I guess I'm a moron, because I have a pretty basic question: How does this help?

It sounds like a cool trick, but I don't understand why it's useful. Would someone please explain it?
 
Status
Not open for further replies.