Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
1f74ad8a
Commit
1f74ad8a
authored
5 years ago
by
Stephan Porada
Browse files
Options
Downloads
Patches
Plain Diff
Add Wrapper Version 2.0
parent
e3db29e4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/corpora/CQiWrapper/CQiWrapper.py
+18
-17
18 additions, 17 deletions
app/corpora/CQiWrapper/CQiWrapper.py
app/templates/corpora/analyse_corpus.html.j2
+1
-0
1 addition, 0 deletions
app/templates/corpora/analyse_corpus.html.j2
with
19 additions
and
17 deletions
app/corpora/CQiWrapper/CQiWrapper.py
+
18
−
17
View file @
1f74ad8a
...
...
@@ -43,7 +43,6 @@ class CQiWrapper(CQiClient):
"""
p_attrs
=
self
.
corpus_positional_attributes
(
self
.
corpus_name
)
struct_attrs
=
self
.
corpus_structural_attributes
(
self
.
corpus_name
)
self
.
meta_struct_element
=
struct_attrs
[
0
]
self
.
attr_strings
=
{}
self
.
attr_strings
[
'
positional_attrs
'
]
=
{}
self
.
attr_strings
[
'
struct_attrs
'
]
=
{}
...
...
@@ -51,7 +50,7 @@ class CQiWrapper(CQiClient):
self
.
attr_strings
[
'
positional_attrs
'
][
p_attr
]
=
(
self
.
corpus_name
+
'
.
'
+
p_attr
)
for
struct_attr
in
struct_attrs
[
2
:
-
1
]
:
for
struct_attr
in
struct_attrs
:
self
.
attr_strings
[
'
struct_attrs
'
][
struct_attr
]
=
(
self
.
corpus_name
+
'
.
'
+
struct_attr
)
...
...
@@ -65,6 +64,7 @@ class CQiWrapper(CQiClient):
logger
.
warning
(
'
{} does exist.
'
.
format
(
corpus_name
))
else
:
logger
.
warning
(
'
{} does not exist.
'
.
format
(
corpus_name
))
pass
def
disconnect
(
self
):
"""
...
...
@@ -197,6 +197,7 @@ class CQiWrapper(CQiClient):
ordered_matches
[
key
][
'
context_before_cpos_list
'
]
=
before_context_infos
except
UnboundLocalError
:
logger
.
warning
(
'
Context before cpos list is empty.
'
)
pass
try
:
# loops over cpos in ordered_matches[key]['context_after_cpos_list']
# which holds all cpos of the before context
...
...
@@ -210,6 +211,7 @@ class CQiWrapper(CQiClient):
ordered_matches
[
key
][
'
context_after_cpos_list
'
]
=
after_context_infos
except
UnboundLocalError
:
logger
.
warning
(
'
Context after cpos list is empty.
'
)
pass
return
ordered_matches
def
get_cpos_infos
(
self
,
all_cpos
):
...
...
@@ -218,21 +220,20 @@ class CQiWrapper(CQiClient):
all cpos entries specified in the parameter all_cpos.
'''
cpos_infos
=
{}
for
attr_dict
in
self
.
attr_strings
:
if
attr_dict
==
'
positional_attrs
'
:
for
p_attr_key
in
self
.
attr_strings
[
attr_dict
].
keys
():
match_str
=
self
.
cl_cpos2str
(
self
.
attr_strings
[
attr_dict
][
p_attr_key
],
all_cpos
)
cpos_infos
[
p_attr_key
]
=
match_str
elif
attr_dict
==
'
struct_attrs
'
:
# for struct_attr_key in self.attr_strings[attr_dict].keys():
# logger.warning('HIER:' + struct_attr_key + " " + " " + self.attr_strings[attr_dict][struct_attr_key])
# struct_entry = self.cl_cpos2struc(self.attr_strings['struct_attrs'][self.meta_struct_element],
# all_cpos)
# logger.warning(struct_entry)
# match_str = self.cl_struc2str(self.attr_strings[attr_dict][struct_attr_key], struct_entry)
# cpos_infos[struct_attr_key] = match_str
pass
for
key
in
self
.
attr_strings
.
keys
():
if
key
==
'
positional_attrs
'
:
for
p_attr_key
in
self
.
attr_strings
[
key
].
keys
():
match_strs
=
self
.
cl_cpos2str
(
self
.
attr_strings
[
key
][
p_attr_key
],
all_cpos
)
cpos_infos
[
p_attr_key
]
=
match_strs
elif
key
==
'
struct_attrs
'
:
for
struct_attr_key
in
self
.
attr_strings
[
key
].
keys
():
struct_entry
=
self
.
cl_cpos2struc
(
self
.
attr_strings
[
key
][
struct_attr_key
],
all_cpos
)
logger
.
warning
(
"
{}: {}
"
.
format
(
self
.
attr_strings
[
key
][
struct_attr_key
],
struct_entry
))
match_strs
=
self
.
cl_struc2str
(
self
.
attr_strings
[
key
][
struct_attr_key
],
struct_entry
)
logger
.
warning
(
'
{}:{}
'
.
format
(
self
.
attr_strings
[
key
][
struct_attr_key
],
match_strs
))
cpos_infos
[
struct_attr_key
]
=
zip
(
struct_entry
,
match_strs
)
tmp_list
=
[]
attr_key_list
=
[]
for
key
in
cpos_infos
.
keys
():
...
...
This diff is collapsed.
Click to expand it.
app/templates/corpora/analyse_corpus.html.j2
+
1
−
0
View file @
1f74ad8a
...
...
@@ -117,6 +117,7 @@
});
socket.on('query', function(results) {
queryResultsElement.innerHTML = '';
console.log(results)
for (let key in results) {
console.log(results[key]);
queryResultsElement.innerHTML += '<p>' + results[key]['match_cpos_list'] + '</p>';
...
...
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