Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
combo
Manage
Activity
Members
Labels
Plan
Issues
20
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Syntactic Tools
combo
Merge requests
!8
Enhanced dependency parsing
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Enhanced dependency parsing
enhanced_dependency_parsing
into
develop
Overview
0
Commits
19
Pipelines
0
Changes
29
Merged
Mateusz Klimaszewski
requested to merge
enhanced_dependency_parsing
into
develop
4 years ago
Overview
0
Commits
19
Pipelines
0
Changes
3
Expand
0
0
Merge request reports
Viewing commit
a2137989
Prev
Next
Show latest version
3 files
+
14
−
15
Expand all files
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
a2137989
Fix deps prediction for MWE expressions.
· a2137989
Mateusz Klimaszewski
authored
4 years ago
combo/utils/graph.py
+
4
−
4
Options
"""
Based on https://github.com/emorynlp/iwpt-shared-task-2020.
"""
from
typing
import
List
import
numpy
as
np
from
conllu
import
TokenList
def
sdp_to_dag_deps
(
arc_scores
,
rel_scores
,
tree
:
T
okenList
,
root_label
,
vocab_index
=
None
):
def
sdp_to_dag_deps
(
arc_scores
,
rel_scores
,
tree
_t
oken
s
:
List
,
root_label
,
vocab_index
=
None
)
->
None
:
# adding ROOT
tree_tokens
=
tree
.
tokens
tree_heads
=
[
0
]
+
[
t
[
"
head
"
]
for
t
in
tree_tokens
]
graph
=
adjust_root_score_then_add_secondary_arcs
(
arc_scores
,
rel_scores
,
tree_heads
,
root_label
)
@@ -25,7 +25,7 @@ def sdp_to_dag_deps(arc_scores, rel_scores, tree: TokenList, root_label, vocab_i
deps
=
'
|
'
.
join
(
f
'
{
h
}
:
{
r
}
'
for
h
,
r
in
zip
(
heads
,
rels
))
tree_tokens
[
i
-
1
][
"
deps
"
]
=
deps
tree_tokens
[
i
-
1
][
"
deprel
"
]
=
deprel
return
tree
return
def
adjust_root_score_then_add_secondary_arcs
(
arc_scores
,
rel_labels
,
tree_heads
,
root_idx
):