mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 04:12:45 +00:00 
			
		
		
		
	Fix imports and hardcoded values
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
			
		||||
from CQiClient import CQiClient
 | 
			
		||||
from CQi import CONST_FIELD_MATCH, CONST_FIELD_MATCHEND
 | 
			
		||||
from .CQiClient import CQiClient
 | 
			
		||||
from .CQi import CONST_FIELD_MATCH, CONST_FIELD_MATCHEND
 | 
			
		||||
import re
 | 
			
		||||
# from app import logger  # only works if imported into opaque web app
 | 
			
		||||
from app import logger  # only works if imported into opaque web app
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class CQiWrapper(CQiClient):
 | 
			
		||||
@@ -162,11 +162,11 @@ class CQiWrapper(CQiClient):
 | 
			
		||||
        # print(all_cpos)
 | 
			
		||||
 | 
			
		||||
        # Get all sentences IDs for all above collected cpos in all_cpos
 | 
			
		||||
        s_ids = self.cl_cpos2struc('UTOPIEN.s', all_cpos) # CHANGE to CORPUS.s will always be like this in nopaque
 | 
			
		||||
        s_ids = self.cl_cpos2struc('CORPUS.s', all_cpos) # CHANGE to CORPUS.s will always be like this in nopaque
 | 
			
		||||
        # Get all cpos for all sneteces boundries
 | 
			
		||||
        s_lookup = {}
 | 
			
		||||
        for s_id in set(s_ids):
 | 
			
		||||
            s_start, s_end = self.cl_struc2cpos('UTOPIEN.s', s_id)  # CHANGE to CORPUS.s will always be like this in nopaque
 | 
			
		||||
            s_start, s_end = self.cl_struc2cpos('CORPUS.s', s_id)  # CHANGE to CORPUS.s will always be like this in nopaque
 | 
			
		||||
            # print(s_start, s_end)
 | 
			
		||||
            s_cpos = range(s_start, s_end)
 | 
			
		||||
            s_lookup.update({s_id: list(s_cpos)})
 | 
			
		||||
@@ -200,11 +200,11 @@ class CQiWrapper(CQiClient):
 | 
			
		||||
        tmp_dict = {}
 | 
			
		||||
        for struct_attr_key in self.attr_strings['struct_attrs'].keys():
 | 
			
		||||
            check = self.attr_strings['struct_attrs'][struct_attr_key]
 | 
			
		||||
            if check == 'UTOPIEN.s':
 | 
			
		||||
            if check == 'CORPUS.s':
 | 
			
		||||
                struct_ids = self.cl_cpos2struc(check, all_cpos)
 | 
			
		||||
                for id in struct_ids:
 | 
			
		||||
                    tmp_s_info.append({struct_attr_key: id})
 | 
			
		||||
            elif check == 'UTOPIEN.entry':
 | 
			
		||||
            elif check == 'CORPUS.text':
 | 
			
		||||
                struct_ids = self.cl_cpos2struc(check, all_cpos)
 | 
			
		||||
                for id in struct_ids:
 | 
			
		||||
                    tmp_text_info.append({struct_attr_key: id})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user