![]() |
lx example |
This is a simplish example for the use of lx. It is much smaller than the lxt application, so it is easier to see how it works and how lx is used.
The example program generates a kwic (key word in context) listing for a text. It optionally allows a stop list and a word-form list to be run against the text.
Here is the program source. The program is included with the lx source, and can be compiled from the lx src directory by typing "make kwic" (after running "./Configure").
The usage is:
kwic [-s stoplist] [-f formslist] inputfile
Output (to standard out) looks like:
5 easy under the appleboughs About the lilting house and 15 carefree famous among barns About the happy yard and 6 was green The night above the dingle starry Time 36 all Shining it was Adam and maiden The sky 39 it must have been after the birth of the 37 maiden The sky gathered again And the sun grew 25 the chimneys it was air And playing lovely and 49 blue trades that time allows In all his tuneful 56 the moon that is always rising Nor that riding 9 his eyes and honoured among wagons I was prince [...]