#Sales Offer!| Get upto 25% Off:

Task 1: English to Hajanian word
Write a function english_word_to_hajanian(word) that converts a given English word word (type
string) into a Hajanian word following the rules given above. You can assume the English word given is
always in lowercase, and only one rule will be applied per word in the order provided in the outline.
Task 2: Hajanian to English word
Write a function hajanian_word_to_english(word) that converts a given Hajanian word word (type
string) into an English word following the rules given above. Because words “hana” and “hami” could
be converted from multiple English words, for simplicity we will convert to “he” and “his”, respectively
(e.g., all “hana” words are converted to “he”). You can assume the Hajanian word given is always in
lowercase, and only one rule will be applied per word in the order provided in the outline.
Task 3: Valid word filtering
An input sentence by a user may contains typos or punctuations, which would cause a lot of error in
translations. To overcome this problem, the first task is to create a dictionary and filter invalid words.
Write a function valid_words(dictionary, sentence) which takes in a string of English words
dictionary (type string) and sentence (type string), and returns a list of words (type list) that filters
invalid words in sentence (i.e., words not in dictionary).
For example, dictionary string “a aa apple banana pear strawberry mango” and sentence string
“hello mango and banana yum apple!” would result in a list of strings [“mango”, “banana”]. Note that
“apple!” isn’t matched as a valid word due to the exclamation mark being part of the word. If the
dictionary is empty, then no valid words are matched.
Task 4: Beautify sentence
As you would have noticed in Task 3 above, punctuations can lead to filtering valid words (e.g.,
“apple!” for example above). In this task, write a function beautify_sentence(sentence,
punctuation) which returns a new sentence that removes all the specified punctuations from words
(words are separated by white space).
For example, sentence “?hello !mango! and, ban,ana yum apple!” with punctuation “?!,” would result
in returning a string “hello mango and ban,ana yum apple”.
Notice that “ban,ana” still contains comma, as this function only remove trailing punctuation letters.
Task 5: Translating sentences
This task translates English to Hajanian, and Hajanian to English using functions developed in above
tasks. So, write a function translate(sentence, dictionary, punctuation, language) that
translates the given sentence to the other language specified in language (e.g., if language is
“english”, then translate sentence to Hajanian, and vice versa). You should remember to beautify the
sentence by removing punctuations specified in punctuation. Finally, reconstruct the sentence of
translated sentence. If an invalid language is given, the function prints “invalid language.” and returns
an empty string (i.e., “”).
For example, we have the following:
sentence = “?hello boolean bring, !mango! and, country ban,ana wish yum apple!”
dictionary = “a aa apple banana pear strawberry mango country wish boolean bring”
punctuation = “?!,”
language = “english”

Found something interesting ?

• On-time delivery guarantee
• PhD-level professional writers
• Free Plagiarism Report

• 100% money-back guarantee
• Absolute Privacy & Confidentiality
• High Quality custom-written papers

Related Model Questions

Feel free to peruse our college and university model questions. If any our our assignment tasks interests you, click to place your order. Every paper is written by our professional essay writers from scratch to avoid plagiarism. We guarantee highest quality of work besides delivering your paper on time.

Grab your Discount!

25% Coupon Code: SAVE25
get 25% !!