SWATH(1) | General Commands Manual | SWATH(1) |
swath - General-purpose Thai word segmentation utility
swath [options] < infile > outfile
Thai script has no word delimitor. Applications need to recognize word boundaries before they can do useful things with Thai text, such as line wrapping.
Swath provides word analysis filter to insert word delimitors into a given text stream. It reads text from standard input, analyzes it for word boundaries by consulting a Thai word list, and outputs to standard output the same text with the predefined word delimitors inserted.
Currently, it can read plain text, HTML, RTF, LaTeX and Lambda (Unicode version of LaTeX with Omega typesetter kernel) documents and insert common word delimitors for each format (pipe `|' for plain text). But user can always override this with a preferred delimitor.
If this option is given, swath will override normal dictionary search and will exit if the given dictionary cannot be found. Otherwise, if SWATHDICT environment is set, it will try to open dictionary from the location specified by its value. Otherwise, it will try the current working directory, and finally the usual installed location.
For LaTeX (to be used with babel-thai package):
$ swath -f latex < thaifile.tex > thaifile.ttex
$ latex thaifile.ttex
For HTML (to provide web pages to web browsers that cannot wrap Thai lines properly, but support the <wbr> tag):
$ swath -f html < myweb.html > myweb-wbr.html
To preprocess a Thai UTF-8 encoded LaTeX file for babel-thai with tis620 inputenc:
$ swath -f latex -u u,t < thaifile.tex >
thaifile.ttex
$ latex thaifile.ttex
This is equivalent to filtering with iconv(1):
$ iconv -f UTF-8 -t TIS-620 thaifile.tex | swath -f
latex > thaifile.ttex
$ latex thaifile.ttex
To use longest matching scheme with LaTeX document:
$ swath -f latex -m long < thaifile.tex >
thaifile.ttex
$ latex thaifile.ttex
To use an alternative dictionary from libthai:
$ swath -f latex -d /usr/share/libthai/thbrk.tri < thaifile.tex > thaifile.ttex
This manual page was written by Theppitak Karoonboonyanan <theppitak@gmail.com>.
January 2008 |