In article <aEP6h.23047$E02.9643 (AT) newsb (DOT) telia.net>, "Newzad Hirorî"
<nhirori (AT) hotmail (DOT) com> wrote:
Quote:
Dear all,
Would somebody help me to let FM 5.5 (on WinXP) count for me the number and
frequency of words (and eventually letters also) in a text file?
Thank in advance |
In a Text "file" or Text field???
For a Text file, it would probably be easier to use the Word Count
feature in Microsoft Word. There's no doubt already a piece of
shareware / freeware around that will do both the counting and
frequency calculations for you.
For a Text field in a FileMaker database, then counting the words and
letters is fairly easy.
Count_of_Words = WordCount(TextField)
Count_of_Letters = Length(TextField)
BUT this letter count won't be just letters, but will also include
spaces, commas, fullstops / periods, quote marks, appostrophes,
question marks, exclamation marks, etc. You can remove these from the
count by using the PatternCount function.
eg.
Count_of_Letters
= Length(TextField) - PatternCount(TextField, " ")
- PatternCount(TextField, ",")
- PatternCount(TextField, ".")
- PatternCount(TextField, "'")
- PatternCount(TextField, "?")
- PatternCount(TextField, "!")
You may also need to run a couple of tests to see what WordCount does
with hyphenated words - I'm not sure if those are counted as one word
or two. You can get around it counting as two by temporarily replacing
them with "nothing".
ie.
Count_of_Words = WordCount(Substitute(TetxField, "-", ""))
The frequency of words will be more difficult. You'd have to split the
text into separate words and then count or summarise (using Summary
functions) the number of each ... it is possible, but would require a
script and preferrably a separate table. It could get quite time
consuming too if you're trying to summarise lots of records and / or
large amounts of text.
Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)