Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2462
| From | Albert Retey <awnl@gmx-topmail.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Count Ouccrence of words in a long text |
| Date | 2011-05-18 11:18 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <ir09up$25b$1@smc.vnet.net> (permalink) |
| References | <iqtn8n$ilc$1@smc.vnet.net> |
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
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
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
csiph-web