Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
counting words

Subject: counting words

From: Laila Hayat

Date: 23 Oct, 2012 21:30:09

Message: 1 of 6

I am unable to count total number of words in a text image plz some 1 help by providing code how to count total number of words plz reply as soon as possible thanx

Subject: counting words

From: Ryan

Date: 24 Oct, 2012 04:55:08

Message: 2 of 6

Take a look at these links:
http://www.mathworks.com/matlabcentral/fileexchange/19505-wordcount

http://www.mathworks.com/help/bioinfo/ref/seqwordcount.html

http://www.mathworks.com/matlabcentral/newsreader/view_thread/2257



"Laila Hayat" wrote in message <k67291$n4c$1@newscl01ah.mathworks.com>...
> I am unable to count total number of words in a text image plz some 1 help by providing code how to count total number of words plz reply as soon as possible thanx

Subject: counting words

From: Laila Hayat

Date: 24 Oct, 2012 07:23:07

Message: 3 of 6

"Ryan" wrote in message <k67sbc$iu6$1@newscl01ah.mathworks.com>...
> Take a look at these links:
> http://www.mathworks.com/matlabcentral/fileexchange/19505-wordcount
>
> http://www.mathworks.com/help/bioinfo/ref/seqwordcount.html
>
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/2257
>
>
>
> "Laila Hayat" wrote in message <k67291$n4c$1@newscl01ah.mathworks.com>...
> > I am unable to count total number of words in a text image plz some 1 help by providing code how to count total number of words plz reply as soon as possible thanx
.
thanx again but i already have viewed these page last like shows counting characters in same mannar i have to count words instead of characters
eg. i am a human, i eat all kind of food. i love my country
in this sentense i need to count words and answer must be 14
regards

Subject: counting words

From: Ryan

Date: 24 Oct, 2012 14:14:09

Message: 4 of 6

What about something like this:
seqwordcount('i am a human, i eat all kind of food. i love my country',' ') + 1

ans = 14

I don't have Matlab installed on my office machine, so I can't test this.

Also, take a look at this:
http://www.mathworks.com/matlabcentral/fileexchange/27184-allwords


"Laila Hayat" wrote in message <k6850r$h70$1@newscl01ah.mathworks.com>...
> "Ryan" wrote in message <k67sbc$iu6$1@newscl01ah.mathworks.com>...
> > Take a look at these links:
> > http://www.mathworks.com/matlabcentral/fileexchange/19505-wordcount
> >
> > http://www.mathworks.com/help/bioinfo/ref/seqwordcount.html
> >
> > http://www.mathworks.com/matlabcentral/newsreader/view_thread/2257
> >
> >
> >
> > "Laila Hayat" wrote in message <k67291$n4c$1@newscl01ah.mathworks.com>...
> > > I am unable to count total number of words in a text image plz some 1 help by providing code how to count total number of words plz reply as soon as possible thanx
> .
> thanx again but i already have viewed these page last like shows counting characters in same mannar i have to count words instead of characters
> eg. i am a human, i eat all kind of food. i love my country
> in this sentense i need to count words and answer must be 14
> regards

Subject: counting words

From: Lucio Cetto

Date: 24 Oct, 2012 18:23:08

Message: 5 of 6

I think regexp is better suited for this task;

 numel(regexp('i am a human, i eat all kind of food. i love my country','\w+'))

HTH
L.

Subject: counting words

From: Ryan

Date: 25 Oct, 2012 04:02:08

Message: 6 of 6

Good one, Lucio! I totally forgot about Regex.
That's a notch better than my solution! Maybe a bit more eloquent too!!

"Lucio Cetto" wrote in message <k69bmb$c2m$1@newscl01ah.mathworks.com>...
> I think regexp is better suited for this task;
>
> numel(regexp('i am a human, i eat all kind of food. i love my country','\w+'))
>
> HTH
> L.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us