trans_14.md 1.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
+++
Description = ""
Tags = ["Development", "golang"]
Categories = ["Development", "GoLang"]
menu = "main"
+++

# Transition to version 1.4

A new version 1.4 of **Grew** will be available in the upcoming weeks with a few changes in the syntax.

For some technical reason, the [**Grew-match**](http://match.grew.fr) online tool is already based on the upcoming version and so already uses the new syntax.
The `dev` version of the **Grew** API for **Arborator-Grew** also uses the new syntax.

## Clustering on the label of an edge

With the pattern:

```grew
pattern { e: M -> N; N [upos=ADJ]}
```

Bruno Guillaume's avatar
Bruno Guillaume committed
23
if you want to cluster the result on the label of the edge `e`, the old syntax was `e`, the new one is `e.label` ([Try it!](http://match.grew.fr/?corpus=SUD_French-GSD@latest&custom=5efb883ea71fc&clustering=e.label)).
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

## Access to the label of an edge in the pattern

|Constraint | Old syntax | New syntax |
|:-----------------:|:-----------------:|:-----------------:|
| equality of two edge labels | `label(e1) = label(e2)` |  `e1.label = e2.label` |
| inequality of two edge labels | `label(e1) <> label(e2)` |  `e1.label <> e2.label` |

## Avoiding duplicate solutions

When several nodes are equivalent in a pattern, each occurrence is reported several times (up to permutation on the set of equivalent nodes).
For instance, to search for two relations `det` with the same governor, the pattern below will return twice each solution.

```grew
pattern {
  G -[det]-> D1;
  G -[det]-> D2;
}
```

To avoid this, it is possible to give an ordering constraint on some internal identifier:

 * old_syntax: `id(D1) < id (D2)`
 * new_syntax: `D1.__id__ < D2.__id__`

Bruno Guillaume's avatar
Bruno Guillaume committed
49
The complete pattern in new syntax:
50 51 52 53 54 55 56 57 58

```grew
pattern {
  G -[det]-> D1;
  G -[det]-> D2;
  D1.__id__ < D2.__id__;
}
```