Here's my version of the simple compression of a poem extract (it's almost but not quite the same as the given solution):
Activity 26
Now try coding this short extract from a poem by Wendy Cope (1992) by suggesting a dictionary and then encoding the extract:
I am a poet.
I am very fond of bananas.
I am bananas.
I am very fond of a poet.
I am a poet of bananas.
I am very fond.
(a) Build up a dictionary:
Code | Word(s) |
1 | I am |
2 | a poet |
3 | very fond |
4 | bananas |
5 | of |
(b) Encode the poem extract:
1 2.
1 3 5 4.
1 4.
1 3 5 2.
1 2 5 4.
1 3.
No comments:
Post a Comment