Haskell programme
- or -
Post a project like this£40(approx. $50)
- Posted:
- Proposals: 5
- Remote
- #1840329
- Expired
Description
Experience Level: Entry
Function name Brief description Function call example
toWordList Takes a string, lowercases it,
drops any character that is
not a letter, and returns a list
with the words in the string.
> toWordList "Hello, World! HELLO!! :-)"
["hello","hello","world"]
countCommonWords Takes a list of strings and
returns the number of times
the 20 most frequently used
English words appears in the
list.
> countCommonWords ["the","planet","of","the","apes"]
3
dropCommonWords Takes a list of strings and
drops any word that is within
the top 20 most commonly
used in English. Returns a
list of strings without those
words.
> dropCommonWords ["the","planet","of","the","apes"]
["planet","apes"]
countWords Takes a list of strings and
returns a list. Each element
of the returned list is a tuple
which contains a string (a
word) and an integer
(representing the number of
times the word appears in the
text).
> countWords ["friend","she","she"]
[("friend",1),("she",2)]
Portfolio element – Haskell
6G6Z1110 & 6G6Z1115, Dr Ivan Olier
sortWords It sorts words by their
frequency in descending
order. It takes and returns a
list of tuples. Each element
of the tuple consists of one
string (the word) and one
integer (its frequency).
> sortWords [("friend",1),("she",2)]
[("she",2),("friend",1)]
makeHistogram Makes a histogram using
asterisks. It takes a list of
tuples (string, integer) and
returns a string which
contains the histogram. It
also contains the required
line breaks (“\n”) such that it
should print the histogram as
shown in Figure 3 when
using a function like
“putStr” (see last code line,
Figure 1)
toWordList Takes a string, lowercases it,
drops any character that is
not a letter, and returns a list
with the words in the string.
> toWordList "Hello, World! HELLO!! :-)"
["hello","hello","world"]
countCommonWords Takes a list of strings and
returns the number of times
the 20 most frequently used
English words appears in the
list.
> countCommonWords ["the","planet","of","the","apes"]
3
dropCommonWords Takes a list of strings and
drops any word that is within
the top 20 most commonly
used in English. Returns a
list of strings without those
words.
> dropCommonWords ["the","planet","of","the","apes"]
["planet","apes"]
countWords Takes a list of strings and
returns a list. Each element
of the returned list is a tuple
which contains a string (a
word) and an integer
(representing the number of
times the word appears in the
text).
> countWords ["friend","she","she"]
[("friend",1),("she",2)]
Portfolio element – Haskell
6G6Z1110 & 6G6Z1115, Dr Ivan Olier
sortWords It sorts words by their
frequency in descending
order. It takes and returns a
list of tuples. Each element
of the tuple consists of one
string (the word) and one
integer (its frequency).
> sortWords [("friend",1),("she",2)]
[("she",2),("friend",1)]
makeHistogram Makes a histogram using
asterisks. It takes a list of
tuples (string, integer) and
returns a string which
contains the histogram. It
also contains the required
line breaks (“\n”) such that it
should print the histogram as
shown in Figure 3 when
using a function like
“putStr” (see last code line,
Figure 1)
Gurdev S.
100% (4)Projects Completed
3
Freelancers worked with
3
Projects awarded
25%
Last project
16 May 2018
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies