Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
odrlScorer
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
Service Desk
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
Tetras MARS
odrlScorer
Commits
47b5a23f
Commit
47b5a23f
authored
2 years ago
by
Malo Revel
Browse files
Options
Downloads
Patches
Plain Diff
Add main
parent
e30566a6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+33
-0
33 additions, 0 deletions
main.py
scorer.py
+4
-2
4 additions, 2 deletions
scorer.py
with
37 additions
and
2 deletions
main.py
0 → 100644
+
33
−
0
View file @
47b5a23f
import
stats
import
scorer
import
os
import
sys
if
__name__
==
"
__main__
"
:
if
len
(
sys
.
argv
)
<
4
:
print
(
f
"
Usage:
\n\t
$ python3
{
sys
.
argv
[
0
]
}
<corpus_sentences_path> <corpus_odrl_path> <output_odrl_path>
"
)
print
(
"
Where:
\n\t
<corpus_sentences_path> is the path to the .txt source of the corpus
"
)
print
(
"
\t
<corpus_odrl_path> is the path to the .ttl data of the corpus
"
)
print
(
"
\t
<output_odrl_path> is the path to the .ttl output of the system on the corpus source
"
)
exit
(
1
)
path_sentences
=
sys
.
argv
[
1
]
if
path_sentences
[
-
1
]
!=
"
/
"
:
path_sentences
+=
"
/
"
path_target
=
sys
.
argv
[
2
]
if
path_target
[
-
1
]
!=
"
/
"
:
path_target
+=
"
/
"
path_output
=
sys
.
argv
[
3
]
if
path_output
[
-
1
]
!=
"
/
"
:
path_output
+=
"
/
"
statistics
=
stats
.
main_stats
(
path_sentences
,
path_target
)
scores_modalities
,
scores_actions
,
scores_global
=
scorer
.
main_scorer
(
path_target
,
path_output
)
print
(
f
"
Corpus source:
{
path_sentences
}
\n
Corpus data:
{
path_target
}
\n
System output:
{
path_output
}
\n
"
)
print
(
"
############ STATS ############
\n
"
)
print
(
statistics
)
print
(
"
\n
############ SCORES ###########
\n
"
)
print
(
f
"
# Modality scores:
\n
{
scores_modalities
}
"
)
print
(
f
"
# Actions scores:
\n
{
scores_actions
}
"
)
print
(
f
"
# Global scores:
\n
{
scores_global
}
"
)
This diff is collapsed.
Click to expand it.
scorer.py
+
4
−
2
View file @
47b5a23f
...
@@ -163,11 +163,11 @@ def main_scorer(path_target, path_output):
...
@@ -163,11 +163,11 @@ def main_scorer(path_target, path_output):
scores_actions
=
Scores
()
scores_actions
=
Scores
()
scores_global
=
Scores
()
scores_global
=
Scores
()
for
fname
in
os
.
listdir
(
path_
odrl
):
for
fname
in
os
.
listdir
(
path_
target
):
if
fname
.
endswith
(
"
.ttl
"
):
if
fname
.
endswith
(
"
.ttl
"
):
odrl_target
=
ODRL
()
odrl_target
=
ODRL
()
odrl_target
.
parse
(
path_
odrl
+
fname
)
odrl_target
.
parse
(
path_
target
+
fname
)
odrl_output
=
ODRL
()
odrl_output
=
ODRL
()
odrl_output
.
parse
(
path_output
+
fname
)
odrl_output
.
parse
(
path_output
+
fname
)
...
@@ -186,7 +186,9 @@ if __name__ == "__main__":
...
@@ -186,7 +186,9 @@ if __name__ == "__main__":
exit
(
1
)
exit
(
1
)
path_target
=
sys
.
argv
[
1
]
path_target
=
sys
.
argv
[
1
]
if
path_target
[
-
1
]
!=
"
/
"
:
path_target
+=
"
/
"
path_output
=
sys
.
argv
[
2
]
path_output
=
sys
.
argv
[
2
]
if
path_output
[
-
1
]
!=
"
/
"
:
path_output
+=
"
/
"
scores_modalities
,
scores_actions
,
scores_global
=
main_scorer
(
path_target
,
path_output
)
scores_modalities
,
scores_actions
,
scores_global
=
main_scorer
(
path_target
,
path_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