120 likes | 294 Views
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
E N D
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)
Disadvantages
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
Advantages
Changes in algorithms and data representation in individual components don't affect other components.
More reuse support.
Drawbacks
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
Advantages
Supports functional enhancements.
Changes to data don't affect computation.
Supports reuse.
Drawbacks
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 reuse.
Supports addition of functionality.
Supports modifications.
Drawbacks
Virtualy impossible to support an interactive system.
Inefficient use of space - each filter must copy all data to its output.
12. Comparison