Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Given a KWIC, return a string that is formatted for
- # pretty printing.
- def prettyPrintKWIC(kwic):
- n = len(kwic)
- keyindex = n // 2
- width = 10
- outstring = ' '.join(kwic[:keyindex]).rjust(width*keyindex)
- outstring += str(kwic[keyindex]).center(len(kwic[keyindex])+6)
- outstring += ' '.join(kwic[(keyindex+1):])
- return outstring
Add Comment
Please, Sign In to add comment