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
b189603d
Commit
b189603d
authored
5 years ago
by
Mateusz Klimaszewski
Browse files
Options
Downloads
Patches
Plain Diff
Handle binary morphological features.
parent
31c595f8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
combo/data/dataset.py
+7
-3
7 additions, 3 deletions
combo/data/dataset.py
with
7 additions
and
3 deletions
combo/data/dataset.py
+
7
−
3
View file @
b189603d
import
logging
from
typing
import
Union
,
List
,
Dict
,
Iterable
,
Optional
from
typing
import
Union
,
List
,
Dict
,
Iterable
,
Optional
,
Any
import
conllu
from
allennlp
import
data
as
allen_data
...
...
@@ -118,7 +118,7 @@ class UniversalDependenciesDatasetReader(allen_data.DatasetReader):
return
allen_data
.
Instance
(
fields_
)
@staticmethod
def
_feat_values
(
tree
:
conllu
.
TokenList
):
def
_feat_values
(
tree
:
List
[
Dict
[
str
,
Any
]]
):
features
=
[]
for
token
in
tree
:
token_features
=
[]
...
...
@@ -127,7 +127,11 @@ class UniversalDependenciesDatasetReader(allen_data.DatasetReader):
if
feat
in
[
"
_
"
,
"
__ROOT__
"
]:
pass
else
:
token_features
.
append
(
feat
+
"
=
"
+
value
)
# Handle case where feature is binary (doesn't have associated value)
if
value
:
token_features
.
append
(
feat
+
"
=
"
+
value
)
else
:
token_features
.
append
(
feat
)
features
.
append
(
token_features
)
return
features
...
...
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