Quickstart

From RL3 Wiki
Jump to: navigation, search

Create a simple RL3 module file simple.rl3 and edit it:

annotation
    number=$$
search text
    {number}
if
    true

This code defines a simple annotation with the name number which annotates all numbers (using a built-in pattern {number}) in an input fact with the name text.

Compile the file:

$ rl3c simple.rl3

Thus, a binary model will be created and stored in a file with the default name output.rl3c.

Now, create a text file test.txt for testing:

abc
123
def 456 ggg

Run the binary model against the test file:

$ rl3run --model output.rl3c --input test.txt --type text

You will get the following output:

{"label":"number","value":"123","weight":1.0,"start":4,"end":7}
{"label":"number","value":"456","weight":1.0,"start":12,"end":15}