git @ Cat's Eye Technologies Lexeduct / c41b555
Update the README. Chris Pressey 6 years ago
1 changed file(s) with 23 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
00 Lexeduct
11 ========
22
3 **Lexeduct** is an experimental framework for text-processing pipelines, written
4 in Javascript, usable in both node and in the browser (knock on wood.)
3 > "this is not a wheel I've re-invented before"
54
6 It is currently at a *what is this I don't even* stage of development. The
7 framework and usage and everything is subject to change without notice.
5 **Lexeduct** is an experimental framework for text-processing pipelines,
6 written in Javascript, usable both on the console under [Node.js][], and
7 in a web browser.
8
9 It is currently a work in progress. The framework and usage and everything
10 is subject to change without notice. The version number is nominally 0.1-PRE;
11 there is not yet a released version.
812
913 Being a framework, Lexeduct inevitably handles some use cases well, and other
10 use cases poorly. Don't expect too much from it. More details here soon.
14 use cases poorly. See the "Limitations" section below for more details.
1115
1216 The name "Lexeduct" is in analogy with "aqueduct": conduits for words intead
1317 of water.
1721
1822 The main tool is `lexeduct.js`. You can `cd` into the `src` directory and run
1923 it as `./lexeduct.js`, or you can put the `src` directory on your executable
20 search path (e.g. `export PATH=$PATH:/path/to/lexeduct/src`) and run it as
21 `lexeduct.js` from anywhere on your system. (YMMV on Windows.)
24 search path, for example like
25
26 export PATH=$PATH:/path/to/lexeduct/src
27
28 and run it as `lexeduct.js` from anywhere on your system. (YMMV on Windows.)
2229
2330 The basic usage is
2431
3037 HELLO
3138
3239 Parameters can be given with the syntax `name=value` before the name of the
33 transformer they are to be applied to. So, for example,
40 transformer they are to be applied to:
3441
3542 $ echo 'Hello' | lexeduct.js chars=e remove-chars
3643 Hllo
3744
3845 You can of course use shell pipelines to compose transformers:
3946
40 $ echo 'Hello!' | lexeduct.js upper | lexeduct.js 'chars= ' insert-chars
47 $ echo 'Hello!' | lexeduct.js upper | lexeduct.js chars=' ' insert-chars
4148 H E L L O !
4249
4350 *Or* you can name multiple transformers on `lexeduct.js`'s command line to
4451 compose them:
4552
46 $ echo 'Hello!' | lexeduct.js upper 'chars= ' insert-chars
53 $ echo 'Hello!' | lexeduct.js upper chars=' ' insert-chars
4754 H E L L O !
4855
4956 Multiple transformers are applied left-to-right.
5057
51 $ echo 'Hello!' | lexeduct.js 'chars=a' insert-chars upper
58 $ echo 'Hello!' | lexeduct.js chars=a insert-chars upper
5259 HAEALALAOA!A
5360
54 $ echo 'Hello!' | lexeduct.js upper 'chars=a' insert-chars
61 $ echo 'Hello!' | lexeduct.js upper chars=a insert-chars
5562 HaEaLaLaOa!a
5663
5764 Transformers
7481 simple example, see the source of the `upper` transformer, found
7582 in [src/transformers/upper.js](src/transformers/upper.js).
7683
77 `state` is an object whose members may be read or written to store ancillary
78 state. (Doing so will make it an 'impure' pipeline.)
84 State deposited into the state object is shared by all transformers, so it's
85 a good idea to choose a key that you think will probably be unique.
7986
8087 In-Browser Version
8188 ------------------
8491 a Javascript file which contains all the available transformers in a format
8592 suitable for loading in an HTML document.
8693
87 Open `demo/lexeduct.html` in your browser. It provides a UI for composing
94 Then open `demo/lexeduct.html` in your browser. It provides a UI for composing
8895 these transformers and applying them to text provided in a textarea.
8996
9097 Acknowledgements
95102 various and sundry discussion with him, and others on the
96103 [GenerativeText Forum][], particularly [John Ohno][].
97104
105 [Node.js]: https://nodejs.org/
98106 [Michael Paulukonis]: https://github.com/MichaelPaulukonis/
99107 [TextMunger]: https://github.com/MichaelPaulukonis/text-munger
100108 [GenerativeText Forum]: https://groups.google.com/forum/#!forum/generativetext