Skip to content
Snippets Groups Projects
Commit a625c91f authored by Timofey Arkhangelskiy's avatar Timofey Arkhangelskiy
Browse files

Add some test queries, add word layer to Tsakorpus advanced view

parent 5ff4a239
Branches
No related tags found
No related merge requests found
......@@ -45,6 +45,7 @@ class Record:
})
return record
if __name__ == '__main__':
pass
......@@ -6,6 +6,7 @@ from .query_parser import QueryParser
from .config import ResourceConfig
from .diagnostics import Diagnostic, DiagnosticTypes
class TsakorpusQueryParser(QueryParser):
"""
Parses search queries for Tsakorpus-based corpora.
......
......@@ -27,6 +27,14 @@ class TsakorpusResponseParser:
lemmasStr = '_'
pos = set()
posStr = '_'
word = ''
wordNodes = annoTree.xpath('div[@class="popup_word"]/span[@class="popup_wf"]')
for node in wordNodes:
if node.text is not None:
if len(word) > 0:
# This should not happen, but just in case
word += '|'
word += node.text
lexNodes = annoTree.xpath('div[@class="popup_word"]/div[@class="popup_ana"]/span[@class="popup_lex"]')
for node in lexNodes:
if node.text is not None:
......@@ -42,6 +50,13 @@ class TsakorpusResponseParser:
if len(pos) > 0:
posStr = '|'.join(p for p in sorted(pos))
if 'word' not in record.layers:
record.layers['word'] = []
record.layers['word'].append({
'ref': segID,
'value': word
})
if 'pos' not in record.layers:
record.layers['pos'] = []
record.layers['pos'].append({
......
http://127.0.0.1:5000/fcs-endpoint/flc Implicit explain
http://127.0.0.1:5000/fcs-endpoint/flc?operation=explain Explicit explain
http://127.0.0.1:5000/fcs-endpoint/flc?operation=searchRetrieve&query=regnum%20domni Formulae -- Simple search ("regnum domni", 11 hits)
http://127.0.0.1:5000/fcs-endpoint/flc?operation=searchRetrieve&query=regnum%20domni%20AND%20in Formulae -- Simple search with boolean operator ("regnum domni" AND "in", 6 hits)
http://127.0.0.1:5000/fcs-endpoint/flc?operation=searchRetrieve&query=regnum%20OR%20dominus Formulae -- Simple search with boolean operator ("regnum" OR "dominus", 815 hits)
http://127.0.0.1:5000/fcs-endpoint/test?operation=searchRetrieve&query=ke%20OR%20no Tsakorpus -- Simple search with boolean operator ("ke" OR "no")
http://127.0.0.1:5000/fcs-endpoint/test?operation=searchRetrieve&query=ke%20AND%20no Tsakorpus -- Simple search with boolean operator ("ke" AND "no", 103 hits)
http://127.0.0.1:5000/fcs-endpoint/test?operation=searchRetrieve&query=ke%20no Tsakorpus -- Simple search with multiple words ("ke no", 18 hits)
http://127.0.0.1:5000/fcs-endpoint/test?operation=searchRetrieve&query=ke%20no Tsakorpus -- Simple search with multiple words ("ke no", 18 hits)
http://127.0.0.1:5000/fcs-endpoint/test?operation=searchRetrieve&query=ke%20AND%20no&x-fcs-dataviews=adv Tsakorpus -- Simple search with boolean operator, advanced view ("ke" AND "no", 103 hits)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment