HASKELL language only!!
Implement the capitaliseEachWord function that takes a sentence to capitalise the first letter of each word. Sample Run: capitaliseEachWord "some text delimited with blanks" output-> "Some Text Delimited With Blanks"
import Data.Char
import Prelude hiding (map)
map :: (a -> b) -> [a] -> [b]
map _ [] = []
map func (x : abc) = func x : map func abc
-- capitalize the word
capWords :: String -> String
capWords(head:tail) = toUpper head : map toLower tail
capWords [] = []
-- Split the words and call capWords for every word
capitalized :: String -> String
capitalized (sentence) = unwords $ map capWords $ words
sentence
capitalized [] = []
-- Main
main = do
print "Enter some text:"
recipient <- getLine
print $ capitalized recipient
HASKELL language only!! Implement the capitaliseEachWord function that takes a sentence to capitalise the first letter...
Design a DFA that takes a sentence in English and accepts the sentence if it satisfies the following conditions: • The sentence should end with a dot ".". • The first character of the sentence should be an upper letter. • Only one dot is allowed at the end of the sentence, with the exception of real numbers. • Whenever there is a comma "," or a semicolon ";" there should be exactly one space and a word that starts...
Design a DFA that takes a sentence in English and accepts the sentence if it satisfies the following conditions: • The sentence should end with a dot ".". • The first character of the sentence should be an upper letter. • Only one dot is allowed at the end of the sentence, with the exception of real numbers. • Whenever there is a comma "," or a semicolon ";" there should be exactly one space and a word that starts...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a function named capital_letter that accepts a string as an argument and checks if each word in the string begins with a capital letter. If so, the function will return true, otherwise, return false. Please see the outcome below: Outcome number 1: Enter a string: Python Is Really Fun! True Sample run number 2: Enter a string: i Love Python False Note: Try to keep this...
CODE:
def censor_words(sentence, list_of_words):
"""
The function takes a sentence and a list of words as
input.
The output is the sentence after censoring all the matching
words in the sentence.
Censoring is done by replacing each character in the censored
word with a * sign.
For example, the sentence "hello yes no", if we censor the
word yes, will become
"hello *** no"
Note: do not censor the word if it is part of a larger
word.
For example,...
Haskell Functional Programming Language: Write a function nestedParens that takes a string argument and returns true if it is a nesting of zero or more pairs of parentheses, e.g. "((()))" should return True ; "()()" or "(()))" should return False . Use recursion for this problem. nestedParens :: String -> Bool
Write a function that takes a sentence as a parameter and translates it into a Morse code message in Python. The Morse coded message should be displayed at the console in one continuous line, each Morse code sequence should be delimited by space.
I need help building a program on microsoft visual studio using c++ language. implement a program called "charword_freq.cpp" to determine the number of words and the number of occurrences of each letter in a block of text stored in a data file called “mytext.dat”. Define a word to be any string of letters that is delimited at each end by either whitespace, a period, a comma, or the beginning or end of a line. You can assume that the input...
**Must be done in Haskell** Write the following function: check :: String -> String Which takes in a string with multiple parentheses, brackets and curly brackets and check if they are correct. If they are correct output the string "Correct", and if not output "Wrong" They must only be matched against the same type, ie "({)}" should not be correct. It should not matter that the string contains other letters in it
PYTHON PLEASE Write a function to censor words from a sentence code: def censor_words(sentence, list_of_words): """ The function takes a sentence and a list of words as input. The output is the sentence after censoring all the matching words in the sentence. Censoring is done by replacing each character in the censored word with a * sign. For example, the sentence "hello yes no", if we censor the word yes, will become "hello *** no" Note: do not censor the...
Write a python3 function random_setence to implement a sentence comprised of length <=7 randomly generated words. Have this be implemented 5 times. Then let the user try and type out the sentence as fast as they can. After each successful copy of the sentence by the user, have the program sleep for a few seconds and generate a new random sentence while the user waits. Then repeat the previous 2 steps for 5 times. Finally write a function called write_results...