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
1c9e7159
Commit
1c9e7159
authored
5 years ago
by
Stephan Porada
Browse files
Options
Downloads
Patches
Plain Diff
Fixe some things for query results
parent
dbd580b3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/corpora/CQiWrapper/CQiWrapper.py
+5
-4
5 additions, 4 deletions
app/corpora/CQiWrapper/CQiWrapper.py
app/corpora/events.py
+7
-2
7 additions, 2 deletions
app/corpora/events.py
app/templates/corpora/analyse_corpus.html.j2
+5
-4
5 additions, 4 deletions
app/templates/corpora/analyse_corpus.html.j2
with
17 additions
and
10 deletions
app/corpora/CQiWrapper/CQiWrapper.py
+
5
−
4
View file @
1c9e7159
...
@@ -133,8 +133,8 @@ class CQiWrapper(CQiClient):
...
@@ -133,8 +133,8 @@ class CQiWrapper(CQiClient):
# match_boundries shows the start and end cpos of one match as a
# match_boundries shows the start and end cpos of one match as a
# pair of cpositions
# pair of cpositions
# [(1355, 1357), (1477, 1479)] Example for two boundry pairs
# [(1355, 1357), (1477, 1479)] Example for two boundry pairs
offset_start
=
0
+
(
result_offset
+
1
)
if
result_offset
!
=
0
else
result_offset
offset_start
=
0
if
result_offset
=
=
0
else
result_offset
offset_end
=
self
.
nr_matches
+
result_offset
offset_end
=
self
.
nr_matches
+
result_offset
-
1
match_boundaries
=
zip
(
self
.
cqp_dump_subcorpus
(
self
.
result_subcorpus
,
match_boundaries
=
zip
(
self
.
cqp_dump_subcorpus
(
self
.
result_subcorpus
,
CONST_FIELD_MATCH
,
CONST_FIELD_MATCH
,
offset_start
,
offset_start
,
...
@@ -152,9 +152,10 @@ class CQiWrapper(CQiClient):
...
@@ -152,9 +152,10 @@ class CQiWrapper(CQiClient):
all_matches
=
[]
all_matches
=
[]
all_cpos
=
[]
all_cpos
=
[]
for
start
,
end
in
match_boundaries
:
for
start
,
end
in
match_boundaries
:
end
+=
1
lc_cpos
=
list
(
range
(
max
([
0
,
start
-
self
.
context_len
]),
start
))
lc_cpos
=
list
(
range
(
max
([
0
,
start
-
self
.
context_len
]),
start
))
lc
=
{
'
lc
'
:
lc_cpos
}
lc
=
{
'
lc
'
:
lc_cpos
}
match_cpos
=
list
(
range
(
start
,
end
+
1
))
match_cpos
=
list
(
range
(
start
,
end
))
match
=
{
'
hit
'
:
match_cpos
}
match
=
{
'
hit
'
:
match_cpos
}
rc_cpos
=
list
(
range
(
end
,
min
([
self
.
corpus_max_len
,
end
+
self
.
context_len
])))
rc_cpos
=
list
(
range
(
end
,
min
([
self
.
corpus_max_len
,
end
+
self
.
context_len
])))
rc
=
{
'
rc
'
:
rc_cpos
}
rc
=
{
'
rc
'
:
rc_cpos
}
...
@@ -226,7 +227,7 @@ class CQiWrapper(CQiClient):
...
@@ -226,7 +227,7 @@ class CQiWrapper(CQiClient):
text_lookup
=
{}
text_lookup
=
{}
for
d
in
structs_to_check
:
for
d
in
structs_to_check
:
s_key
,
s_value
=
zip
(
*
d
.
items
())
s_key
,
s_value
=
zip
(
*
d
.
items
())
s_value
=
s_value
[
0
].
split
(
'
_
'
)[
1
]
s_value
=
s_value
[
0
].
split
(
'
_
'
,
1
)[
1
]
struct_values
=
self
.
cl_struc2str
(
s_key
[
0
],
text_lookup_ids
)
struct_values
=
self
.
cl_struc2str
(
s_key
[
0
],
text_lookup_ids
)
zipped
=
dict
(
zip
(
text_lookup_ids
,
struct_values
))
zipped
=
dict
(
zip
(
text_lookup_ids
,
struct_values
))
for
zip_key
,
zip_value
in
zipped
.
items
():
for
zip_key
,
zip_value
in
zipped
.
items
():
...
...
This diff is collapsed.
Click to expand it.
app/corpora/events.py
+
7
−
2
View file @
1c9e7159
...
@@ -44,10 +44,15 @@ def corpus_analysis(message):
...
@@ -44,10 +44,15 @@ def corpus_analysis(message):
return
return
"""
Prepare and execute a query
"""
"""
Prepare and execute a query
"""
corpus_name
=
'
CORPUS
'
corpus_name
=
'
CORPUS
'
query
=
(
message
[
'
query
'
])
query
=
str
(
message
[
'
query
'
])
result_len
=
int
(
message
[
'
hits_per_page
'
])
context_len
=
int
(
message
[
'
context
'
])
result_offset
=
int
(
0
)
client
.
select_corpus
(
corpus_name
)
client
.
select_corpus
(
corpus_name
)
client
.
query_subcorpus
(
query
)
client
.
query_subcorpus
(
query
)
results
=
client
.
show_query_results
(
result_len
=
int
(
message
[
'
hits_per_page
'
]),
context_len
=
int
(
message
[
'
context
'
]))
results
=
client
.
show_query_results
(
result_len
=
result_len
,
context_len
=
context_len
,
result_offset
=
result_offset
)
socketio
.
emit
(
'
corpus_analysis
'
,
results
,
room
=
request
.
sid
)
socketio
.
emit
(
'
corpus_analysis
'
,
results
,
room
=
request
.
sid
)
...
...
This diff is collapsed.
Click to expand it.
app/templates/corpora/analyse_corpus.html.j2
+
5
−
4
View file @
1c9e7159
...
@@ -269,10 +269,11 @@
...
@@ -269,10 +269,11 @@
</tr>
</tr>
<tr>
<tr>
<td class="left-align">
<td class="left-align">
word: ${token["word"]}<br>
Word: ${token["word"]}<br>
lemma: ${token["lemma"]}<br>
Lemma: ${token["lemma"]}<br>
pos: ${token["pos"]}<br>
POS: ${token["pos"]}<br>
simple_pos: ${token["simple_pos"]}
Simple POS: ${token["simple_pos"]}<br>
NER: ${token["ner"]}
</td>
</td>
<td class="left-align">
<td class="left-align">
Title: ${result["text_lookup"][token["text"]]["title"]}<br>
Title: ${result["text_lookup"][token["text"]]["title"]}<br>
...
...
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