Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2424 > unrolled thread

Count Ouccrence of words in a long text

Started byYako <yako@11y11.com>
First post2011-05-17 11:47 +0000
Last post2011-05-18 11:18 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Count Ouccrence of words in a long text Yako <yako@11y11.com> - 2011-05-17 11:47 +0000
    Re: Count Ouccrence of words in a long text Albert Retey <awnl@gmx-topmail.de> - 2011-05-18 11:18 +0000

#2424 — Count Ouccrence of words in a long text

FromYako <yako@11y11.com>
Date2011-05-17 11:47 +0000
SubjectCount Ouccrence of words in a long text
Message-ID<iqtn8n$ilc$1@smc.vnet.net>
Hello,

First of all I am pretty new to Mathematica, so excuse me if this has
a simple answer.

What I need is to be able to count the occurrence of each word of a
text and count the times each word appears on it. I know how to do
this on other languages but I am trying to achieve it with
mathematica.

Can someone hint me the way to go?

Thanks!

[toc] | [next] | [standalone]


#2462

FromAlbert Retey <awnl@gmx-topmail.de>
Date2011-05-18 11:18 +0000
Message-ID<ir09up$25b$1@smc.vnet.net>
In reply to#2424
Hi,

> First of all I am pretty new to Mathematica, so excuse me if this has
> a simple answer.
>
> What I need is to be able to count the occurrence of each word of a
> text and count the times each word appears on it. I know how to do
> this on other languages but I am trying to achieve it with
> mathematica.
>
> Can someone hint me the way to go?

I think there might be languages that are better suited for this kind of 
tasks, especially if the text becomes _really_ long. Anyway, it is 
fairly easy in Mathematica and resonable fast, too:

text = Import["ExampleData/USConstitution.txt"];
words = StringCases[text, WordCharacter ..];
Tally[words]


hth,

albert

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web