## Algorithm for KWIC

hello

i am trying to understand Key word in context (KWIC) algorithm with given example but i am confuse so anybody help me to understand this algorithm with below given example?

1. [Establish loop in which keyword are used as index word]
Repeat through step 5 for i=1,2.....LAST KEY

2. [Obtain index list for current keyword]
KEYSTRING <-- T_INDEX[i] concate with space

3. [Process all title indices in KEYSTRING]
Repeat through step 5 while LENGTH(KEYSTRING) >1

4. [Obtain and delete next title index]
INDEX_NO <-- SUB (KEYSTRING,1,INDEX(KEYSTRING, 'space') -1)
KEYSTRING <-- SUB (KEYSTRING , INDEX (KEYSTRING, 'space') +1)

5. [Obtain and output KWIC line]
KWIC_LINE <-- TITLE [INDEX_NO]
CURSOR < -- 1
if FIND (KWIC_LINE , KEYWORD [i], CURSOR, MATCH_STR) then
KWIC_LINE <-- KEYWORD [i] concate SUB (KWIC_LINE, CURSOR) concate 'space' concate MATCH_STR
Write (KWIC_LINE)
else
Write ('Error')

6. [Finished]
Return

in above algorithm concate means round sign in algorithmic notion n space means it concate with putting space in between sentence
In 5 th step, with if condition FIND is another algorithm...
can explain with any simple example?