annotating text with local grammars - hal archive ouverte · 2016. 7. 21. · 2016/06/02 annotating...

43
June 2, 2016 DICORA Korea Annotating Text With Local Grammars Practical Uses Éric Laporte

Upload: others

Post on 23-Mar-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

June 2, 2016

DICORA

Korea

Annotating Text With Local Grammars Practical Uses Éric Laporte

Page 2: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 2 2016/06/02

Annotating Text

With Local Grammars

Unitex/GramLab provides tools for inserting and modifying annotations in text

How to insert annotations?

How to copy information into annotations?

Where to place annotations?

How to delete annotations?

Page 3: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Outline

Annotating Text With Local Grammars • 3 2016/06/02

Insert annotations

Copy from text to annotation

Copy from a dictionary

Annotate at the right place

Delete annotations

Page 4: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 4 2016/06/02

Inserting annotations

It worked for my mental health better than any other drug

<opinion>It worked for my mental health better than any other drug</opinion>

Box output

Page 5: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 5 2016/06/02

Inserting annotations

Check the 'Merge with input text' option of Text > Locate Pattern

By default, box outputs are ignored

It worked for my mental health better than any other drug

<opinion>It worked for my mental health better than any other drug</opinion>

Page 6: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 6 2016/06/02

Inserting annotations

Clearly distinguish annotations from the original corpus

XML tags are a good solution for that

They are delimited by < > which are rarely used in normal text

Occurrences of '<' in the original text may be replaced by &lt;

It worked for my mental health better than any other drug

<opinion>It worked for my mental health better than any other drug</opinion>

Page 7: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Outline

Annotating Text With Local Grammars • 7 2016/06/02

Insert annotations

Copy from text to annotation

Copy from a dictionary

Annotate at the right place

Delete annotations

Page 8: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 8 2016/06/02

Copy from text to annotation

It worked for me better than any other drug

<opinion>It worked for me better than any other drug<comp phrase='better'/></opinion>

Page 9: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 9 2016/06/02

Copy from text to annotation

It worked for me better than any other drug

<opinion>It worked for me better than any other drug<comp phrase='better'/></opinion>

Copy from the text to an input variable

Page 10: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 10 2016/06/02

Copy from text to annotation

It worked for me better than any other drug

<opinion>It worked for me better than any other drug<comp phrase='better'/></opinion>

Copy from the input variable into an annotation

Page 11: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 11 2016/06/02

Insert a modified copy

It worked for me better than any other drug

<opinion>It worked for me better than any other drug<content polarity='good'/></opinion>

Page 12: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 12 2016/06/02

Insert a modified copy

It worked for me better than any other drug

<opinion>It worked for me better than any other drug<content polarity='good'/></opinion>

Specify the modified copies in box outputs

Page 13: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 13 2016/06/02

Insert a modified copy

It worked for me better than any other drug

<opinion>It worked for me better than any other drug<content polarity='good'/></opinion>

Copy box outputs to an output variable

Page 14: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 14 2016/06/02

Insert a modified copy

It worked for me better than any other drug

<opinion>It worked for me better than any other drug<content polarity='good'/></opinion>

Copy from the output variable into an annotation

Page 15: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Outline

Annotating Text With Local Grammars • 15 2016/06/02

Insert annotations

Copy from text to annotation

Copy from a dictionary

Annotate at the right place

Delete annotations

Page 16: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 16 2016/06/02

Copy from a dictionary

It worked for my mental health quite poorly

<opinion>It worked for my mental health quite poorly<content polarity='bad'/></opinion>

inefficiently,.ADV+opinion+pol=bad poorly,.ADV+opinion+pol=bad satisfactorily,.ADV+opinion+pol=good

Page 17: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 17 2016/06/02

Copy from a dictionary

It worked for my mental health quite poorly

<opinion>It worked for my mental health quite poorly<content polarity='bad'/></opinion>

inefficiently,.ADV+opinion+pol=bad poorly,.ADV+opinion+pol=bad satisfactorily,.ADV+opinion+pol=good

Copy from the entries to a dictionary-entry variable

Page 18: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 18 2016/06/02

Copy from a dictionary

It worked for my mental health quite poorly

<opinion>It worked for my mental health quite poorly<content polarity='bad'/></opinion>

Copy from the dictionary-entry variable into an annotation

inefficiently,.ADV+opinion+pol=bad poorly,.ADV+opinion+pol=bad satisfactorily,.ADV+opinion+pol=good

Page 19: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 19 2016/06/02

Dictionary-entry variables

Graphs with dictionary-entry variables must be applied:

- to the text automaton

- with the 'automaton intersection' option of Locate Pattern

Page 20: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 20 2016/06/02

Dictionary-entry variables

Graphs with dictionary-entry variables must be applied:

- to the text automaton

- with the 'automaton intersection' option of Locate Pattern

Page 21: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 21 2016/06/02

Dictionary-entry variables

in the morphological mode

Graphs with dictionary-entry variables can also be applied without constructing the text automaton, but with other conventions

Page 22: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 22 2016/06/02

Dictionary-entry variables

in the morphological mode

It worked for my mental health quite poorly

<opinion>It worked for my mental health quite poorly<content polarity='bad'/></opinion>

inefficiently,.ADV+opinion+pol=bad poorly,.ADV+opinion+pol=bad satisfactorily,.ADV+opinion+pol=good

Page 23: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 23 2016/06/02

Dictionary-entry variables

in the morphological mode

Declare the dictionary among the morphological-mode dictionaries in the Info > Preferences menu

It worked for my mental health quite poorly

<opinion>It worked for my mental health quite poorly<content polarity='bad'/></opinion>

inefficiently,.ADV+opinion+pol=bad poorly,.ADV+opinion+pol=bad satisfactorily,.ADV+opinion+pol=good

Page 24: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 24 2016/06/02

Dictionary-entry variables

in the morphological mode

It worked for my mental health quite poorly

<opinion>It worked for my mental health quite poorly<content polarity='bad'/></opinion>

inefficiently,.ADV+opinion+pol=bad poorly,.ADV+opinion+pol=bad satisfactorily,.ADV+opinion+pol=good

Copy from the entries to a dictionary-entry variable

Enter the morphological mode

Page 25: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 25 2016/06/02

Dictionary-entry variables

in the morphological mode

It worked for my mental health quite poorly

<opinion>It worked for my mental health quite poorly<content polarity='bad'/></opinion>

inefficiently,.ADV+opinion+pol=bad poorly,.ADV+opinion+pol=bad satisfactorily,.ADV+opinion+pol=good

Copy from the dictionary-entry variable into an annotation

Page 26: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Outline

Annotating Text With Local Grammars • 26 2016/06/02

Insert annotations

Copy from text to annotation

Copy from a dictionary

Annotate at the right place

Delete annotations

Page 27: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 27 2016/06/02

Annotate at the right place

In XML, attributes are obligatorily placed in start tags

This implies we copy information to output in a different order than in input

It worked for me better than any other drug

<opinion>It worked for me better than any other drug<comp phrase='better'/></opinion>

It worked for me better than any other drug

<opinion phrase='better'>It worked for me better than any other drug</opinion>

attribute start tag

Page 28: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 28 2016/06/02

The 'Merge with input text' mode

All the preceding examples were with the Merge mode

In this mode, Unitex tacitly copies the text it recognizes

This is simple but does not copy in a different order

We want to make copy explicit

It worked for me badly and I stopped after three months

<opinion>It worked for me badly</opinion> and I stopped after three months

Page 29: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 29 2016/06/02

The 'Replace recognized

sequences' mode

Recognized sequences are replaced by outputs

It worked for me badly and I stopped after three months

<opinion>It worked for me badly</opinion> and I stopped after three months

Page 30: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 30 2016/06/02

The 'Replace recognized

sequences' mode It worked for me badly and I stopped after three months

<opinion>It worked for me badly</opinion> and I stopped after three months

Explicitly copy from the text to an input variable

Page 31: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 31 2016/06/02

The 'Replace recognized

sequences' mode It worked for me badly and I stopped after three months

<opinion>It worked for me badly</opinion> and I stopped after three months

Explicitly copy from the input variable to the output text

Page 32: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 32 2016/06/02

Copy into an annotation placed

before

A local grammar must set a variable before it uses it

This solution will not work

It worked for me better than any other drug

<opinion phrase='better'>It worked for me better than any other drug</opinion>

Place to use the variable

Place to set the variable

Page 33: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 33 2016/06/02

Copy into an annotation placed

before

It worked for me better than any other drug

<opinion phrase='better'>It worked for me better than any other drug</opinion>

This part will set the variables

This part will use them

Page 34: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 34 2016/06/02

Copy into an annotation placed

before

It worked for me better than any other drug

<opinion phrase='better'>It worked for me better than any other drug</opinion>

Page 35: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 35 2016/06/02

Copy into an annotation placed

before

It worked for me better than any other drug

<opinion phrase='better'>It worked for me better than any other drug</opinion>

Page 36: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 36 2016/06/02

Insert a modified copy

into an annotation placed before

It worked for me better than any other drug

<opinion polarity='good'>It worked for me better than any other drug</opinion>

Page 37: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 37 2016/06/02

Insert a modified copy

into an annotation placed before

It worked for me better than any other drug

<opinion polarity='good'>It worked for me better than any other drug</opinion>

Page 38: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 38 2016/06/02

Copy from a dictionary

into an annotation placed before

It worked for my mental health quite poorly

<opinion polarity='bad'>It worked for my mental health quite poorly</opinion>

inefficiently,.ADV+opinion+pol=bad poorly,.ADV+opinion+pol=bad satisfactorily,.ADV+opinion+pol=good

Page 39: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 39 2016/06/02

Copy from a dictionary

into an annotation placed before

It worked for my mental health quite poorly

<opinion polarity='bad'>It worked for my mental health quite poorly</opinion>

inefficiently,.ADV+opinion+pol=bad poorly,.ADV+opinion+pol=bad satisfactorily,.ADV+opinion+pol=good

Page 40: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Outline

Annotating Text With Local Grammars • 40 2016/06/02

Insert annotations

Copy from text to annotation

Copy from a dictionary

Annotate at the right place

Delete annotations

Page 41: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 41 2016/06/02

Delete annotations

Clearly distinguish annotations from text

They can be deleted so as to retrieve the original corpus

It worked for my mental health better than any other drug

<opinion polarity='good'>It worked for my mental health better than any other drug</opinion>

Page 42: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

Annotating Text With Local Grammars • 42 2016/06/02

Delete annotations

Use a graph that recognizes tags

Use it in the Replace mode

Recognized sequences are replaced by outputs

If there are no outputs, recognized sequences are skipped

It worked for my mental health better than any other drug

<opinion polarity='good'>It worked for my mental health better than any other drug</opinion>

Page 43: Annotating Text With Local Grammars - HAL archive ouverte · 2016. 7. 21. · 2016/06/02 Annotating Text With Local Grammars • 6 Inserting annotations Clearly distinguish annotations

CONTACT

ÉRIC LAPORTE

00 +33 (0)1 60 95 75 52

[email protected]

Thanks