forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


word count and not string count

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Other Product Support/Announcements
View previous topic :: View next topic  
Author Message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Tue Dec 13, 2005 1:55 pm    Post subject: word count and not string count Reply with quote

dr dread,

i need your help with string.dll ... i have a file that contains 'driving lesson' and 'driving lessons' ... i need to count the number of times each is used ... the problem i come across using string.dll is that when i do a count for 'driving lesson', it also counts the number of times 'driving lessons' occurs because 'driving lessons' contains 'driving lesson' as i am using the string count part of string.dll ... i can't find a way for a word count

is there an easy way for me to be able to get the correct count for 'driving lesson' and 'driving lessons' separately using string.dll?

thanks in advance

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Tue Dec 13, 2005 2:16 pm    Post subject: Reply with quote

Have you tried something like this:

count "driving lesson"
count "driving lessons"
subtract second count from first, then I guess you should have the real count of "driving lesson".

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Wed Dec 14, 2005 12:34 am    Post subject: Reply with quote

i take it from your answer that there is no way easy way to do it ... the example i gave you is a very simplified version and i thought of doing a take away but given the way the code is written, this will be very difficult to do as the code does word counts for all sorts of other things as well

thanks for your answer, i will have to think of a work around

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Wed Dec 14, 2005 3:15 am    Post subject: Reply with quote

Any chance you can look for the words with a space after them?
Like "driving lesson " and "driving lessons "

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Dec 14, 2005 7:25 am    Post subject: Reply with quote

Serge wrote:
i take it from your answer that there is no way easy way to do it ...


If by easy you mean pre-made function, then no.

Serge wrote:
the example i gave you is a very simplified version


Well, if you want to do complex stuff, then my advice would be the same as always in these situations - use the force.
The force being a regular expression.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Wed Dec 14, 2005 8:35 am    Post subject: Reply with quote

Quote:
Any chance you can look for the words with a space after them?
Like "driving lesson " and "driving lessons "


i thought of that too but the program does word counts in web pages and some words will not have a space after them but punctuation eg. 'driving lesson.'

Quote:
If by easy you mean pre-made function


that is exactly what i was after and thought that may be i missed something in the help file that would enable me to do that

never mind, i will try and use the force eg. try and susbstitute all punctuations with a space and then look for "driving lesson "

string.dll is still a fantastic piece of work and thanks for bringing it out for us to use Very Happy Very Happy Very Happy

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Wed Dec 14, 2005 11:42 am    Post subject: Reply with quote

Actually there's no need to do any replacements.

Use a loop with RegxFind and a counter
Change the RegxFind starting pos for each loop, so you start behind the latest match
Regx has a nice word boundary operator \b so use a RegEx like \bdriving lesson\b

That should do the trick.

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Wed Dec 14, 2005 2:52 pm    Post subject: Reply with quote

i will give that a try ... i am pulling what is left of my hair at the moment as the workaround i impleted only works some of the time and i can't work out why ... ggrr!!!

thanks for that

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Thu Dec 15, 2005 9:11 am    Post subject: Reply with quote

dr dread,

you are a legend Very Happy Very Happy Very Happy

your tip is just what i needed and i don't have to try and find a work around ... i can now keep my hair a bit longer

thanks Very Happy Very Happy Very Happy

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Fri Dec 16, 2005 9:03 am    Post subject: Reply with quote

Great.

Perhaps start working more with RegExes - they can be a bit hairy so possibly you could even add
to your hair growth Laughing

Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Fri Dec 16, 2005 9:10 am    Post subject: Reply with quote

will do Very Happy

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Other Product Support/Announcements All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group