Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rl-sentence-compression-wesenberg
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
wesenberg
rl-sentence-compression-wesenberg
Commits
a95d413f
Commit
a95d413f
authored
2 years ago
by
wesenberg
Browse files
Options
Downloads
Patches
Plain Diff
amr_error
parent
7a478774
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wesenberg/util.py
+9
-10
9 additions, 10 deletions
wesenberg/util.py
with
9 additions
and
10 deletions
wesenberg/util.py
+
9
−
10
View file @
a95d413f
...
...
@@ -12,7 +12,7 @@ import pickle
from
wesenberg.Konstanten
import
LIST_SYMBOLS_TO_DELETE
,
ROOT_PATH
,
AMRLIB_PATH
,
\
LIST_MODEL_NAME
,
LOAD_SPARCY
,
ROUGE_TYPES
,
DIVIDER_PATH
,
BACKUP_SMATCH_ERROR_PATH
,
SAFE_SMATCH_ERROR
,
\
AMR_ERROR_PATH
,
S
EARCH
_AMR_ERROR
AMR_ERROR_PATH
,
S
AFE
_AMR_ERROR
def
remove_bugs
(
sentence
):
...
...
@@ -34,21 +34,20 @@ def calc_one_amr(nlp, sentence, file_name):
else
:
output
=
strip_amr_for_smatch
(
graphs
[
0
])
if
SEARCH_AMR_ERROR
:
output_list
=
output
.
split
(
"
\n
"
)
return_list
=
[]
for
item
in
output_list
:
output_list
=
output
.
split
(
"
\n
"
)
search_list
=
[]
if
SAFE_AMR_ERROR
:
for
i
,
item
in
enumerate
(
output_list
)
:
item
=
item
.
replace
(
"
)
"
,
""
).
replace
(
"
(
"
,
""
).
strip
()
if
item
in
return_list
:
if
item
not
in
search_list
:
search_list
.
append
(
item
)
else
:
path
=
os
.
path
.
join
(
AMR_ERROR_PATH
)
if
not
os
.
path
.
exists
(
path
):
os
.
makedirs
(
path
)
with
open
(
path
+
file_name
+
"
.txt
"
,
'
a
'
)
as
txt
:
txt
.
write
(
sentence
+
"
\n
"
+
output
+
"
\n\n
"
)
break
else
:
return_list
.
append
(
item
)
break
return
output
...
...
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