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
Commits
7eb1302a
Commit
7eb1302a
authored
5 years ago
by
Mateusz Klimaszewski
Browse files
Options
Downloads
Patches
Plain Diff
Copy metadata from source file.
parent
761b4a25
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
combo/data/dataset.py
+2
-1
2 additions, 1 deletion
combo/data/dataset.py
combo/predict.py
+3
-2
3 additions, 2 deletions
combo/predict.py
with
5 additions
and
3 deletions
combo/data/dataset.py
+
2
−
1
View file @
7eb1302a
...
...
@@ -78,7 +78,8 @@ class UniversalDependenciesDatasetReader(allen_data.DatasetReader):
# dependencies for the original sentence.
# We filter by integers here as elided words have a non-integer word id,
# as parsed by the conllu python library.
annotation
=
conllu
.
TokenList
([
x
for
x
in
annotation
if
isinstance
(
x
[
'
id
'
],
int
)])
annotation
=
conllu
.
TokenList
([
x
for
x
in
annotation
if
isinstance
(
x
[
'
id
'
],
int
)],
metadata
=
annotation
.
metadata
)
yield
self
.
text_to_instance
(
annotation
)
@overrides
...
...
This diff is collapsed.
Click to expand it.
combo/predict.py
+
3
−
2
View file @
7eb1302a
...
...
@@ -83,7 +83,8 @@ class SemanticMultitaskPredictor(predictor.Predictor):
return
conllu
.
TokenList
(
[
d
({
'
id
'
:
idx
,
'
token
'
:
token
})
for
idx
,
token
in
enumerate
(
sentence
)]
in
enumerate
(
sentence
)],
metadata
=
collections
.
OrderedDict
()
)
def
_predictions_as_tree
(
self
,
predictions
,
instance
):
...
...
@@ -135,7 +136,7 @@ class SemanticMultitaskPredictor(predictor.Predictor):
raise
NotImplementedError
(
f
'
Unknown field name
{
field_name
}
!
'
)
if
self
.
_dataset_reader
and
'
sent
'
in
self
.
_dataset_reader
.
_targets
:
tree
.
metadata
=
{
'
sentence_embedding
'
:
str
(
predictions
[
'
sentence_embedding
'
])
}
tree
.
metadata
[
'
sentence_embedding
'
]
=
str
(
predictions
[
'
sentence_embedding
'
])
return
tree
@classmethod
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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