KWIC example. Input: strings, each of which consists of several words. Clouds are white.Ottawa is beautiful.Output: a sorted list of all orderings of each input string.are white Cloudsbeautiful Ottawa isClouds are whiteis beautiful OttawaOttawa is beautifulwhite Clouds are. Solution
1. KWIC example
2. KWIC example Input: strings, each of which consists of several words.
Clouds are white.
Ottawa is beautiful.
Output: a sorted list of all orderings of each input string.
are white Clouds
beautiful Ottawa is
Clouds are white
is beautiful Ottawa
Ottawa is beautiful
white Clouds are
3. Solution 1: Main Program/Subroutine
4. Solution 1: Main Program/Subroutine With shared memory
Master control calls
Input, which inputs and stores characters
CircShift, which reads characters/writes index
Alphabetize, which alphabetizes index
Output, which prints alphabetized index
5. Solution 1: Main Program/Subroutine Advantages
Efficient representation of data (since they are shared)
Changes to data format affects several modules.
Difficulty to implement changes/enhancements in the overall processing algorithm.
Don't support reuse.
6. Solution 2: Abstract Data Types
7. Solution 2: Abstract Data Types Data is not shared anymore
encapsulated in objects
Changes in algorithms and data representation in individual components don't affect other components.
More reuse support.
Changes in functionality can be difficult
might involve components modification or addition
8. Solution 3: Implicit Invocation
9. Solution 3: Implicit Invocation Calls to circular shift and alphabetizer are implicit, and are the result of inserting lines.
Data accessed abstractly
Supports functional enhancements.
Changes to data don't affect computation.
Difficult to control processing order.
Tend to use more space than other solutions.
10. Solution 4: Pipes and Filters
11. Solution 4: Pipes and Filters Advantages
Maintains intuitive flow of processing.
Supports addition of functionality.
Virtualy impossible to support an interactive system.
Inefficient use of space - each filter must copy all data to its output.