Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the C programming language to write the first phase of a keyword-incontext utility. The input file has a version number (for this assignment the

Use the C programming language to write the first phase of a keyword-incontext utility.

The input file has a version number (for this assignment the version is 1), followed by a line with ::. There then follow the list of exclusion words, one word per line, which list it itself ended with another ::. Lastly the remainder of the file is made up of the lines-for-indexing of which the KWIC index will constructed for that file. Each line in the output contains text based on one line-for-indexing of the input with exactly one word capitalized. When reading the output line-by-line (i.e., from top to the bottom) the capitalized words are in alphabetical order. Some lines-for-indexing appear more than once in the output as they have more than one indexed word. And as mentioned earlier in the assignment, the problem for A#1 has been simplified in that no line-number references appear in the output.

Read stdin line by line and processing each line appropriately.

Read and store exclusion words.

Read and store lines-for-indexing

Create the output index by using

Create and use arrays in a non-trivial array.

Use the -std=c99 flag when compiling to ensure your code meets the ISO/IEC 9899:1999 standard for C.

a) All input files will be KWIC version 1 files. b) At most 20 exclusion words will appear in an input file, and each word will be no more than 20 characters in length. It is possible that there are no exclusion words. Ignore any duplication in exclusion words. c) At most 100 lines-for-indexing will appear in an input file, and each line is less than 70 characters in length. d) Amongst all lines-for-indexing, there will be at most 100 distinct indexed words (i.e., if you count capitalized words an eliminate duplicates, there will be at most 100 such words). e) Indexed words will appear at most once in any line-for-indexing. f) All lines-for-indexing will be in lower case; words are separated by single spaces; and there is no punctuation. g) Decimal numbers are treated as indexed words; use lexicographic (i.e., alphabetical) ordering for determining where line-for-indexing containing such a word should appear in the output. h) If an indexed word appears in more than one line-for-indexing, print the lines in the order they appear in the input.

An inpute file txt to use:

1 :: die auf dem und mit der in bei ihr zu am den einem dessen einen ihrer ihren :: die konsulin buddenbrook neben ihrer schwiegermutter auf dem geradlinigen weiss lackierten und mit einem goldenen loewenkopf verzierten sofa dessen polster hellgelb ueberzogen waren warf einen blick auf ihren gatten der in einem armsessel bei ihr sass und kam ihrer kleinen tochter zu hilfe die der grossvater am fenster auf den knien hielt 

The output the inputfile needs to produce and match:

blick auf ihren gatten der in einem ARMSESSEL bei ihr sass und kam BLICK auf ihren gatten der in einem armsessel bei ihr sass und kam die konsulin BUDDENBROOK neben ihrer schwiegermutter auf dem ihrer kleinen tochter zu hilfe die der grossvater am FENSTER auf den blick auf ihren GATTEN der in einem armsessel bei ihr sass und kam GERADLINIGEN weiss lackierten und mit einem goldenen loewenkopf geradlinigen weiss lackierten und mit einem GOLDENEN loewenkopf ihrer kleinen tochter zu hilfe die der GROSSVATER am fenster auf den verzierten sofa dessen polster HELLGELB ueberzogen waren warf einen knien HIELT ihrer kleinen tochter zu HILFE die der grossvater am fenster auf den blick auf ihren gatten der in einem armsessel bei ihr sass und KAM ihrer KLEINEN tochter zu hilfe die der grossvater am fenster auf den KNIEN hielt die KONSULIN buddenbrook neben ihrer schwiegermutter auf dem geradlinigen weiss LACKIERTEN und mit einem goldenen loewenkopf geradlinigen weiss lackierten und mit einem goldenen LOEWENKOPF die konsulin buddenbrook NEBEN ihrer schwiegermutter auf dem verzierten sofa dessen POLSTER hellgelb ueberzogen waren warf einen blick auf ihren gatten der in einem armsessel bei ihr SASS und kam die konsulin buddenbrook neben ihrer SCHWIEGERMUTTER auf dem verzierten SOFA dessen polster hellgelb ueberzogen waren warf einen ihrer kleinen TOCHTER zu hilfe die der grossvater am fenster auf den verzierten sofa dessen polster hellgelb UEBERZOGEN waren warf einen VERZIERTEN sofa dessen polster hellgelb ueberzogen waren warf einen verzierten sofa dessen polster hellgelb ueberzogen WAREN warf einen verzierten sofa dessen polster hellgelb ueberzogen waren WARF einen geradlinigen WEISS lackierten und mit einem goldenen loewenkopf 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

Students also viewed these Databases questions

Question

13. Identify the refusal of the return in Dances with Wolves.

Answered: 1 week ago

Question

Know the components of a position description

Answered: 1 week ago

Question

Explain the value of a true open-door policy

Answered: 1 week ago