mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Add neww result recieving
This commit is contained in:
		@@ -59,9 +59,9 @@ class Subcorpus:
 | 
			
		||||
        for match_start, match_end in match_boundaries:
 | 
			
		||||
            left_start = max(0, match_start - context)
 | 
			
		||||
            right_end = min(self.parent_corpus.size, (match_end + 1 + context))
 | 
			
		||||
            matches.append({'left': list(range(left_start, match_start)),
 | 
			
		||||
            matches.append({'lc': list(range(left_start, match_start)),
 | 
			
		||||
                            'hit': list(range(match_start, match_end + 1)),
 | 
			
		||||
                            'right': list(range(match_end + 1, right_end))})
 | 
			
		||||
                            'rc': list(range(match_end + 1, right_end))})
 | 
			
		||||
        cpos_list = []
 | 
			
		||||
        for match in matches:
 | 
			
		||||
            cpos_list += match['lc'] + match['hit'] + match['rc']
 | 
			
		||||
 
 | 
			
		||||
@@ -50,14 +50,21 @@ def corpus_analysis_query(query):
 | 
			
		||||
        context = 100
 | 
			
		||||
        progress = 0
 | 
			
		||||
        while chunk_start <= results.size:
 | 
			
		||||
            logger.warning("test")
 | 
			
		||||
            chunk = results.dump_values(context=context,
 | 
			
		||||
                                        first_result=chunk_start,
 | 
			
		||||
                                        num_results=chunk_size)
 | 
			
		||||
            progress = ((chunk_start + chunk_size) / results.size) * 100
 | 
			
		||||
            progress = min(100, int(math.ceil(progress)))
 | 
			
		||||
            logger.warning(chunk)
 | 
			
		||||
            if (results.size == 0):
 | 
			
		||||
                progress = 100
 | 
			
		||||
            else:
 | 
			
		||||
                progress = ((chunk_start + chunk_size) / results.size) * 100
 | 
			
		||||
                progress = min(100, int(math.ceil(progress)))
 | 
			
		||||
            socketio.emit('corpus_analysis_query',
 | 
			
		||||
                          {'chunk': chunk, 'progress': progress,
 | 
			
		||||
                           'num_matches_total': results.size},
 | 
			
		||||
                          {'chunk': chunk,
 | 
			
		||||
                           'progress': progress,
 | 
			
		||||
                           'num_matches_total': results.size,
 | 
			
		||||
                           'code': 0},
 | 
			
		||||
                          room=request.sid)
 | 
			
		||||
            chunk_start += chunk_size
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user