Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PSTAL étudiant.e.s
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carlos Ramisch
PSTAL étudiant.e.s
Commits
4c08f1d3
Commit
4c08f1d3
authored
9 months ago
by
Carlos Ramisch
Browse files
Options
Downloads
Patches
Plain Diff
Add tiny example .conllu file and add functions to print oracle in TransBasedSent
parent
7257120d
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/conllulib.py
+33
-2
33 additions, 2 deletions
lib/conllulib.py
sequoia/README.md
+1
-0
1 addition, 0 deletions
sequoia/README.md
sequoia/tiny.conllu
+11
-0
11 additions, 0 deletions
sequoia/tiny.conllu
with
45 additions
and
2 deletions
lib/conllulib.py
+
33
−
2
View file @
4c08f1d3
...
...
@@ -332,18 +332,40 @@ class TransBasedSent(object):
"""
###############################
def
__init__
(
self
,
sent
):
def
__init__
(
self
,
sent
,
actions_only
=
False
):
"""
`sent`: A `TokenList` as retrieved by the `conllu` library or `readConllu()`
`actions_only`: affects the way the __str__ function prints this object
"""
self
.
sent
=
sent
self
.
actions_only
=
actions_only
###############################
def
__str__
(
self
):
"""
Sequence of configs and arc-hybrid actions corresponding to the sentence.
If `self.actions_only=True` prints only sequence of actions
"""
result
=
[]
for
config
,
action
in
self
.
get_configs_oracle
():
if
not
self
.
actions_only
:
result
.
append
(
"
{} -> {}
"
.
format
(
str
(
config
),
action
))
else
:
result
.
append
(
action
)
if
not
self
.
actions_only
:
result
.
append
(
"
{} -> {}
"
.
format
(
str
(
config
),
action
))
return
"
\n
"
.
join
(
result
)
else
:
return
"
"
.
join
(
result
)
###############################
def
get_configs_oracle
(
self
):
"""
Generator of oracle arc-hybrid configurations based on gold parsing tree.
Yields
triples (stack, buffer
, action) where action is a string among:
Yields
pairs (`TransBasedConfig`
, action) where action is a string among:
-
"
SHIFT
"
-> pop buffer into stack
-
"
LEFT-ARC-X
"
-> relation
"
X
"
from buffer head to stack head, pop stack
-
"
RIGHT-ARC-X
"
-> relation
"
X
"
from stack head to stack second, pop stack
...
...
@@ -402,6 +424,15 @@ class TransBasedConfig(object):
###############################
def
__str__
(
self
):
"""
Generate a string with explicit buffer and stack words.
"""
return
"
{}, {}
"
.
format
([
self
.
sent
[
i
-
1
][
'
form
'
]
for
i
in
self
.
stack
],
[
self
.
sent
[
i
-
1
][
'
form
'
]
for
i
in
self
.
buff
[:
-
1
]]
+
[
0
])
###############################
def
is_final
(
self
):
"""
Returns True if configuration is final, False else.
...
...
This diff is collapsed.
Click to expand it.
sequoia/README.md
+
1
−
0
View file @
4c08f1d3
...
...
@@ -7,6 +7,7 @@ We obtained the file `trunk/sequoia-ud.parseme.frsemcor` from commit number `ea7
The file is the result of the conversion from Sequoia's source as described on the
[
documentation
](
https://deep-sequoia.inria.fr/process/
)
We keep the original file in
`src`
folder to make command line completion faster
The file
`tiny.conllu`
was manually extracted and simplified, it is used in parsing exercises.
### Simplification
...
...
This diff is collapsed.
Click to expand it.
sequoia/tiny.conllu
0 → 100644
+
11
−
0
View file @
4c08f1d3
# global.columns = ID FORM LEMMA UPOS XPOS FEATS HEAD DEPREL DEPS MISC PARSEME:MWE FRSEMCOR:NOUN PARSEME:NE
# sent_id = annodis.er_00192
# text = La gare routière attend toujours ses illuminations.
1 La le DET _ Definite=Def|Gender=Fem|Number=Sing|PronType=Art 2 det _ _ * * *
2 gare gare NOUN _ Gender=Fem|Number=Sing 4 nsubj _ _ 1:_|MWE|SYNT * *
3 routière routier ADJ _ Gender=Fem|Number=Sing 2 amod _ _ 1 * *
4 attend attendre VERB _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root _ _ * * *
5 toujours toujours ADV _ _ 4 advmod _ _ * * *
6 ses son DET _ Number=Plur|Poss=Yes 7 det _ _ * * *
7 illuminations illumination NOUN _ Gender=Fem|Number=Plur 4 obj _ _ * Artifact *
8 . . PUNCT _ _ 4 punct _ _ * * *
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment