Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
anonymizer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
All's good
Show more breadcrumbs
nlpworkers
anonymizer
Commits
9bcc5e59
Commit
9bcc5e59
authored
Nov 23, 2023
by
Paweł Walkowiak
Browse files
Options
Downloads
Patches
Plain Diff
Add try-except
parent
d62da8a9
No related branches found
No related tags found
1 merge request
!13
Fix anonymizer errors
Pipeline
#15156
failed
Nov 23, 2023
Stage: check_style
Stage: test
Stage: build_develop
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dictionaries/morphosyntactic/ner_file.py
+22
-16
22 additions, 16 deletions
src/dictionaries/morphosyntactic/ner_file.py
with
22 additions
and
16 deletions
src/dictionaries/morphosyntactic/ner_file.py
+
22
−
16
View file @
9bcc5e59
...
@@ -92,9 +92,11 @@ class NERFileMorphosyntacticDictionary(MorphosyntacticDictionary):
...
@@ -92,9 +92,11 @@ class NERFileMorphosyntacticDictionary(MorphosyntacticDictionary):
if
original_entry_type_name
in
self
.
_dictionary
:
if
original_entry_type_name
in
self
.
_dictionary
:
entry_type
=
original_entry_type_name
entry_type
=
original_entry_type_name
try
:
if
morpho_tag
in
self
.
_dictionary
[
entry_type
]
\
if
entry_type
in
self
.
_dictionary
\
and
morpho_tag
in
self
.
_dictionary
[
entry_type
]:
and
morpho_tag
in
self
.
_dictionary
[
entry_type
]
\
and
len
(
list
(
self
.
_dictionary
[
entry_type
][
morpho_tag
].
keys
()))
>
0
:
lemma
=
random
.
choice
(
lemma
=
random
.
choice
(
list
(
self
.
_dictionary
[
entry_type
][
morpho_tag
].
keys
())
list
(
self
.
_dictionary
[
entry_type
][
morpho_tag
].
keys
())
)
)
...
@@ -108,6 +110,10 @@ class NERFileMorphosyntacticDictionary(MorphosyntacticDictionary):
...
@@ -108,6 +110,10 @@ class NERFileMorphosyntacticDictionary(MorphosyntacticDictionary):
list
(
self
.
_dictionary
[
entry_type
][
morpho_tag
].
keys
())
list
(
self
.
_dictionary
[
entry_type
][
morpho_tag
].
keys
())
)
)
word
=
lemma
word
=
lemma
except
IndexError
as
exp
:
print
(
f
"
IndexError entry_type
{
entry_type
}
morpho_tag
{
morpho_tag
}
"
)
print
(
exp
)
print
(
f
"
Dictionary
{
self
.
_dictionary
[
entry_type
][
morpho_tag
]
}
"
)
if
word
is
None
and
self
.
_always_replace
:
if
word
is
None
and
self
.
_always_replace
:
entry_type
=
random
.
choice
(
list
(
self
.
_dictionary
.
keys
()))
entry_type
=
random
.
choice
(
list
(
self
.
_dictionary
.
keys
()))
...
...
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