Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ii:labs:s2:01:tasks:04 [2023/03/18 20:17]
florin.stancu created
ii:labs:s2:01:tasks:04 [2024/03/15 13:30] (current)
florin.stancu [04. [20p] Word Map]
Line 1: Line 1:
-==== 04. Word Map ====+==== 04. [25p] Word Map ====
  
-First, take a couple (3-4) of paragraphs [[https://​www.gutenberg.org/​files/​2701/​2701-h/​2701-h.htm#​link2HCH0001|from here]] and put them inside a Python string (multiline).+First, take a couple (3-4) of paragraphs [[https://​www.gutenberg.org/​files/​2701/​2701-h/​2701-h.htm#​link2HCH0001|from here]] and store them inside a ''​.txt''​ file.
  
-  * Build a ''​dict''​ with each word from this text (lower cased as key), counting their frequency (as its value).+  ​* Open the file and read its contents into string; 
 +  ​* Build a ''​dict''​ with each word from this text (lower cased as key), counting their frequency (as its value);
   * Use it to print out the most frequent 5 words in this text (together with their value!), e.g.:   * Use it to print out the most frequent 5 words in this text (together with their value!), e.g.:
 <​code>​ <​code>​
ii/labs/s2/01/tasks/04.1679163426.txt.gz · Last modified: 2023/03/18 20:17 by florin.stancu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0