Redmine #1487: made system setting available again

This commit is contained in:
Cyprian Laskowski 2022-03-10 10:53:49 +01:00
parent 26066c0892
commit a601331156

View File

@ -5,11 +5,12 @@ import sys
from lxml import etree from lxml import etree
class Sentence: class Sentence:
def __init__(self, _id, no_ud=False): def __init__(self, _id, no_ud=False, system='jos'):
self._id = _id self._id = _id
self.items = [] self.items = []
self.links = [] self.links = []
self.no_ud = no_ud self.no_ud = no_ud
self.system = system
def add_item(self, token, lemma, upos, upos_other, xpos, misc): def add_item(self, token, lemma, upos, upos_other, xpos, misc):
self.items.append([token, lemma, upos, upos_other, xpos, "SpaceAfter=No" in misc.split('|')]) self.items.append([token, lemma, upos, upos_other, xpos, "SpaceAfter=No" in misc.split('|')])
@ -55,11 +56,11 @@ class Sentence:
link_grp = etree.Element('linkGrp') link_grp = etree.Element('linkGrp')
link_grp.set('corresp', '#'+xml_id) link_grp.set('corresp', '#'+xml_id)
link_grp.set('targFunc', 'head argument') link_grp.set('targFunc', 'head argument')
link_grp.set('type', system.upper() + '-SYN') link_grp.set('type', self.system.upper() + '-SYN')
for link_id, item in enumerate(self.links): for link_id, item in enumerate(self.links):
link_ref, link_type = item link_ref, link_type = item
link = etree.Element('link') link = etree.Element('link')
link.set('ana', system + '-syn:' + link_type.replace(':','_')) link.set('ana', self.system + '-syn:' + link_type.replace(':','_'))
if link_ref == u'0': if link_ref == u'0':
link.set('target', '#' + xml_id + ' #' + xml_id + '.' + str(link_id + 1)) link.set('target', '#' + xml_id + ' #' + xml_id + '.' + str(link_id + 1))
else: else: