FastTrain comment

Welcome Forums General PowerShell Q&A FastTrain comment

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
  • #6141

    Points: 0
    Rank: Member

    by yooakim at 2012-08-18 04:38:15

    I really like your book! I have a minor question about the examples used for SlowTraing and FastTrain. in the loop there is this line:

    $h[$word] += ''

    Wouldn't it make more sense to use this instead?

    $h[$word] += 1

    this would store the Count of occurrences for each word.


    by DougFinke at 2012-08-18 05:20:58

    Thanks for getting the book Joakim. I'm glad you like it.

    Really good question about the PowerShell Spelling Corrector.

    My intention was to create a list of unique words that I could quickly look up. Knowing the number of occurrences of each word is not something that is needed for the spelling corrector application.

    You've hit on the next step!
    That PowerShell function is easily re-purposed and changed to do what you are suggesting.

    Now you have a function that can take the content of any string or text file and it will count the number of occurrences of each word.

    Thanks again for the great question.


The topic ‘FastTrain comment’ is closed to new replies.