run.md 2.93 KB
Newer Older
Bruno Guillaume's avatar
Bruno Guillaume committed
1 2 3 4 5 6 7 8 9
+++
Description = ""
date = "2017-02-28T14:58:11+01:00"
title = "run"
menu = "main"
Categories = ["Development","GoLang"]
Tags = ["Development","golang"]
+++

10
The command to run **Grew** is: `grew <subcommand> [<args>]`
Bruno Guillaume's avatar
Bruno Guillaume committed
11

12
Available subcommands are:
Bruno Guillaume's avatar
Bruno Guillaume committed
13

14 15 16 17 18 19
  * `transform`: **Grew** transform mode, see below
  * `grep`: **Grew** grep mode, see below
  * `gui`: **Grew** GTK interface, see below
  * `version`:    Print current version number
  * `help`: Print help
  * `help <sub>`:  Print help for the given subcommand
Bruno Guillaume's avatar
Bruno Guillaume committed
20

21
---
Bruno Guillaume's avatar
Bruno Guillaume committed
22

23
# Transform mode
Bruno Guillaume's avatar
Bruno Guillaume committed
24

25
In this mode, **Grew** apply a Graph Rewrinting System to a graph of a set of graphs.
Bruno Guillaume's avatar
Bruno Guillaume committed
26

27
The full command for this mode:
Bruno Guillaume's avatar
Bruno Guillaume committed
28

29
`grew transform -grs <grs_file> -i <input_file> -o <output_file>`
Bruno Guillaume's avatar
Bruno Guillaume committed
30

31
Required arguments for this mode are:
Bruno Guillaume's avatar
Bruno Guillaume committed
32

33
where:
Bruno Guillaume's avatar
Bruno Guillaume committed
34

35 36 37
 * `<grs_file>` is the main file which describes Graph Rewriting System
 * `<input_file>`: describes the input data (CONLL file of gr file)
 * `<output_file>`: is the name of the output file (CONLL file)
Bruno Guillaume's avatar
Bruno Guillaume committed
38

39
Optional argument is:
Bruno Guillaume's avatar
Bruno Guillaume committed
40

41
 * `-strat <name>`: the strategy used in transformation (default value: `main`)
Bruno Guillaume's avatar
Bruno Guillaume committed
42

43
---
Bruno Guillaume's avatar
Bruno Guillaume committed
44

45
# Grep mode
Bruno Guillaume's avatar
Bruno Guillaume committed
46 47 48 49

This mode corresponds to the command line version of the [Online graph matching](http://grew.loria.fr/demo) tool.
The command is:

50
`grew grep -pattern <pattern_file> -node_id <id> -i <corpus_file>`
Bruno Guillaume's avatar
Bruno Guillaume committed
51 52 53 54 55 56 57 58 59

where:

  * `<pattern_file>` is a file which describes a pattern
  * `<id>` is the name of a node identifier declared in the pattern
  * `<corpus_file>` is the corpus in which the search is done

The output is a list of lines, one for each occurrence of the pattern in the corpus.

60
## Example
Bruno Guillaume's avatar
Bruno Guillaume committed
61 62 63 64

With the following files:

 * The surface sequoia version 7.0: `sequoia.surf.conll` ([Download](https://gitlab.inria.fr/sequoia/deep-sequoia/raw/master/tags/sequoia-7.0/sequoia.surf.conll)),
65
 * A pattern file with the code below: `subcat.pat` ([Download](https://gitlab.inria.fr/grew/grew_doc/raw/master/static/examples/grep/subcat.pat))
Bruno Guillaume's avatar
Bruno Guillaume committed
66 67

```
68
pattern {
Bruno Guillaume's avatar
Bruno Guillaume committed
69 70 71 72 73 74 75 76
  V [cat=V];
  V -[a_obj]-> A;
  V -[de_obj]-> DE;
}
```

The command:

77
`grew grep -pattern subcat.pat -node_id V -i sequoia.surf.conll`
Bruno Guillaume's avatar
Bruno Guillaume committed
78 79 80 81 82 83 84 85 86 87 88 89

produces the following output:

```
annodis.er_00040	41
annodis.er_00240	12
annodis.er_00441	14
emea-fr-test_00438	19
emea-fr-test_00478	31
Europar.550_00496	14
```

90 91 92 93 94 95 96 97 98 99 100 101 102
This means that the pattern described in the file `subcat.pat` was found 6 times in the corpus, each line gives the sentence identifier and the position of node matched by the node `V` of the pattern.

# GTK interface

The command to run the GTK interface: `grew gui <args>`.
It supposes that you have installed the `grew_gui` opam packages (see [option 2 in Installation page](../installation#option-2-installation-of-the-gtk-interface)).

Optional arguments:

 * `-grs <grs_file>`: load the given file
 * `-i <input_file>`: input data (graph or corpus) loaded in GUI
 * `-strat <name>`: the strategy selected in the interface (default: `main`)
 * `-main_feat <feat_name_list>` set the list of feature names used ad the *main* feat in graph visualisation