From 71c1307c1a5001404df263d623eea2a43cc346ab Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:20:32 +0100 Subject: [PATCH 001/124] automate section level --- xlp.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xlp.py b/xlp.py index 41c75189..b21391ec 100644 --- a/xlp.py +++ b/xlp.py @@ -293,9 +293,15 @@ def stylesheet(self): # > class Section(ET.Element): - def __init__(self,parent,title="No Section Title!",level=1,landscape=False): + def __init__(self,parent,title="No Section Title!",level=None,landscape=False): id=rx.id(title) - name='section'+str(level) + if level: #this shouldn't happen + self.level=level + elif hasattr(parent,level): #this should manage most cases + self.level=parent.level+1 + else: + self.level=1 + name='section'+str(self.level) attribs={'id':id} if landscape: attribs['showinlandscapemode']='yes' From 9cbd1b953c9c8476d4c4adba8a1b95a864a5503b Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:20:45 +0100 Subject: [PATCH 002/124] testing --- lift.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lift.py b/lift.py index f3899d2c..42c9864b 100644 --- a/lift.py +++ b/lift.py @@ -2855,7 +2855,7 @@ def printurllog(lift): # filename="/home/kentr/Assignment/Tools/WeSay/tsp/TdN.lift" # filename="/home/kentr/Assignment/Tools/WeSay/tsp/TdN.lift_2021-12-06.txt" # filename="/home/kentr/Assignment/Tools/WeSay/eto/eto.lift" - filename="/home/kentr/Assignment/Tools/WeSay/eto/Eton.lift" + # filename="/home/kentr/Assignment/Tools/WeSay/eto/Eton.lift" # filename="/home/kentr/Assignment/Tools/WeSay/bqg/Kusuntu.lift" # filename="/home/kentr/Assignment/Tools/WeSay/CAWL_demo/SILCAWL.lift" lift=Lift(filename) @@ -2911,9 +2911,20 @@ def printurllog(lift): @lang='gnd'][text='location']/text""" """why is location taken as a text value??!? maybe it should be cleared once used?""" - formvaluenode=lift.get("example/form/text", senseid=senseid, - analang=analang, location=location, showurl=True).get('node') - print(formvaluenode) + senseids=lift.get('sense', + # field='tone', + toneUFvalue='Nom_CVCVC_1', + # tonevalue=group, + # path=['example'], + showurl=True + ).get('senseid') + print(senseids) + for senseid in senseids: + value=lift.get("sense/field/form/text", + path=["toneUFfield"], + senseid=senseid, + showurl=True).get('text') + log.info("{}: {}".format(senseid,value)) exit() lf=lift.fieldtext(ftype='ph') # ,location=check, From 6a428044beacd9e6684f3fc9d2113c9751fb2d11 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:22:24 +0100 Subject: [PATCH 003/124] remove Tone parent --- main.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/main.py b/main.py index 2e6b874a..4d3e43c4 100755 --- a/main.py +++ b/main.py @@ -8018,6 +8018,11 @@ def __init__(self): self.status.group(None) log.info("doing basic report on {} with groups {}".format(self.cvtstodo, self.status.group())) +class ByUF(Tone): + def __init__(self): + Tone.__init__(self) + self.byUFgroup=True + log.info("doing report by UF groups") class SortCV(Sort,Segments,TaskDressing,ui.Window): """docstring for SortCV.""" def __init__(self, parent): @@ -8320,7 +8325,7 @@ def dobuttonkwargs(self): 'sticky':'ew' } def __init__(self, parent): #frame, filename=None - Tone.__init__(self,parent) + Tone.__init__(self) ui.Window.__init__(self,parent) TaskDressing.__init__(self,parent) self.params.cvt('T') @@ -8865,7 +8870,7 @@ def dobuttonkwargs(self): def taskicon(self): return program['theme'].photo['iconTranscribe'] def __init__(self, parent): #frame, filename=None - Tone.__init__(self, parent) + Tone.__init__(self) ui.Window.__init__(self, parent) TaskDressing.__init__(self, parent) self.glyphspossible=None @@ -9043,7 +9048,7 @@ def done(): self.runwindow.waitdone() self.runwindow.wait_window(scroll) def __init__(self, parent): - Tone.__init__(self, parent) + Tone.__init__(self) ui.Window.__init__(self, parent) TaskDressing.__init__(self, parent) class RecordCitation(Record,Segments,TaskDressing,ui.Window): @@ -9085,7 +9090,7 @@ def taskicon(self): def tasktitle(self): return _("Record Tone") #Citation Form Sorting in Tone Frames def __init__(self, parent): #frame, filename=None - Tone.__init__(self,parent) + Tone.__init__(self) ui.Window.__init__(self,parent) TaskDressing.__init__(self,parent) Record.__init__(self) @@ -9272,7 +9277,7 @@ def dobuttonkwargs(self): 'sticky':'ew' } def __init__(self, parent): #frame, filename=None - Tone.__init__(self,parent) + Tone.__init__(self) ui.Window.__init__(self,parent) TaskDressing.__init__(self,parent) Report.__init__(self) @@ -9298,7 +9303,7 @@ def dobuttonkwargs(self): 'sticky':'ew' } def __init__(self, parent): #frame, filename=None - Tone.__init__(self,parent) + Tone.__init__(self) ui.Window.__init__(self,parent) self.do=self.tonegroupreport TaskDressing.__init__(self,parent) @@ -9326,7 +9331,7 @@ def dobuttonkwargs(self): 'sticky':'ew' } def __init__(self, parent): #frame, filename=None - Tone.__init__(self,parent) + Tone.__init__(self) ui.Window.__init__(self,parent) self.do=self.tonegroupreport TaskDressing.__init__(self,parent) @@ -9354,7 +9359,7 @@ def dobuttonkwargs(self): 'sticky':'ew' } def __init__(self, parent): #frame, filename=None - Tone.__init__(self,parent) + Tone.__init__(self) ui.Window.__init__(self,parent) self.do=self.tonegroupreportmulti TaskDressing.__init__(self,parent) @@ -9383,7 +9388,7 @@ def dobuttonkwargs(self): 'sticky':'ew' } def __init__(self, parent): #frame, filename=None - Tone.__init__(self,parent) + Tone.__init__(self) ui.Window.__init__(self,parent) self.do=self.tonegroupreportcomprehensive # self.do=self.tonegroupreport @@ -9411,7 +9416,7 @@ def dobuttonkwargs(self): 'sticky':'ew' } def __init__(self, parent): #frame, filename=None - Tone.__init__(self,parent) + Tone.__init__(self) ui.Window.__init__(self,parent) self.do=self.tonegroupreportmulti # self.do=self.tonegroupreport From 15368c9f3766f49399593e38de0811e7ff6f4eb8 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:23:38 +0100 Subject: [PATCH 004/124] new task classes (testing byUF functions) --- main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/main.py b/main.py index 4d3e43c4..0a2d35e2 100755 --- a/main.py +++ b/main.py @@ -9151,6 +9151,15 @@ def runcheck(self): i+=1 return self.getresults() +class ReportCitationByUF(ByUF,ReportCitation): + """docstring for ReportCitation.""" + def tasktitle(self): + return _("Alphabet Report by Tone group") # on One Data Slice + def taskicon(self): + return program['theme'].photo['iconReport'] + def __init__(self, parent): #frame, filename=None + ReportCitation.__init__(self, parent) + ByUF.__init__(self) class ReportCitationBasic(Report,Comprehensive,Segments,TaskDressing,ui.Window): """docstring for ReportCitation.""" def tasktitle(self): @@ -9204,6 +9213,13 @@ def __init__(self, parent): #frame, filename=None Report.__init__(self) self.cvtstodo=['V'] Comprehensive.__init__(self) +class ReportCitationBasicVByUF(ByUF,ReportCitationBasicV): + """docstring for ReportCitation.""" + def tasktitle(self): + return _("Comprehensive Vowel Report by tone group") # on Citation Forms + def __init__(self, parent): #frame, filename=None + ReportCitationBasicV.__init__(self, parent) + ByUF.__init__(self) class ReportCitationBasicC(Report,Comprehensive,Segments,TaskDressing,ui.Window): """docstring for ReportCitation.""" def tasktitle(self): From 605ac13892c7071b13c89d3359820e08477b7c85 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:24:06 +0100 Subject: [PATCH 005/124] move init below --- main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 0a2d35e2..ada27da2 100755 --- a/main.py +++ b/main.py @@ -9115,11 +9115,6 @@ def dobuttonkwargs(self): 'image':self.taskchooser.theme.photo['Report'], 'sticky':'ew' } - def __init__(self, parent): #frame, filename=None - Segments.__init__(self,parent) - ui.Window.__init__(self,parent) - TaskDressing.__init__(self,parent) - Report.__init__(self) def runcheck(self): """This needs to get stripped down and updated for just this check""" self.settings.storesettingsfile() @@ -9151,6 +9146,11 @@ def runcheck(self): i+=1 return self.getresults() + def __init__(self, parent): #frame, filename=None + Segments.__init__(self,parent) + ui.Window.__init__(self,parent) + TaskDressing.__init__(self,parent) + Report.__init__(self) class ReportCitationByUF(ByUF,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): From 16d7441d19ed43e7814a79d4a78aad5e41328199 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:24:27 +0100 Subject: [PATCH 006/124] set default --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index ada27da2..8f270e55 100755 --- a/main.py +++ b/main.py @@ -8013,6 +8013,7 @@ def __init__(self): self.distinguish=self.settings.distinguish self.profilesbysense=self.settings.profilesbysense self.s=self.settings.s + self.byUFgroup=False class Comprehensive(object): def __init__(self): self.status.group(None) From 6803fb28c29955f37111c9b5e321cae5f2b02be0 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:24:54 +0100 Subject: [PATCH 007/124] use kwargs --- main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 8f270e55..ce6968f5 100755 --- a/main.py +++ b/main.py @@ -7923,19 +7923,19 @@ def basicreport(self): log.info(t) print(t) p=xlp.Paragraph(si,t) - for ps in self.slices.pss()[:2]: #just the first two (Noun and Verb) - profiles=self.slices.profiles(ps=ps)[:self.settings.maxprofiles] - t=_("{} data: (profiles: {})".format(ps,profiles)) + for kwargs['ps'] in self.slices.pss()[:2]: #just the first two (Noun and Verb) + profiles=self.slices.profiles(ps=kwargs['ps'])[:self.settings.maxprofiles] + t=_("{} data: (profiles: {})".format(kwargs['ps'],profiles)) log.info(t) print(t) s1=xlp.Section(xlpr,t) t=_("This section covers the following top syllable profiles " - "which are found in {}s: {}".format(ps,profiles)) + "which are found in {}s: {}".format(kwargs['ps'],profiles)) p=xlp.Paragraph(s1,t) log.info(t) print(t) - for profile in profiles: - t=_("{} {}s".format(profile,ps)) + for kwargs['profile'] in profiles: + t=_("{} {}s".format(kwargs['profile'],kwargs['ps'])) s2=xlp.Section(s1,t,level=2) print(t) log.info(t) From ac3bf600f66479c76be2973c55caafb77a2fd5e9 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:26:14 +0100 Subject: [PATCH 008/124] new fns --- main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.py b/main.py index ce6968f5..bac2dce8 100755 --- a/main.py +++ b/main.py @@ -5622,6 +5622,12 @@ def setsenseidgroup(self,senseid,ftype,check,group,**kwargs): **kwargs #should only include framed, if desired ) # log.info("Done setting tone sort group") + def getsenseidsinUFgroup(self,group): + return self.db.get('sense', + toneUFvalue=group, + # path=['example'], + # showurl=True + ).get('senseid') def getsenseidsingroup(self,check,group): return self.db.get('sense',location=check, tonevalue=group, @@ -5632,6 +5638,12 @@ def getgroupofsenseid(self,senseid,check): return self.db.get("example/tonefield/form/text", senseid=senseid, location=check).get('text') def __init__(self,parent): + def getUFgroupofsenseid(self,senseid): + return self.db.get("sense/field/form/text", + path=["toneUFfield"], + senseid=senseid, + # showurl=True + ).get('text') pass class Sort(object): """This class takes methods common to all sort checks, and gives sort From 82f31fc62f28eeb3d52c8ac9b4f4632569cbdd99 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:27:07 +0100 Subject: [PATCH 009/124] move init --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index bac2dce8..f98b13b8 100755 --- a/main.py +++ b/main.py @@ -5637,13 +5637,13 @@ def getsenseidsingroup(self,check,group): def getgroupofsenseid(self,senseid,check): return self.db.get("example/tonefield/form/text", senseid=senseid, location=check).get('text') - def __init__(self,parent): def getUFgroupofsenseid(self,senseid): return self.db.get("sense/field/form/text", path=["toneUFfield"], senseid=senseid, # showurl=True ).get('text') + def __init__(self): pass class Sort(object): """This class takes methods common to all sort checks, and gives sort From 4cdb49371033d2ef0549e5c78dbf4eac7cfeb75f Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:27:59 +0100 Subject: [PATCH 010/124] use kwargs --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index f98b13b8..37a14790 100755 --- a/main.py +++ b/main.py @@ -7493,7 +7493,9 @@ def getresults(self,**kwargs): c2 = "Any" """nn() here keeps None and {} from the output, takes one string, list, or tuple.""" - text=(_("{} roots of form {} by {}".format(ps,profile,check))) + text=(_("{} roots of form {} by {}".format(kwargs['ps'], + kwargs['profile'], + kwargs['check']))) if hasattr(self,'results'): #i.e., showing results in window ui.Label(self.results, text=text).grid(column=0, row=self.results.row) self.runwindow.wait() From 86df9e53d2f7fcbc2141d0048257073d63366a3a Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:28:17 +0100 Subject: [PATCH 011/124] use kwargs --- main.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 37a14790..6c11c6b6 100755 --- a/main.py +++ b/main.py @@ -7476,15 +7476,14 @@ def makeresultsframe(self): def getresults(self,**kwargs): self.getrunwindow() # self.makeresultsframe() #not for now, causing problems - cvt=kwargs.get('cvt',self.params.cvt()) - ps=kwargs.get('ps',self.slices.ps()) - profile=kwargs.get('profile',self.slices.profile()) - check=kwargs.get('check',self.params.check()) - self.adhocreportfileXLP=''.join([str(self.reportbasefilename) - ,'_',str(ps) - ,'-',str(profile) - ,'_',str(check) - ,'_ReportXLP.xml']) + kwargs['cvt']=kwargs.get('cvt',self.params.cvt()) + kwargs['ps']=kwargs.get('ps',self.slices.ps()) + kwargs['profile']=kwargs.get('profile',self.slices.profile()) + kwargs['check']=kwargs.get('check',self.params.check()) + self.adhocreportfileXLP='_'.join([str(self.reportbasefilename) + ,str(kwargs['ps'])+'-'+str(kwargs['profile']) + ,str(kwargs['check']) + ,'ReportXLP.xml']) self.checkcounts={} xlpr=self.xlpstart() """"Do I need this?""" From 7731ac57acf08dd0470c07938a5110d95b7ba095 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:30:07 +0100 Subject: [PATCH 012/124] don't fail if this fails --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 6c11c6b6..08eff87b 100755 --- a/main.py +++ b/main.py @@ -4510,7 +4510,11 @@ def senseidformsbyregex(self,regex,**kwargs): t = threading.Thread(target=self.ifregexadd, args=(regex,form,id)) t.start() - t.join() + try: + t.join() + except: + log.info("Looks like no forms in senseidstocheck: {}".format( + senseidstocheck)) # log.info("Found sensess: {}".format(self.outputs)) # log.info("Found senses: {}".format(self.output)) return self.output From 479337b83b484a5383a48a86b86783c0ce2e3fb6 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:30:28 +0100 Subject: [PATCH 013/124] make new tasks available --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 08eff87b..4a82feb3 100755 --- a/main.py +++ b/main.py @@ -3984,6 +3984,9 @@ def makeoptions(self): tasks.append(ReportCitationTlocationBackground) tasks.append(ReportCitationBasicT) tasks.append(ReportCitationBasicTBackground) + if self.doneenough['analysis']: + tasks.append(ReportCitationByUF) + tasks.append(ReportCitationBasicVByUF) elif self.datacollection: tasks=[ WordCollectionCitation, From d714f4029ad4bff5f574be4794025561c14662cc Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:31:35 +0100 Subject: [PATCH 014/124] build in draft UF logic, with iteration --- main.py | 73 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index 4a82feb3..6dccb5b2 100755 --- a/main.py +++ b/main.py @@ -7481,6 +7481,14 @@ def makeresultsframe(self): else: log.error("Tried to get a results frame without a runwindow!") def getresults(self,**kwargs): + def iterateUFgroups(parent,**kwargs): + if 'x' in kwargs['check'] and kwargs['cvt'] != 'CV': #CV has no C=V... + self.docheckreport(parent,check=rx.sub('x','=',kwargs['check'], + count=1), + **kwargs) + self.docheckreport(parent,**kwargs) #this needs parent + if 'x' in check: + self.coocurrencetables(xlpr,**kwargs) self.getrunwindow() # self.makeresultsframe() #not for now, causing problems kwargs['cvt']=kwargs.get('cvt',self.params.cvt()) @@ -7506,12 +7514,24 @@ def getresults(self,**kwargs): ui.Label(self.results, text=text).grid(column=0, row=self.results.row) self.runwindow.wait() si=xlp.Section(xlpr,text) - if 'x' in check and cvt != 'CV': #CV has no C=V... - self.docheckreport(si,check=rx.sub('x','=',check, count=1)) - self.docheckreport(si) #this needs parent - if 'x' in check: - self.coocurrencetables(xlpr) - # These lines get all senseids, to test that we're not losing any, below + if self.byUFgroup: + analysis=self.makeanalysis() + analysis.donoUFanalysis() + # torecord=analysis.senseidsbygroup + ufgroupsnsenseids=analysis.senseidsbygroup.items() + kwargs['sectlevel']=4 + t=_("{} checks".format(self.params.cvtdict()[kwargs['cvt']]['sg'])) + for kwargs['ufgroup'],kwargs['ufsenseids'] in ufgroupsnsenseids: + if 'ufgroup' in kwargs: + log.info("Going to run {} report for UF group {}" + "".format(self.params.cvtdict()[kwargs['cvt']]['sg'], + kwargs['ufgroup'])) + sid=" ".join([t,"for",kwargs['ufgroup']]) + s2=xlp.Section(si,sid) #,level=2 + iterateUFgroups(s2,**kwargs) + else: + iterateUFgroups(si,**kwargs) + # These lines get all senseids, to test that we're not losing any, below # This is the first of three blocks to uncomment (on line, then logs) # self.regexCV=profile # self.regex=rx.fromCV(self,lang=self.analang, @@ -7908,9 +7928,19 @@ def printprofilesbyps(self): if ps in ['Invalid','analang']: continue print(ps, self.profilesbysense[ps]) - def basicreport(self): + def basicreport(self,**kwargs): """We iterate across these values in this script, so we save current values here, and restore them at the end.""" + def iteratecvt(parent,**kwargs): + for cvt in self.cvtstodo: + t=_("{} checks".format(self.params.cvtdict()[cvt]['sg'])) + print(t) + log.info(t) + sid=" ".join([t,"for",kwargs['profile'],kwargs['ps']+'s']) + s34=xlp.Section(parent,sid,level=kwargs['sectlevel']) + maxcount=rx.countxiny(cvt, kwargs['profile']) + # re.subn(cvt, cvt, profile)[1] + self.wordsbypsprofilechecksubcheck(s34,**kwargs) #Convert to iterate over local variables instr=_("The data in this report is given by most restrictive test " "first, followed by less restrictive tests (e.g., V1=V2 " @@ -7959,16 +7989,25 @@ def basicreport(self): s2=xlp.Section(s1,t,level=2) print(t) log.info(t) - for cvt in self.cvtstodo: - t=_("{} checks".format(self.params.cvtdict()[cvt]['sg'])) - print(t) - log.info(t) - sid=" ".join([t,"for",profile,ps+'s']) - s3=xlp.Section(s2,sid,level=3) - maxcount=rx.countxiny(cvt, profile) - # re.subn(cvt, cvt, profile)[1] - self.wordsbypsprofilechecksubcheck(s3,cvt=cvt,ps=ps, - profile=profile) + if self.byUFgroup: + analysis=self.makeanalysis() + analysis.donoUFanalysis() + # torecord=analysis.senseidsbygroup + ufgroupsnids=analysis.senseidsbygroup.items() + kwargs['sectlevel']=4 + for kwargs['ufgroup'],kwargs['ufsenseids'] in ufgroupsnids: + if 'ufgroup' in kwargs: + log.info("Going to run report for UF group {}" + "".format(kwargs['ufgroup'])) + sid=" ".join([t,"for",kwargs['ufgroup']]) + s3=xlp.Section(s2,sid,level=3) + iteratecvt(parent=s3,**kwargs) + # for check in self.checks: #self.checkcodesbyprofile: + # """multithread here""" + # self.docheckreport(parent,check=check,cvt=cvt,**kwargs) + else: + kwargs['sectlevel']=3 + iteratecvt(parent=s2,**kwargs) self.coocurrencetables(xlpr) log.info(self.checkcounts) xlpr.close(me=me) From e1e6527713f2aaea8f9ea0b0350f466e3def65a6 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 20 Sep 2022 10:32:02 +0100 Subject: [PATCH 015/124] test and report matching UF values --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 6dccb5b2..a43ff094 100755 --- a/main.py +++ b/main.py @@ -7671,7 +7671,9 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): """possibly iterating over all these parameters, used by buildregex""" self.buildregex(cvt=cvt,profile=profile,check=check,group=group) log.info("regexCV: {}; \nregex: {}".format(self.regexCV,self.regex)) - matches=set(self.senseidformsbyregex(self.regex,ps=ps)) + matches=set(self.senseidformsbyregex(self.regex,**kwargs)) + if 'ufgroup' in kwargs: + matches=matches&set(kwargs['ufsenseids']) if 'x' not in check and '=' not in check: #only pull from simple reports for ncvt in self.ncvts: #for basic reports try: # this removes senses already reported (e.g., in V1=V2) @@ -7753,6 +7755,8 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): titlebits='x'+ps+profile+check+group if 'x' in check: titlebits+='x'+othergroup + if 'ufgroup' in kwargs: + titlebits+=kwargs['ufgroup'] id=rx.id(titlebits) ex=xlp.Example(parent,id) for senseid in matches: From c0c247b8b9b4c2fd461be4483f517ecf5f1cb002 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 22 Sep 2022 17:11:02 +0100 Subject: [PATCH 016/124] allow for four wide --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index a67106c9..698cfcfa 100755 --- a/main.py +++ b/main.py @@ -3940,6 +3940,8 @@ def gettask(self,event=None): optionlist_maxi=len(optionlist)-1 if optionlist_maxi == 3: bpr=2 + elif optionlist_maxi > 9: + bpr=4 columnspan=1 for n,o in enumerate(optionlist): if n is optionlist_maxi and int(n/bpr): From b084a3cc612697635743df33c0e39200d953f7c3 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 22 Sep 2022 17:14:08 +0100 Subject: [PATCH 017/124] this needs to be the attr name --- xlp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xlp.py b/xlp.py index b21391ec..9e8a558d 100644 --- a/xlp.py +++ b/xlp.py @@ -297,7 +297,7 @@ def __init__(self,parent,title="No Section Title!",level=None,landscape=False): id=rx.id(title) if level: #this shouldn't happen self.level=level - elif hasattr(parent,level): #this should manage most cases + elif hasattr(parent,'level'): #this should manage most cases self.level=parent.level+1 else: self.level=1 From 1494e88a2c1e151538c377740a943be64ae793ff Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 10:37:48 +0100 Subject: [PATCH 018/124] this should give better info --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 698cfcfa..e6b48590 100755 --- a/main.py +++ b/main.py @@ -13554,10 +13554,12 @@ def name(x): program['name'],program['version'],mt)) log.info(_("Called with arguments ({}) {} / {}").format(sys.executable, sys.argv[0], sys.argv)) - log.info(_("Working directory is {} on {}, running on {} cores" + log.info(_("Working directory is {} on {}, running on {} cores, at {}Mhz" ).format(program['aztdir'], program['hostname'], - multiprocessing.cpu_count())) + multiprocessing.cpu_count(), + psutil.cpu_freq(percpu=True))) + log.info(_("Computer identifies as {}").format(platform.uname())) log.info(_("Loglevel is {}; started at {}").format(loglevel, program['start_time'].isoformat())) #'sendpraat' now in 'praat', if useful From 29f248496dd5cc6162f21c429dde03f50fc69744 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 10:37:54 +0100 Subject: [PATCH 019/124] also not None --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e6b48590..49353e98 100755 --- a/main.py +++ b/main.py @@ -12957,7 +12957,7 @@ def isinteger(x): try: int(x) return True - except ValueError: + except (ValueError,TypeError): return False def unlist(l,ignore=[None]): if l and isinstance(l[0],lift.ET.Element): From f297e2f36249098aaf5d355458b7fa7806f0e7aa Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 10:39:16 +0100 Subject: [PATCH 020/124] bring out tables for iteration --- main.py | 86 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/main.py b/main.py index 49353e98..92d1cded 100755 --- a/main.py +++ b/main.py @@ -8085,49 +8085,51 @@ def coocurrencetables(self,xlpr): s3s=xlp.Section(s2s,' '.join([ps,profile]),level=3) log.info("names used ({}-{}): {}".format(ps,profile, self.checkcounts[ps][profile].keys())) - checks=self.orderchecks(self.checkcounts[ps][profile].keys()) - for check in checks: - log.debug("Counts by ({}) check: {}".format( - check,self.checkcounts[ps][profile][check])) - rows=list(self.checkcounts[ps][profile][check]) - if not len(rows): - continue - if 'x' in check: - cols=list(self.checkcounts[ps][profile][check][rows[0]]) + for ufg in self.checkcounts[ps][profile]: + checks=self.orderchecks(self.checkcounts[ps][profile][ufg]) + for check in checks: + counts=self.checkcounts[ps][profile][ufg][check] + if len(list(counts)) and len([counts[k] for k in counts + ]): + log.debug("Counts by ({}-{}) check: {}".format(ufg, + check,counts)) + caption=' '.join([ufg,ps,profile,check]) + table=xlp.Table(s3s,caption) + self.coocurrencetable(table,check,counts) + def coocurrencetable(self,table,check,counts): + """This needs to work with an additional layer, for UF groups""" + """Basic report doesn't seem to put out any data""" + rows=list(counts)#self.checkcounts[ps][profile][check]) + if 'x' in check: + cols=list(counts[rows[0]]) + else: + cols=[check] + for x1 in ['header']+rows: + h=xlp.Row(table) + for x2 in ['header']+cols: + log.debug("x1: {}; x2: {}".format(x1,x2)) + # if x1 != 'header' and x2 not in ['header','n']: + # log.debug("value: {}".format(self.checkcounts[ + # ps][profile][name][x1][x2])) + if x1 == 'header' and x2 == 'header': + # log.debug("header corner") + # cell=xlp.Cell(h,content=name,header=True) + cell=xlp.Cell(h,content='',header=True) + elif x1 == 'header': + # log.debug("header row") + cell=xlp.Cell(h,content=x2,header=True) + elif x2 == 'header': + # log.debug("header column") + cell=xlp.Cell(h,content=x1,header=True) + else: + # log.debug("Not a header") + if x2 == check: + value=counts[x1] else: - cols=[check] - if not len(cols): - continue - caption=' '.join([ps,profile,check]) - t=xlp.Table(s3s,caption) - for x1 in ['header']+rows: - h=xlp.Row(t) - for x2 in ['header']+cols: - log.debug("x1: {}; x2: {}".format(x1,x2)) - # if x1 != 'header' and x2 not in ['header','n']: - # log.debug("value: {}".format(self.checkcounts[ - # ps][profile][name][x1][x2])) - if x1 == 'header' and x2 == 'header': - # log.debug("header corner") - # cell=xlp.Cell(h,content=name,header=True) - cell=xlp.Cell(h,content='',header=True) - elif x1 == 'header': - # log.debug("header row") - cell=xlp.Cell(h,content=x2,header=True) - elif x2 == 'header': - # log.debug("header column") - cell=xlp.Cell(h,content=x1,header=True) - else: - # log.debug("Not a header") - if x2 == check: - value=self.checkcounts[ps][ - profile][check][x1] - else: - value=self.checkcounts[ps][ - profile][check][x1][x2] - if not value: - value='' - cell=xlp.Cell(h,content=value) + value=counts[x1][x2] + if not value: + value='' + cell=xlp.Cell(h,content=value) def __init__(self): self.reportbasefilename=self.settings.reportbasefilename self.reporttoaudiorelURL=self.settings.reporttoaudiorelURL From 8919f8378aa64cd7f86c148fbc9c6f3c84b5e855 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 10:39:34 +0100 Subject: [PATCH 021/124] add ufgroup layer --- main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 92d1cded..991740a6 100755 --- a/main.py +++ b/main.py @@ -7994,13 +7994,17 @@ def basicreport(self,**kwargs): """We iterate across these values in this script, so we save current values here, and restore them at the end.""" def iteratecvt(parent,**kwargs): - for cvt in self.cvtstodo: - t=_("{} checks".format(self.params.cvtdict()[cvt]['sg'])) + if 'ufgroup' not in kwargs: + kwargs['ufgroup']=_("All") + for kwargs['cvt'] in self.cvtstodo: + t=_("{} checks".format(self.params.cvtdict()[ + kwargs['cvt']]['sg'])) print(t) log.info(t) - sid=" ".join([t,"for",kwargs['profile'],kwargs['ps']+'s']) + sid=" ".join([t,"for",kwargs['ufgroup'],kwargs['profile'], + kwargs['ps']+'s']) s34=xlp.Section(parent,sid,level=kwargs['sectlevel']) - maxcount=rx.countxiny(cvt, kwargs['profile']) + maxcount=rx.countxiny(kwargs['cvt'], kwargs['profile']) # re.subn(cvt, cvt, profile)[1] self.wordsbypsprofilechecksubcheck(s34,**kwargs) #Convert to iterate over local variables From 5150069bed16ab13dc038ac1a19818bd8f838a12 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 10:40:36 +0100 Subject: [PATCH 022/124] use kwargs --- main.py | 69 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 30 deletions(-) diff --git a/main.py b/main.py index 991740a6..ed42ee6c 100755 --- a/main.py +++ b/main.py @@ -7857,17 +7857,18 @@ def wordsbypsprofilechecksubcheck(self,parent='NoXLPparent',**kwargs): possible values (as above), then restore the value.""" """I need to find a way to limit these tests to appropriate profiles...""" - cvt=kwargs.pop('cvt',self.params.cvt()) #only send on one + kwargs['cvt']=kwargs.get('cvt',self.params.cvt()) #only send on one ps=kwargs.get('ps',self.slices.ps()) - profile=kwargs.get('profile',self.slices.profile()) - groups=self.status.groups(cvt=cvt) + kwargs['profile']=kwargs.get('profile',self.slices.profile()) + groups=self.status.groups(**kwargs) #was cvt only #CV checks depend on profile, too - checksunordered=self.status.checks(cvt=cvt,profile=profile) + checksunordered=self.status.checks(**kwargs) self.checks=self.orderchecks(checksunordered) """check set here""" - for check in self.checks: #self.checkcodesbyprofile: + for kwargs['check'] in self.checks: #self.checkcodesbyprofile: """multithread here""" - self.docheckreport(parent,check=check,cvt=cvt,**kwargs) + self.docheckreport(parent, + **kwargs) def orderchecks(self,checklist): checks=sorted([i for i in checklist if '=' in i], key=len, reverse=True) checks+=sorted([i for i in checklist if '=' not in i @@ -7875,44 +7876,52 @@ def orderchecks(self,checklist): checks+=sorted([i for i in checklist if 'x' in i], key=len) return checks def docheckreport(self,parent,**kwargs): - cvt=kwargs.get('cvt',self.params.cvt()) - ps=kwargs.get('ps',self.slices.ps()) - profile=kwargs.get('profile',self.slices.profile()) - check=kwargs.pop('check',self.params.check()) #don't pass this twice! - groups=self.status.groups(cvt=cvt) + kwargs['cvt']=kwargs.get('cvt',self.params.cvt()) + kwargs['ps']=kwargs.get('ps',self.slices.ps()) + kwargs['profile']=kwargs.get('profile',self.slices.profile()) + kwargs['check']=kwargs.get('check',self.params.check()) + groups=self.status.groups(**kwargs) group=self.status.group() - self.ncvts=rx.split('[=x]',check) - if 'x' in check: + self.ncvts=rx.split('[=x]',kwargs['check']) + if 'x' in kwargs['check']: log.debug('Hey, I cound a correspondence number!') - if cvt in ['V','C']: + if kwargs['cvt'] in ['V','C']: groupcomparisons=groups - elif cvt == 'CV': + elif kwargs['cvt'] == 'CV': groups=self.status.groups(cvt='C') groupcomparisons=self.status.groups(cvt='V') else: log.error("Sorry, I don't know how to compare cvt: {}" - "".format(cvt)) + "".format(kwargs['cvt'])) log.info("Going to run report for groups {}".format(groups)) log.info("With comparison groups {}".format(groupcomparisons)) - for group in groups: + for kwargs['group'] in groups: for self.groupcomparison in groupcomparisons: - if group != self.groupcomparison: - t=_("{} {} {}={}-{}".format(ps,profile, - check,group, - self.groupcomparison)) - self.wordsbypsprofilechecksubcheckp(parent,t, - check=check, group=group,**kwargs) + if kwargs['group'] != self.groupcomparison: + t=_("{} {} {} {}={}-{}".format(kwargs['ps'], + kwargs['profile'], + kwargs['ufgroup'], + kwargs['check'], + kwargs['group'], + self.groupcomparison)) + self.wordsbypsprofilechecksubcheckp(parent,t,**kwargs) elif group: log.info("Going to run report just for group {}".format(group)) - t=_("{} {} {}={}".format(ps,profile,check,group)) - self.wordsbypsprofilechecksubcheckp(parent,t, - check=check, group=group,**kwargs) + t=_("{} {} {} {}={}".format(kwargs['ps'], + kwargs['profile'], + kwargs['ufgroup'], + kwargs['check'], + group)) + self.wordsbypsprofilechecksubcheckp(parent,t,group=group,**kwargs) elif groups: log.info("Going to run report for groups {}".format(groups)) - for group in groups: - t=_("{} {} {}={}".format(ps,profile,check,group)) - self.wordsbypsprofilechecksubcheckp(parent,t, - check=check, group=group,**kwargs) + for kwargs['group'] in groups: + t=_("{} {} {} {}={}".format(kwargs['ps'], + kwargs['profile'], + kwargs['ufgroup'], + kwargs['check'], + kwargs['group'])) + self.wordsbypsprofilechecksubcheckp(parent,t,**kwargs) def idXLP(self,framed): id='x' #string! bits=[ From 812593d02bf91914f9781111c0c0c14a2de67b10 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 10:43:01 +0100 Subject: [PATCH 023/124] simplify dictionary building --- main.py | 71 +++++++++++++++++++++++---------------------------------- 1 file changed, 29 insertions(+), 42 deletions(-) diff --git a/main.py b/main.py index ed42ee6c..762d1db9 100755 --- a/main.py +++ b/main.py @@ -7710,6 +7710,7 @@ def xlpstart(self,**kwargs): xlpreport.addlang({'id':lang,'name': self.settings.languagenames[lang]}) return xlpreport def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): + log.info("Kwargs (wordsbypsprofilechecksubcheckp): {}".format(kwargs)) cvt=kwargs.get('cvt',self.params.cvt()) ps=kwargs.get('ps',self.slices.ps()) profile=kwargs.get('profile',self.slices.profile()) @@ -7744,28 +7745,27 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): log.info("Not removing ncvt {} ids from basic reported; " "hope that's appropriate." "".format(ncvt)) + ufg=kwargs['ufgroup'] + n=len(matches) # log.info("{} matches found!: {}".format(len(matches),matches)) if 'x' not in check: try: - n=self.checkcounts[ps][profile][check][group]=len(matches) - except: + self.checkcounts[ps][profile][ufg][check][group]=n + except KeyError: try: - self.checkcounts[ps][profile][check]={} - n=self.checkcounts[ps][profile][check][group]=len(matches) - except: + self.checkcounts[ps][profile][ufg][check]={group:n} + except KeyError: try: - self.checkcounts[ps][profile]={} - self.checkcounts[ps][profile][check]={} - n=self.checkcounts[ps][profile][check][ - group]=len(matches) - except: - self.checkcounts[ps]={} - self.checkcounts[ps][profile]={} - self.checkcounts[ps][profile][check]={} - log.info("ps: {}, profile: {}, check: {}, group: {}" - "".format(ps,profile,check,group)) - n=self.checkcounts[ps][profile][check][ - group]=len(matches) + self.checkcounts[ps][profile][ufg]={check:{group:n}} + except KeyError: + try: + self.checkcounts[ps][profile]={ufg:{check:{ + group:n}}} + except KeyError: + self.checkcounts[ps]={profile:{ufg:{check:{ + group:n}}}} + log.info("ps: {}, profile: {}, check: {}, group: {}" + "".format(ps,profile,check,group)) if 'x' in check or len(check.split('=')) == 2: if 'x' in check: othergroup=self.groupcomparison @@ -7774,41 +7774,28 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): othergroup=group check=rx.sub('=','x',check, count=1) try: - n=self.checkcounts[ps][profile][check][ group][othergroup]=len(matches) + self.checkcounts[ps][profile][ufg][check][ + group][othergroup]=n except KeyError: try: - self.checkcounts[ps][profile][check][group]={} - n=self.checkcounts[ps][profile][check][ - group][othergroup]=len(matches) + self.checkcounts[ps][profile][ufg][check][ + group]={othergroup:n} except KeyError: try: - self.checkcounts[ps][profile][check]={} - self.checkcounts[ps][profile][check][group]={} - n=self.checkcounts[ps][profile][check][ - group][othergroup]=len(matches) + self.checkcounts[ps][profile][ufg][check]={group:{ + othergroup:n}} except KeyError: try: - self.checkcounts[ps][profile]={} - self.checkcounts[ps][profile][check]={} - self.checkcounts[ps][profile][check][group]={} - n=self.checkcounts[ps][profile][check][ - group][othergroup]=len(matches) + self.checkcounts[ps][profile][ufg]={check:{group:{ + othergroup:n}}} except KeyError: try: - self.checkcounts[ps]={} - self.checkcounts[ps][profile]={} - self.checkcounts[ps][profile][check]={} - self.checkcounts[ps][profile][check][group]={} - n=self.checkcounts[ps][profile][check][ - group][othergroup]=len(matches) + self.checkcounts[ps][profile]={ufg:{check:{ + group:{othergroup:n}}}} except KeyError: - self.checkcounts[ps]={} - self.checkcounts[ps][profile]={} - self.checkcounts[ps][profile][check]={} - self.checkcounts[ps][profile][check][group]={} - n=self.checkcounts[ps][profile][check][ - group][othergroup]=len(matches) + self.checkcounts[ps]={profile:{ufg:{check:{ + group:{othergroup:n}}}}} if n>0: titlebits='x'+ps+profile+check+group if 'x' in check: From 84ec5d0efe31577a9b807346b46814df568151ec Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 10:44:25 +0100 Subject: [PATCH 024/124] cleanup --- main.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 762d1db9..51f8dcd5 100755 --- a/main.py +++ b/main.py @@ -60,6 +60,7 @@ import itertools import importlib.util import collections +import psutil from random import randint if program['tkinter']==True: try: @@ -7545,8 +7546,7 @@ def iterateUFgroups(parent,**kwargs): count=1), **kwargs) self.docheckreport(parent,**kwargs) #this needs parent - if 'x' in check: - self.coocurrencetables(xlpr,**kwargs) + self.coocurrencetables(xlpr) self.getrunwindow() # self.makeresultsframe() #not for now, causing problems kwargs['cvt']=kwargs.get('cvt',self.params.cvt()) @@ -7774,7 +7774,6 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): othergroup=group check=rx.sub('=','x',check, count=1) try: - group][othergroup]=len(matches) self.checkcounts[ps][profile][ufg][check][ group][othergroup]=n except KeyError: From 60b4abeb7d0b8668ab500742f84a89a7d2001323 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 11:10:40 +0100 Subject: [PATCH 025/124] set up default --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 5502a66f..cc626660 100755 --- a/main.py +++ b/main.py @@ -4,7 +4,8 @@ program={'name':'A→Z+T'} program['tkinter']=True program['production']=False #True for making screenshots (default theme) -program['testing']=False #True eliminates Error screens and zipped logs, git +program['testing']=True #True eliminates Error screens and zipped logs, repos +program['testing']=False program['demo']=True #sets me=False, production=True, testing=False program['demo']=False program['version']='0.9.6' #This is a string... From 549888c82088b034c531073e3bef3a387190f350 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 11:16:38 +0100 Subject: [PATCH 026/124] cleanup --- main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.py b/main.py index cc626660..89497d6c 100755 --- a/main.py +++ b/main.py @@ -7856,8 +7856,7 @@ def wordsbypsprofilechecksubcheck(self,parent='NoXLPparent',**kwargs): """check set here""" for kwargs['check'] in self.checks: #self.checkcodesbyprofile: """multithread here""" - self.docheckreport(parent, - **kwargs) + self.docheckreport(parent,**kwargs) def orderchecks(self,checklist): checks=sorted([i for i in checklist if '=' in i], key=len, reverse=True) checks+=sorted([i for i in checklist if '=' not in i From be7a892db3b5f2aa9f22f16e9e03a8ff666cfbff Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 11:16:54 +0100 Subject: [PATCH 027/124] better check for this, as ufgroup is set to _("All") --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 89497d6c..0fed12fc 100755 --- a/main.py +++ b/main.py @@ -7734,7 +7734,7 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): self.buildregex(cvt=cvt,profile=profile,check=check,group=group) log.info("regexCV: {}; \nregex: {}".format(self.regexCV,self.regex)) matches=set(self.senseidformsbyregex(self.regex,**kwargs)) - if 'ufgroup' in kwargs: + if 'ufsenseids' in kwargs: matches=matches&set(kwargs['ufsenseids']) if 'x' not in check and '=' not in check: #only pull from simple reports for ncvt in self.ncvts: #for basic reports From 0832753b79c965f6efb4481ae779b2008ff55790 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 12:37:19 +0100 Subject: [PATCH 028/124] make this available --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 0fed12fc..12d3061a 100755 --- a/main.py +++ b/main.py @@ -4032,6 +4032,7 @@ def makeoptions(self): if self.showreports: tasks=[ ReportCitation, + ReportCitationBackground ] if self.doneenough['collectionlc']: """This currently takes way too much time. Until it gets From 984db599583838ed9c2a8bef195ababb2cf42d7a Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 12:38:00 +0100 Subject: [PATCH 029/124] multi different reports --- main.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 12d3061a..2b349d8f 100755 --- a/main.py +++ b/main.py @@ -9234,7 +9234,7 @@ def tooltip(self): "\n- Consonant-Vowel Correspondence") def dobuttonkwargs(self): return {'text':"Report!", - 'fn':self.runcheck, + 'fn':self.do, # column=0, 'font':'title', 'compound':'bottom', #image bottom, left, right, or top of text @@ -9277,6 +9277,14 @@ def __init__(self, parent): #frame, filename=None ui.Window.__init__(self,parent) TaskDressing.__init__(self,parent) Report.__init__(self) +class ReportCitationBackground(ReportCitation): + """docstring for ReportCitation.""" + def tasktitle(self): + return _("Alphabet Report (Background)") # on One Data Slice + def __init__(self, parent): #frame, filename=None + self.reportfn=self.getresults + ReportCitation.__init__(self,parent) + self.do=self.reportmulti class ReportCitationByUF(ByUF,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): @@ -9503,7 +9511,8 @@ def dobuttonkwargs(self): def __init__(self, parent): #frame, filename=None Tone.__init__(self) ui.Window.__init__(self,parent) - self.do=self.tonegroupreportmulti + self.do=self.reportmulti + self.reportfn=self.tonegroupreport TaskDressing.__init__(self,parent) self.settings.maxprofiles=None self.settings.maxpss=None @@ -9560,8 +9569,8 @@ def dobuttonkwargs(self): def __init__(self, parent): #frame, filename=None Tone.__init__(self) ui.Window.__init__(self,parent) - self.do=self.tonegroupreportmulti - # self.do=self.tonegroupreport + self.do=self.reportmulti + self.reportfn=self.tonegroupreport TaskDressing.__init__(self,parent) Report.__init__(self) self.bylocation=True From 2e28da12f5170d37b773e74ab31e7361804da648 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 12:38:16 +0100 Subject: [PATCH 030/124] multi --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 2b349d8f..c23c7548 100755 --- a/main.py +++ b/main.py @@ -9275,6 +9275,7 @@ def runcheck(self): def __init__(self, parent): #frame, filename=None Segments.__init__(self,parent) ui.Window.__init__(self,parent) + self.do=self.getresults TaskDressing.__init__(self,parent) Report.__init__(self) class ReportCitationBackground(ReportCitation): From bd4918936062e5279831ed98e325da9456b3b9dd Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 12:39:00 +0100 Subject: [PATCH 031/124] move to usegui --- main.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index c23c7548..fc007358 100755 --- a/main.py +++ b/main.py @@ -7551,8 +7551,12 @@ def iterateUFgroups(parent,**kwargs): **kwargs) self.docheckreport(parent,**kwargs) #this needs parent self.coocurrencetables(xlpr) - self.getrunwindow() - # self.makeresultsframe() #not for now, causing problems + log.info("getresults starting with kwargs {}".format(kwargs)) + usegui=kwargs['usegui']=kwargs.get('usegui',True) + log.info("getresults continuing with kwargs {}".format(kwargs)) + if usegui: + self.getrunwindow() + self.makeresultsframe() #not for now, causing problems kwargs['cvt']=kwargs.get('cvt',self.params.cvt()) kwargs['ps']=kwargs.get('ps',self.slices.ps()) kwargs['profile']=kwargs.get('profile',self.slices.profile()) @@ -7572,9 +7576,9 @@ def iterateUFgroups(parent,**kwargs): text=(_("{} roots of form {} by {}".format(kwargs['ps'], kwargs['profile'], kwargs['check']))) - if hasattr(self,'results'): #i.e., showing results in window + if usegui: #i.e., showing results in window ui.Label(self.results, text=text).grid(column=0, row=self.results.row) - self.runwindow.wait() + self.runwindow.wait() si=xlp.Section(xlpr,text) if self.byUFgroup: analysis=self.makeanalysis() @@ -7606,9 +7610,10 @@ def iterateUFgroups(parent,**kwargs): # log.info("senseidsnotsearchable: {}".format(len(senseidsnotsearchable))) # log.info("senseidsnotsearchable: {}".format(senseidsnotsearchable)) xlpr.close(me=me) - self.runwindow.waitdone() - if not hasattr(self,'results'): #i.e., showing results in window - self.runwindow.on_quit() + if usegui: + self.runwindow.waitdone() + if not hasattr(self,'results'): #i.e., showing results in window + self.runwindow.on_quit() # Report on testing blocks above # log.info("senseids remaining (rx): ({}) {}".format( # len(rxsenseidsinslice), @@ -7634,7 +7639,7 @@ def iterateUFgroups(parent,**kwargs): if not n: #i.e., nothing was found above text=_("No results for {}/{} ({})!").format(profile,check,ps) log.info(text) - if hasattr(self,'results'): #i.e., showing results in window + if usegui: #i.e., showing results in window ui.Label(self.results, text=text, column=0, row=self.results.row+1) return def buildXLPtable(self,parent,caption,yterms,xterms,values,ycounts=None,xcounts=None): @@ -7715,6 +7720,7 @@ def xlpstart(self,**kwargs): return xlpreport def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): log.info("Kwargs (wordsbypsprofilechecksubcheckp): {}".format(kwargs)) + usegui=kwargs.get('usegui',True) cvt=kwargs.get('cvt',self.params.cvt()) ps=kwargs.get('ps',self.slices.ps()) profile=kwargs.get('profile',self.slices.profile()) @@ -7820,7 +7826,7 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): self.basicreported[ncvt]=set([senseid]) framed=self.taskchooser.datadict.getframeddata(senseid) self.framedtoXLP(framed,parent=ex,ftype=ftype,listword=True) #showgroups? - if hasattr(self,'results'): #i.e., showing results in window + if usegui: #i.e., showing results in window self.results.row+=1 col=0 for lang in [self.analang]+self.glosslangs: From 1cbbdc7318c09a57d494bb3ebd4733775a392db3 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 12:39:13 +0100 Subject: [PATCH 032/124] make this always there --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index fc007358..8cc24b55 100755 --- a/main.py +++ b/main.py @@ -7596,6 +7596,7 @@ def iterateUFgroups(parent,**kwargs): s2=xlp.Section(si,sid) #,level=2 iterateUFgroups(s2,**kwargs) else: + kwargs['ufgroup']=_("All") iterateUFgroups(si,**kwargs) # These lines get all senseids, to test that we're not losing any, below # This is the first of three blocks to uncomment (on line, then logs) From 124f43f5f80b0a9d3c57e6378782ce02d1e1574e Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 12:39:36 +0100 Subject: [PATCH 033/124] only call this once --- main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.py b/main.py index 8cc24b55..912981ef 100755 --- a/main.py +++ b/main.py @@ -7546,9 +7546,7 @@ def makeresultsframe(self): def getresults(self,**kwargs): def iterateUFgroups(parent,**kwargs): if 'x' in kwargs['check'] and kwargs['cvt'] != 'CV': #CV has no C=V... - self.docheckreport(parent,check=rx.sub('x','=',kwargs['check'], - count=1), - **kwargs) + kwargs['check']=rx.sub('x','=',kwargs['check'],count=1) self.docheckreport(parent,**kwargs) #this needs parent self.coocurrencetables(xlpr) log.info("getresults starting with kwargs {}".format(kwargs)) From 50bd326eb9643d4c0d23f1011c8100a184072b30 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 12:40:52 +0100 Subject: [PATCH 034/124] log less --- main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 912981ef..d270f6f1 100755 --- a/main.py +++ b/main.py @@ -7212,7 +7212,9 @@ def tonegroupreportcomprehensive(self,**kwargs): def tonegroupreportmulti(self,**kwargs): # threading.Thread(target=self.tonegroupreport,kwargs=kwargs).start() start_time=nowruntime() + # log.info("reportmulti starting with kwargs {}".format(kwargs)) kwargs['usegui']=False + # log.info("reportmulti continuing with kwargs {}".format(kwargs)) if hasattr(self.settings,'maxpss') and self.settings.maxpss: pss=self.slices.pss()[:self.settings.maxpss] else: @@ -7232,6 +7234,7 @@ def tonegroupreportmulti(self,**kwargs): kwargs['ps']=ps kwargs['profile']=profile t=multiprocessing.Process(target=self.tonegroupreport, + # log.info("reportmulti background with kwargs {}".format(kwargs)) kwargs=kwargs) t.start() log.info(_("Starting XLP background report with kwargs {}" @@ -7251,6 +7254,7 @@ def tonegroupreportmulti(self,**kwargs): log.info(_("Starting reports that didn't work in the background: {}").format(unbackground)) for kwargs in unbackground: self.tonegroupreport(**kwargs) #run what failed in background here + # log.info("reportmulti unbackground with kwargs {}".format(kwargs)) logfinished(start_time,msg="all reports ({})".format(all)) def tonegroupreport(self,usegui=True,**kwargs): """This should iterate over at least some profiles; top 2-3? @@ -7549,9 +7553,9 @@ def iterateUFgroups(parent,**kwargs): kwargs['check']=rx.sub('x','=',kwargs['check'],count=1) self.docheckreport(parent,**kwargs) #this needs parent self.coocurrencetables(xlpr) - log.info("getresults starting with kwargs {}".format(kwargs)) + # log.info("getresults starting with kwargs {}".format(kwargs)) usegui=kwargs['usegui']=kwargs.get('usegui',True) - log.info("getresults continuing with kwargs {}".format(kwargs)) + # log.info("getresults continuing with kwargs {}".format(kwargs)) if usegui: self.getrunwindow() self.makeresultsframe() #not for now, causing problems From 8467583449088c199461df0b15679ea0243bc3d2 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 12:41:24 +0100 Subject: [PATCH 035/124] generalize --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index d270f6f1..9f943803 100755 --- a/main.py +++ b/main.py @@ -7209,7 +7209,7 @@ def tonegroupreportcomprehensive(self,**kwargs): # with multiprocessing.Pool(processes=4) as pool: # pool.map(self.tonegroupreport,[ # {'ps':ps,'profile':p,'usegui':False} for p in d[ps]]) - def tonegroupreportmulti(self,**kwargs): + def reportmulti(self,**kwargs): # threading.Thread(target=self.tonegroupreport,kwargs=kwargs).start() start_time=nowruntime() # log.info("reportmulti starting with kwargs {}".format(kwargs)) @@ -7233,8 +7233,8 @@ def tonegroupreportmulti(self,**kwargs): for profile in d[ps]: kwargs['ps']=ps kwargs['profile']=profile - t=multiprocessing.Process(target=self.tonegroupreport, # log.info("reportmulti background with kwargs {}".format(kwargs)) + t=multiprocessing.Process(target=self.reportfn, kwargs=kwargs) t.start() log.info(_("Starting XLP background report with kwargs {}" @@ -7253,8 +7253,8 @@ def tonegroupreportmulti(self,**kwargs): logfinished(start_time,msg="setting up background reports {}".format(done)) log.info(_("Starting reports that didn't work in the background: {}").format(unbackground)) for kwargs in unbackground: - self.tonegroupreport(**kwargs) #run what failed in background here # log.info("reportmulti unbackground with kwargs {}".format(kwargs)) + self.reportfn(**kwargs) #run what failed in background here logfinished(start_time,msg="all reports ({})".format(all)) def tonegroupreport(self,usegui=True,**kwargs): """This should iterate over at least some profiles; top 2-3? From 9da2a3c859318ec62e6cfd3bdceec90123e86823 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Fri, 23 Sep 2022 13:57:51 +0100 Subject: [PATCH 036/124] generalizing reports --- main.py | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index 9f943803..ab6a818b 100755 --- a/main.py +++ b/main.py @@ -4049,6 +4049,7 @@ def makeoptions(self): tasks.append(ReportCitationBasicTBackground) if self.doneenough['analysis']: tasks.append(ReportCitationByUF) + tasks.append(ReportCitationByUFBackground) tasks.append(ReportCitationBasicVByUF) elif self.datacollection: tasks=[ @@ -8158,6 +8159,12 @@ def __init__(self): Tone.__init__(self) self.byUFgroup=True log.info("doing report by UF groups") +class Background(object): + """This class runs a report function in the background, where possible""" + def __init__(self, arg): + super(Background, self).__init__() + self.reportfn=self.do + self.do=self.reportmulti class SortCV(Sort,Segments,TaskDressing,ui.Window): """docstring for SortCV.""" def __init__(self, parent): @@ -9287,34 +9294,33 @@ def __init__(self, parent): #frame, filename=None self.do=self.getresults TaskDressing.__init__(self,parent) Report.__init__(self) -class ReportCitationBackground(ReportCitation): +class ReportCitationBackground(Background,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): return _("Alphabet Report (Background)") # on One Data Slice def __init__(self, parent): #frame, filename=None - self.reportfn=self.getresults + # self.reportfn=self.getresults ReportCitation.__init__(self,parent) - self.do=self.reportmulti + Background.__init__(self,parent) + # self.do=self.reportmulti class ReportCitationByUF(ByUF,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): return _("Alphabet Report by Tone group") # on One Data Slice - def taskicon(self): - return program['theme'].photo['iconReport'] def __init__(self, parent): #frame, filename=None ReportCitation.__init__(self, parent) ByUF.__init__(self) -class ReportCitationBasic(Report,Comprehensive,Segments,TaskDressing,ui.Window): +class ReportCitationByUFBackground(ByUF,ReportCitationBackground): + """docstring for ReportCitation.""" + def tasktitle(self): + return _("Alphabet Report by Tone group (Background)") # on One Data Slice + def __init__(self, parent): #frame, filename=None + ReportCitationBackground.__init__(self, parent) + ByUF.__init__(self) +class ReportCitationBasic(Comprehensive,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): return _("Comprehensive Alphabet Report") # on Citation Forms - def taskicon(self): - return program['theme'].photo['iconVCCVRepcomp'] - def tooltip(self): - return _("This report gives you reports across multiple lexical " - "categories, and across multiple syllable profiles. \nIt does " - "this for three sets of reports: \n- Vowel, \n- Consonant, and " - "\n- Consonant-Vowel Correspondence") def dobuttonkwargs(self): return {'text':"Report!", 'fn':self.basicreport, @@ -9325,10 +9331,10 @@ def dobuttonkwargs(self): 'sticky':'ew' } def __init__(self, parent): #frame, filename=None - Segments.__init__(self,parent) - ui.Window.__init__(self,parent) - TaskDressing.__init__(self,parent) - Report.__init__(self) + ReportCitation.__init__(self,parent) + # ui.Window.__init__(self,parent) + # TaskDressing.__init__(self,parent) + # Report.__init__(self) self.cvtstodo=['V','C','CV'] Comprehensive.__init__(self) class ReportCitationBasicV(Report,Comprehensive,Segments,TaskDressing,ui.Window): From f7dfc69ec6f190242a444981c8f46fe7830c2d5e Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Mon, 26 Sep 2022 08:44:13 +0100 Subject: [PATCH 037/124] where I'm at with reports --- main.py | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/main.py b/main.py index e8f53772..6b2439a8 100755 --- a/main.py +++ b/main.py @@ -7878,7 +7878,7 @@ def docheckreport(self,parent,**kwargs): elif kwargs['cvt'] == 'CV': groups=self.status.groups(cvt='C') groupcomparisons=self.status.groups(cvt='V') - elif cvt == 'VC': + elif kwargs['cvt'] == 'VC': groups=self.status.groups(cvt='V') groupcomparisons=self.status.groups(cvt='C') else: @@ -8148,15 +8148,18 @@ def __init__(self): self.status.group())) class ByUF(Tone): def __init__(self): - Tone.__init__(self) + Tone.__init__(self) #Nothing here; just make methods available self.byUFgroup=True log.info("doing report by UF groups") class Background(object): """This class runs a report function in the background, where possible""" - def __init__(self, arg): - super(Background, self).__init__() + def __init__(self,parent): + log.info("Setting up background report, based on {}" + "".format(self.do.__name__)) + super(Background, self).__init__(parent) self.reportfn=self.do self.do=self.reportmulti + self.frame.status.finalbuttons() #because the fns changed class SortCV(Sort,Segments,TaskDressing,ui.Window): """docstring for SortCV.""" def __init__(self, parent): @@ -9315,7 +9318,7 @@ def tasktitle(self): return _("Comprehensive Alphabet Report") # on Citation Forms def dobuttonkwargs(self): return {'text':"Report!", - 'fn':self.basicreport, + 'fn':self.do, # column=0, 'font':'title', 'compound':'bottom', #image bottom, left, right, or top of text @@ -9324,6 +9327,7 @@ def dobuttonkwargs(self): } def __init__(self, parent): #frame, filename=None ReportCitation.__init__(self,parent) + self.do=self.basicreport # ui.Window.__init__(self,parent) # TaskDressing.__init__(self,parent) # Report.__init__(self) @@ -9389,42 +9393,32 @@ def __init__(self, parent): #frame, filename=None self.cvtstodo=['C'] # This is really hard on memory, with correspondences. Comprehensive.__init__(self) -class ReportCitationBasicCV(ReportCitationBasic): +class ReportCitationBasicCV(Comprehensive,Background,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): return _("Comprehensive CxV Phonotactics Report") # on Citation Forms def taskicon(self): return program['theme'].photo['iconCVRepcomp'] - def dobuttonkwargs(self): - return {'text':"Report!", - 'fn':self.basicreport, - # column=0, - 'font':'title', - 'compound':'bottom', #image bottom, left, right, or top of text - 'image':self.taskchooser.theme.photo['CVRepcomp'], - 'sticky':'ew' - } def __init__(self, parent): #frame, filename=None - ReportCitationBasic.__init__(self,parent) + ReportCitation.__init__(self,parent) self.cvtstodo=['CV'] -class ReportCitationBasicVC(ReportCitationBasic): + Comprehensive.__init__(self) + Background.__init__(self,parent) + log.info("Setting up reports with cvtstodo: {}; do: {}; reportfn:{}" + "".format(self.cvtstodo,self.do.__name__,self.reportfn.__name__)) +class ReportCitationBasicVC(Comprehensive,Background,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): return _("Comprehensive VxC Phonotactics Report") # on Citation Forms def taskicon(self): return program['theme'].photo['iconCVRepcomp'] - def dobuttonkwargs(self): - return {'text':"Report!", - 'fn':self.basicreport, - # column=0, - 'font':'title', - 'compound':'bottom', #image bottom, left, right, or top of text - 'image':self.taskchooser.theme.photo['CVRepcomp'], - 'sticky':'ew' - } def __init__(self, parent): #frame, filename=None - ReportCitationBasic.__init__(self,parent) + ReportCitation.__init__(self,parent) self.cvtstodo=['VC'] + Comprehensive.__init__(self) + Background.__init__(self,parent) + log.info("Setting up reports with cvtstodo: {}; do: {}; reportfn:{}" + "".format(self.cvtstodo,self.do.__name__,self.reportfn.__name__)) class ReportConsultantCheck(Report,Tone,TaskDressing,ui.Window): """docstring for ReportCitationT.""" def tasktitle(self): From 9c242c40b31bc0a3a10bbca5a2249a631c82b1ef Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Mon, 26 Sep 2022 21:23:44 +0100 Subject: [PATCH 038/124] need this to remove old (first) defns --- main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.py b/main.py index 5bf09c67..c6b3f09f 100755 --- a/main.py +++ b/main.py @@ -765,6 +765,10 @@ def maxes(self): self.opts['columnplus']=1 t=(_("Max lexical categories: {}".format(self.settings.maxpss))) self.proselabel(t,cmd=self.taskchooser.getmaxpss,parent=line) + def redofinalbuttons(self): + if hasattr(self,'bigbutton') and self.bigbutton.winfo_exists(): + self.bigbutton.destroy() + self.finalbuttons() def finalbuttons(self): # self.opts['row']+=6 self.opts['row']+=1 From 43ff5761a924c9969c59dafadc02575363e61574 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Mon, 26 Sep 2022 21:24:07 +0100 Subject: [PATCH 039/124] same --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index c6b3f09f..40868131 100755 --- a/main.py +++ b/main.py @@ -8165,7 +8165,7 @@ def __init__(self,parent): super(Background, self).__init__(parent) self.reportfn=self.do self.do=self.reportmulti - self.frame.status.finalbuttons() #because the fns changed + self.frame.status.redofinalbuttons() #because the fns changed class SortCV(Sort,Segments,TaskDressing,ui.Window): """docstring for SortCV.""" def __init__(self, parent): From 450e90f312bde8b2928862000857fa07a8757bc7 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Mon, 26 Sep 2022 22:27:21 +0100 Subject: [PATCH 040/124] this generates distinct filenames for each --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 40868131..290d24eb 100755 --- a/main.py +++ b/main.py @@ -7564,7 +7564,7 @@ def iterateUFgroups(parent,**kwargs): ,str(kwargs['check']) ,'ReportXLP.xml']) self.checkcounts={} - xlpr=self.xlpstart() + xlpr=self.xlpstart(**kwargs) """"Do I need this?""" print(_("Getting results of Search request")) c1 = "Any" From efb7da46ccba3a6e70bd9c35fbe562d3af81d2a6 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Mon, 26 Sep 2022 22:27:40 +0100 Subject: [PATCH 041/124] generalize --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 290d24eb..c8a6fadb 100755 --- a/main.py +++ b/main.py @@ -9351,7 +9351,7 @@ def tooltip(self): "this just for vowel checks.") def dobuttonkwargs(self): return {'text':"Report!", - 'fn':self.basicreport, + 'fn':self.do, # column=0, 'font':'title', 'compound':'bottom', #image bottom, left, right, or top of text From 9471b94e54126d704498d394c91da9bd7ce106f0 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Mon, 26 Sep 2022 22:27:50 +0100 Subject: [PATCH 042/124] generalize --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index c8a6fadb..6a63c8a1 100755 --- a/main.py +++ b/main.py @@ -8150,6 +8150,7 @@ def __init__(self): class Comprehensive(object): def __init__(self): self.status.group(None) + self.do=self.basicreport log.info("doing basic report on {} with groups {}".format(self.cvtstodo, self.status.group())) class ByUF(Tone): From b941fefb3ecddb260191d65e0eba9ba9b0322f11 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Mon, 26 Sep 2022 22:28:14 +0100 Subject: [PATCH 043/124] use kwargs --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 6a63c8a1..580918a2 100755 --- a/main.py +++ b/main.py @@ -7225,10 +7225,10 @@ def reportmulti(self,**kwargs): log.info("Starting background reports for {}".format(d)) unbackground=[] all=[] - for ps in pss: - for profile in d[ps]: - kwargs['ps']=ps - kwargs['profile']=profile + for kwargs['ps'] in pss: + for kwargs['profile'] in d[kwargs['ps']]: + # kwargs['ps']=ps + # kwargs['profile']=profile # log.info("reportmulti background with kwargs {}".format(kwargs)) t=multiprocessing.Process(target=self.reportfn, kwargs=kwargs) From 597038d1bb3cdd33a6d3a6819b7e113b4c530dbb Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Mon, 26 Sep 2022 22:28:39 +0100 Subject: [PATCH 044/124] log more --- main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 580918a2..e45fcd66 100755 --- a/main.py +++ b/main.py @@ -7208,7 +7208,8 @@ def tonegroupreportcomprehensive(self,**kwargs): def reportmulti(self,**kwargs): # threading.Thread(target=self.tonegroupreport,kwargs=kwargs).start() start_time=nowruntime() - # log.info("reportmulti starting with kwargs {}".format(kwargs)) + log.info("reportmulti starting with fn {} and kwargs {} ".format( + self.reportfn.__name__,kwargs)) kwargs['usegui']=False # log.info("reportmulti continuing with kwargs {}".format(kwargs)) if hasattr(self.settings,'maxpss') and self.settings.maxpss: @@ -7549,7 +7550,7 @@ def iterateUFgroups(parent,**kwargs): kwargs['check']=rx.sub('x','=',kwargs['check'],count=1) self.docheckreport(parent,**kwargs) #this needs parent self.coocurrencetables(xlpr) - # log.info("getresults starting with kwargs {}".format(kwargs)) + log.info("getresults starting with kwargs {}".format(kwargs)) usegui=kwargs['usegui']=kwargs.get('usegui',True) # log.info("getresults continuing with kwargs {}".format(kwargs)) if usegui: @@ -7874,6 +7875,7 @@ def docheckreport(self,parent,**kwargs): kwargs['ps']=kwargs.get('ps',self.slices.ps()) kwargs['profile']=kwargs.get('profile',self.slices.profile()) kwargs['check']=kwargs.get('check',self.params.check()) + log.info("docheckreport starting with kwargs {}".format(kwargs)) groups=self.status.groups(**kwargs) group=self.status.group() self.ncvts=rx.split('[=x]',kwargs['check']) @@ -8014,6 +8016,7 @@ def iteratecvt(parent,**kwargs): # re.subn(cvt, cvt, profile)[1] self.wordsbypsprofilechecksubcheck(s34,**kwargs) #Convert to iterate over local variables + log.info("basicreport starting with kwargs {}".format(kwargs)) instr=_("The data in this report is given by most restrictive test " "first, followed by less restrictive tests (e.g., V1=V2 " "before V1 or V2). Additionally, each word only " @@ -9305,6 +9308,8 @@ def __init__(self, parent): #frame, filename=None ReportCitation.__init__(self,parent) Background.__init__(self,parent) # self.do=self.reportmulti + log.info("Setting up reports with do: {}; reportfn:{}" + "".format(self.do.__name__,self.reportfn.__name__)) class ReportCitationByUF(ByUF,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): @@ -9312,6 +9317,8 @@ def tasktitle(self): def __init__(self, parent): #frame, filename=None ReportCitation.__init__(self, parent) ByUF.__init__(self) + log.info("Setting up reports with do: {}; reportfn:{}" + "".format(self.do.__name__,self.reportfn.__name__)) class ReportCitationByUFBackground(ByUF,ReportCitationBackground): """docstring for ReportCitation.""" def tasktitle(self): From 91bbfc045099197f525fa49f63ee24f9a6d821c2 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 27 Sep 2022 11:08:01 +0100 Subject: [PATCH 045/124] wait in a manner that doesn't break stuff --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index e45fcd66..ed0f0a0a 100755 --- a/main.py +++ b/main.py @@ -7251,7 +7251,9 @@ def reportmulti(self,**kwargs): log.info(_("Starting reports that didn't work in the background: {}").format(unbackground)) for kwargs in unbackground: # log.info("reportmulti unbackground with kwargs {}".format(kwargs)) + self.wait(msg=kwargs) self.reportfn(**kwargs) #run what failed in background here + self.waitdone() logfinished(start_time,msg="all reports ({})".format(all)) def tonegroupreport(self,usegui=True,**kwargs): """This should iterate over at least some profiles; top 2-3? @@ -8026,7 +8028,8 @@ def iteratecvt(parent,**kwargs): "examples of a segment type occur with different values, e.g., " "V1≠V2, those words will appear multiple times, e.g., for " "both V1=x and V2=y.") - self.wait(msg=_("Running {}").format(self.tasktitle())) + if kwargs['usegui']: #i.e., showing results in window + self.wait(msg=_("Running {}").format(self.tasktitle())) self.basicreportfile=''.join([str(self.reportbasefilename) ,'_',''.join(sorted(self.cvtstodo)[:2]) ,'_BasicReport.txt']) From a8597a9aa1dd7861f8f0b17b0e862bf80ad62e86 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 27 Sep 2022 11:08:56 +0100 Subject: [PATCH 046/124] this was breaking class inheritances, for some reason --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index ed0f0a0a..23ef673c 100755 --- a/main.py +++ b/main.py @@ -8169,10 +8169,10 @@ class Background(object): def __init__(self,parent): log.info("Setting up background report, based on {}" "".format(self.do.__name__)) - super(Background, self).__init__(parent) self.reportfn=self.do self.do=self.reportmulti self.frame.status.redofinalbuttons() #because the fns changed + # super(Background, self).__init__(parent) class SortCV(Sort,Segments,TaskDressing,ui.Window): """docstring for SortCV.""" def __init__(self, parent): From cad7e99caf5dc7ee403822ef8f1c2d353b05794b Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 27 Sep 2022 17:48:39 +0100 Subject: [PATCH 047/124] allow for cells without content --- xlp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xlp.py b/xlp.py index 9e8a558d..bd0ccc63 100644 --- a/xlp.py +++ b/xlp.py @@ -339,7 +339,7 @@ class Row(ET.Element): def __init__(self,parent): self.node=ET.SubElement(parent.node,'tr') class Cell(ET.Element): - def __init__(self,parent,content,header=False,linebreakwords=False): + def __init__(self,parent,content='',header=False,linebreakwords=False): if header == False: tag='td' elif header == True: From 41063ca10babf1c89aae273f65008b99849eeb48 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 27 Sep 2022 17:49:19 +0100 Subject: [PATCH 048/124] allow for numbered and unnumbered tables --- xlp.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xlp.py b/xlp.py index bd0ccc63..cef11293 100644 --- a/xlp.py +++ b/xlp.py @@ -329,12 +329,14 @@ class Table(ET.Element): """ - def __init__(self,parent,caption): - id=rx.id('nt'+caption) - self.numbered=ET.SubElement(parent.node,'tablenumbered',attrib={'id':id}) + def __init__(self,parent,caption=None,numbered=True): + if numbered: + id=rx.id('nt'+caption) + self.numbered=ET.SubElement(parent.node,'tablenumbered',attrib={'id':id}) self.node=ET.SubElement(self.numbered,'table') - self.caption=ET.SubElement(self.node,'caption') - self.caption.text=caption + if caption: + self.caption=ET.SubElement(self.node,'caption') + self.caption.text=caption class Row(ET.Element): def __init__(self,parent): self.node=ET.SubElement(parent.node,'tr') From d1165e113dc67a8bde0f29025bdbe2d4a0edaa18 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 27 Sep 2022 17:49:43 +0100 Subject: [PATCH 049/124] draft to background a fn --- main.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.py b/main.py index 23ef673c..263f2255 100755 --- a/main.py +++ b/main.py @@ -7546,6 +7546,19 @@ def makeresultsframe(self): self.results.row=0 else: log.error("Tried to get a results frame without a runwindow!") + def background(self,fn,**kwargs): + kwargs['usegui']=False + t=multiprocessing.Process(target=fn, + kwargs=kwargs) + t.start() + log.info(_("Starting XLP background report with kwargs {}" + ).format(kwargs)) + time.sleep(0.2) #give it 200ms before checking if it returned already + if not t.is_alive(): + ErrorNotice(_("Looks like that didn't work; you may need " + "to run a report first, or not do it in " + "the background ({})." + ).format(kwargs)) def getresults(self,**kwargs): def iterateUFgroups(parent,**kwargs): if 'x' in kwargs['check'] and kwargs['cvt'] != 'CV': #CV has no C=V... From e0ab96d7d46f48706b4ac5c8d32f2784d0709ccc Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 27 Sep 2022 17:51:33 +0100 Subject: [PATCH 050/124] rework tables to fit on page --- main.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 263f2255..7497f949 100755 --- a/main.py +++ b/main.py @@ -8130,9 +8130,35 @@ def coocurrencetable(self,table,check,counts): """Basic report doesn't seem to put out any data""" rows=list(counts)#self.checkcounts[ps][profile][check]) if 'x' in check: - cols=list(counts[rows[0]]) + cols=sorted(set(ck + for r,c in counts.items() + for ck,cv in c.items() + if c[ck] + )) else: cols=[check] + maxcols=20 + if len(cols) >maxcols: #break table + colsa=cols[:maxcols] + colsb=cols[maxcols:] + countsa={r:{ck:c[ck] + for ck,cv in c.items() + if ck in colsa + } for r,c in counts.items() + } + countsb={r:{ck:c[ck] + for ck,cv in c.items() + if ck in colsb + } for r,c in counts.items() + } + xlp.Row(table) + table1cell=xlp.Cell(table) + table1=xlp.Table(table1cell,numbered=False) + self.coocurrencetable(table1,check,countsa) + table2cell=xlp.Cell(table) + table2=xlp.Table(table2cell,numbered=False) + self.coocurrencetable(table2,check,countsb) + return for x1 in ['header']+rows: h=xlp.Row(table) for x2 in ['header']+cols: From 436a7b38a9ac3085a5a18f86f085c89cbc6aa982 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 27 Sep 2022 17:51:46 +0100 Subject: [PATCH 051/124] use kwargs --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 7497f949..5a385bba 100755 --- a/main.py +++ b/main.py @@ -7652,7 +7652,9 @@ def iterateUFgroups(parent,**kwargs): log.info("Not sure what I'm dealing with! " "({})".format(i2)) if not n: #i.e., nothing was found above - text=_("No results for {}/{} ({})!").format(profile,check,ps) + text=_("No results for {}/{} ({})!").format(kwargs['profile'], + kwargs['check'], + kwargs['ps']) log.info(text) if usegui: #i.e., showing results in window ui.Label(self.results, text=text, column=0, row=self.results.row+1) From 5b19ef1559d70402b4d8b51f9680c7b6641fa0ee Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 27 Sep 2022 17:51:55 +0100 Subject: [PATCH 052/124] allow for VC --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 5a385bba..6061e178 100755 --- a/main.py +++ b/main.py @@ -7561,7 +7561,7 @@ def background(self,fn,**kwargs): ).format(kwargs)) def getresults(self,**kwargs): def iterateUFgroups(parent,**kwargs): - if 'x' in kwargs['check'] and kwargs['cvt'] != 'CV': #CV has no C=V... + if 'x' in kwargs['check'] and kwargs['cvt'] not in ['CV','VC']: #CV has no C=V... kwargs['check']=rx.sub('x','=',kwargs['check'],count=1) self.docheckreport(parent,**kwargs) #this needs parent self.coocurrencetables(xlpr) From 1d641959d76a3f23ea4415ec572118d42dcac63d Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 27 Sep 2022 18:45:40 +0100 Subject: [PATCH 053/124] reference --- xlp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xlp.py b/xlp.py index cef11293..cc5b872d 100644 --- a/xlp.py +++ b/xlp.py @@ -333,7 +333,9 @@ def __init__(self,parent,caption=None,numbered=True): if numbered: id=rx.id('nt'+caption) self.numbered=ET.SubElement(parent.node,'tablenumbered',attrib={'id':id}) - self.node=ET.SubElement(self.numbered,'table') + self.node=ET.SubElement(self.numbered,'table') + else: + self.node=ET.SubElement(parent.node,'table') if caption: self.caption=ET.SubElement(self.node,'caption') self.caption.text=caption From 8a8aea1724fba3a0b828253318db181749df45c0 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 08:53:16 +0100 Subject: [PATCH 054/124] clean up all temp files, for now --- xlp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xlp.py b/xlp.py index cc5b872d..56a0fcdd 100644 --- a/xlp.py +++ b/xlp.py @@ -149,7 +149,11 @@ def compile(self): try: subprocess.run(xetexargs,shell=False) # was call # subprocess.call(xetexargs,shell=False) #does twice help? - exts=['out','aux','log'] + exts=[ + 'tex', + 'out','aux','log', + 'xmla','xmlb','xmlc' + ] # exts+=['xmla','xmlb','xmlc','tex'] #once this is working... for ext in exts: file.remove(outfile.replace('.xml', '.'+ext)) From b8306028d616352006705fae99bec64668f0dca2 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 09:01:00 +0100 Subject: [PATCH 055/124] log less --- main.py | 27 ++++++++++++++++----------- rx.py | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 6061e178..0061db2b 100755 --- a/main.py +++ b/main.py @@ -2903,8 +2903,8 @@ def makestatusframe(self,dict=None): self.makestatusframe, dictnow) return - log.info("Dict changes; checking attributes and updating the UI. ({})" - "".format(dictnow)) + # log.info("Dict changes; checking attributes and updating the UI. ({})" + # "".format(dictnow)) if self.taskchooser.donew['collectionlc']: self.settings.makeeverythingok() #This will probably need to be reworked @@ -7756,7 +7756,12 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): return """possibly iterating over all these parameters, used by buildregex""" self.buildregex(cvt=cvt,profile=profile,check=check,group=group) - log.info("regexCV: {}; \nregex: {}".format(self.regexCV,self.regex)) + log.info("regexCV: {}" + # "; \nregex: {}" + "".format( + self.regexCV, + # self.regex + ) ) matches=set(self.senseidformsbyregex(self.regex,**kwargs)) if 'ufsenseids' in kwargs: matches=matches&set(kwargs['ufsenseids']) @@ -8002,11 +8007,11 @@ def printcountssorted(self): for ps in self.slices.pss(): if ps == 'Invalid': continue - log.debug("Part of Speech {}:".format(ps)) + log.info("Part of Speech {}:".format(ps)) for line in self.slices.valid(ps=ps): profile=line[0] ps=line[1] - log.debug("{}: {}".format(profile,self.slices[line])) + log.info("{}: {}".format(profile,self.slices[line])) print(ps,"(total):",nTotals[ps]) def printprofilesbyps(self): #This is only used in the basic report @@ -8057,8 +8062,8 @@ def iteratecvt(parent,**kwargs): #There is no runwindow here... self.basicreported={} self.checkcounts={} - self.printprofilesbyps() - self.printcountssorted() + # self.printprofilesbyps() #don't really need this + # self.printcountssorted() #don't really need this t=_("This report covers the following top two Grammatical categories, " "with the top {} syllable profiles in each. " "This is of course configurable, but I assume you don't want " @@ -8164,7 +8169,7 @@ def coocurrencetable(self,table,check,counts): for x1 in ['header']+rows: h=xlp.Row(table) for x2 in ['header']+cols: - log.debug("x1: {}; x2: {}".format(x1,x2)) + # log.debug("x1: {}; x2: {}".format(x1,x2)) # if x1 != 'header' and x2 not in ['header','n']: # log.debug("value: {}".format(self.checkcounts[ # ps][profile][name][x1][x2])) @@ -13024,7 +13029,7 @@ def indenteddict(indict): outdict={} # log.info("working on dict with keys {}".format(indict.keys())) for j in indict: - log.info("working on {}".format(j)) + # log.info("working on {}".format(j)) if isinstance(indict[j], dict): # log.info("printing indented dict for {} key".format(j)) # config[s][j]='\n'.join(['{'+i+':'+str(v[j][i])+'}' @@ -13054,8 +13059,8 @@ def indenteddict(indict): for i in indict[j]#.keys() if i])+'}' elif indict[j]: - log.info("printing unindented dict for {} " - "key".format(j)) + # log.info("printing unindented dict for {} " + # "key".format(j)) outdict[j]="'"+str(indict[j])+"'" return outdict def selected(groupvars): diff --git a/rx.py b/rx.py index 5e4a6e46..800249a7 100644 --- a/rx.py +++ b/rx.py @@ -296,7 +296,7 @@ def fromCV(CVs, sdict, distinguish, word=False, compile=False): #check, lang # log.info('x: {}; repl: {}'.format(x,CVrepl)) # log.info('CVs: {}'.format(CVs)) CVs=re.sub('\)([^(]+)\(',')(\\1)(',CVs) #? - log.info('Going to compile regex with CVs: {}'.format(CVs)) + # log.info('Going to compile regex with CVs: {}'.format(CVs)) return make(CVs, word=word, compile=compile) if __name__ == '__main__': x='ne [pas] plaire, ne pas agréer, ne pas' From 8c01307cfff64a29e7ad32c6be69c5542e2f9fd4 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 09:03:31 +0100 Subject: [PATCH 056/124] log more fix button --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 0061db2b..b1224cab 100755 --- a/main.py +++ b/main.py @@ -8202,7 +8202,10 @@ def __init__(self): class Comprehensive(object): def __init__(self): self.status.group(None) + log.info("Setting up Multislice report, based on {}" + "".format(self.do.__name__)) self.do=self.basicreport + self.frame.status.redofinalbuttons() #because the fns changed log.info("doing basic report on {} with groups {}".format(self.cvtstodo, self.status.group())) class ByUF(Tone): From 50822deaa8917e1784abdf46d8eb32bd3f55a8cd Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 09:04:14 +0100 Subject: [PATCH 057/124] fix table output --- main.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index b1224cab..60c35c7f 100755 --- a/main.py +++ b/main.py @@ -8146,8 +8146,9 @@ def coocurrencetable(self,table,check,counts): cols=[check] maxcols=20 if len(cols) >maxcols: #break table - colsa=cols[:maxcols] - colsb=cols[maxcols:] + ncols=int(len(cols)/2)+1 + colsa=cols[:ncols] + colsb=cols[ncols:] countsa={r:{ck:c[ck] for ck,cv in c.items() if ck in colsa @@ -8158,11 +8159,12 @@ def coocurrencetable(self,table,check,counts): if ck in colsb } for r,c in counts.items() } - xlp.Row(table) - table1cell=xlp.Cell(table) + table1row=xlp.Row(table) + table1cell=xlp.Cell(table1row) table1=xlp.Table(table1cell,numbered=False) self.coocurrencetable(table1,check,countsa) - table2cell=xlp.Cell(table) + table2row=xlp.Row(table) + table2cell=xlp.Cell(table2row) table2=xlp.Table(table2cell,numbered=False) self.coocurrencetable(table2,check,countsb) return From 00efb663c5b2ebace69c8bd601e5bdcf0a0ffc79 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 09:05:36 +0100 Subject: [PATCH 058/124] use psprofiles --- main.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 60c35c7f..ec19e009 100755 --- a/main.py +++ b/main.py @@ -7725,6 +7725,17 @@ def xlpstart(self,**kwargs): #this is only for adhoc "big button" reports. reporttype=str(self.params.check()) reporttype=' '.join([ps,profile,reporttype]) + if 'psprofiles' in kwargs: + reporttype=' '.join( + [' '.join( + [' '.join([ps]+ + ['('+'-'.join(kwargs['psprofiles'][ps])+')' + for ps in kwargs['psprofiles'] + ]) + for ps in kwargs['psprofiles'] + ]), + # profile, + reporttype]) bits=[str(self.reportbasefilename),rx.id(reporttype),"ReportXLP"] if not default: bits.append('mod') @@ -8053,7 +8064,15 @@ def iteratecvt(parent,**kwargs): self.basicreportfile=''.join([str(self.reportbasefilename) ,'_',''.join(sorted(self.cvtstodo)[:2]) ,'_BasicReport.txt']) - xlpr=self.xlpstart(reporttype='Basic '+''.join(self.cvtstodo)) + kwargs['psprofiles']={ps:profiles + for profiles in [self.slices.profiles(ps=ps)[ + :self.settings.maxprofiles] + for ps in self.slices.pss()[:self.settings.maxpss]] + for ps in self.slices.pss()[:self.settings.maxpss] + } + log.info("kwargs['psprofiles']={}".format(kwargs['psprofiles'])) + xlpr=self.xlpstart(reporttype='Multislice '+''.join(self.cvtstodo), + **kwargs) si=xlp.Section(xlpr,"Introduction") p=xlp.Paragraph(si,instr) sys.stdout = open(self.basicreportfile, "w", encoding='utf-8') @@ -8071,8 +8090,8 @@ def iteratecvt(parent,**kwargs): log.info(t) print(t) p=xlp.Paragraph(si,t) - for kwargs['ps'] in self.slices.pss()[:2]: #just the first two (Noun and Verb) - profiles=self.slices.profiles(ps=kwargs['ps'])[:self.settings.maxprofiles] + for kwargs['ps'] in kwargs['psprofiles']: + profiles=kwargs['psprofiles'][kwargs['ps']] t=_("{} data: (profiles: {})".format(kwargs['ps'],profiles)) log.info(t) print(t) From b2cd2048c7289b224eada7918ce58888e0856ca1 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 09:07:06 +0100 Subject: [PATCH 059/124] use checkprose --- main.py | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/main.py b/main.py index ec19e009..51fcccae 100755 --- a/main.py +++ b/main.py @@ -7756,13 +7756,17 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): group=kwargs.get('group',self.status.group()) ftype=kwargs.get('ftype',self.params.ftype()) skipthisone=False + checkprose=_("{} {} {} {}={}").format(kwargs['ps'], + kwargs['profile'], + kwargs['ufgroup'], + kwargs['check'], + kwargs['group']) if isinteger(group) or (hasattr(self,'groupcomparison') and isinteger(self.groupcomparison)): - t=_("Skipping check")+' '+t+' '+_("because it would break the regex") + log.info(_("Skipping check {} because it would break the regex" + "").format(checkprose)) skipthisone=True - xlp.Paragraph(parent,t) - print(t) - log.debug(t) + log.info(checkprose) if skipthisone: return """possibly iterating over all these parameters, used by buildregex""" @@ -7845,7 +7849,7 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): if 'ufgroup' in kwargs: titlebits+=kwargs['ufgroup'] id=rx.id(titlebits) - ex=xlp.Example(parent,id) + ex=xlp.Example(parent,id,heading=checkprose) for senseid in matches: if 'x' not in check: #This won't add XxY data again. for ncvt in self.ncvts: @@ -7938,22 +7942,12 @@ def docheckreport(self,parent,**kwargs): self.groupcomparison)) self.wordsbypsprofilechecksubcheckp(parent,t,**kwargs) elif group: - log.info("Going to run report just for group {}".format(group)) - t=_("{} {} {} {}={}".format(kwargs['ps'], - kwargs['profile'], - kwargs['ufgroup'], - kwargs['check'], - group)) - self.wordsbypsprofilechecksubcheckp(parent,t,group=group,**kwargs) + log.info("Going to run subcheckp just for group {}".format(group)) + self.wordsbypsprofilechecksubcheckp(parent,group=group,**kwargs) elif groups: - log.info("Going to run report for groups {}".format(groups)) + log.info("Going to run subcheckp for groups {}".format(groups)) for kwargs['group'] in groups: - t=_("{} {} {} {}={}".format(kwargs['ps'], - kwargs['profile'], - kwargs['ufgroup'], - kwargs['check'], - kwargs['group'])) - self.wordsbypsprofilechecksubcheckp(parent,t,**kwargs) + self.wordsbypsprofilechecksubcheckp(parent,**kwargs) def idXLP(self,framed): id='x' #string! bits=[ From 86b874b2e379ff3e03950b7c9587893509f61210 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 09:07:36 +0100 Subject: [PATCH 060/124] don't show if not there --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 51fcccae..265f72e6 100755 --- a/main.py +++ b/main.py @@ -7863,7 +7863,7 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): self.basicreported[ncvt]=set([senseid]) framed=self.taskchooser.datadict.getframeddata(senseid) self.framedtoXLP(framed,parent=ex,ftype=ftype,listword=True) #showgroups? - if usegui: #i.e., showing results in window + if usegui and hasattr(self,'results'): #i.e., showing results in window self.results.row+=1 col=0 for lang in [self.analang]+self.glosslangs: From 4ee4e23cf94be2e29fe258e879b62f337c4672db Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 09:08:01 +0100 Subject: [PATCH 061/124] use kwargs --- main.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 265f72e6..aaa41686 100755 --- a/main.py +++ b/main.py @@ -7746,15 +7746,15 @@ def xlpstart(self,**kwargs): for lang in set([self.analang]+self.glosslangs)-set([None]): xlpreport.addlang({'id':lang,'name': self.settings.languagenames[lang]}) return xlpreport - def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): + def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): log.info("Kwargs (wordsbypsprofilechecksubcheckp): {}".format(kwargs)) - usegui=kwargs.get('usegui',True) - cvt=kwargs.get('cvt',self.params.cvt()) - ps=kwargs.get('ps',self.slices.ps()) - profile=kwargs.get('profile',self.slices.profile()) - check=kwargs.get('check',self.params.check()) - group=kwargs.get('group',self.status.group()) - ftype=kwargs.get('ftype',self.params.ftype()) + usegui=kwargs['usegui']=kwargs.get('usegui',True) + cvt=kwargs['cvt']=kwargs.get('cvt',self.params.cvt()) + ps=kwargs['ps']=kwargs.get('ps',self.slices.ps()) + profile=kwargs['profile']=kwargs.get('profile',self.slices.profile()) + check=kwargs['check']=kwargs.get('check',self.params.check()) + group=kwargs['group']=kwargs.get('group',self.status.group()) + ftype=kwargs['ftype']=kwargs.get('ftype',self.params.ftype()) skipthisone=False checkprose=_("{} {} {} {}={}").format(kwargs['ps'], kwargs['profile'], @@ -7770,7 +7770,7 @@ def wordsbypsprofilechecksubcheckp(self,parent,t="NoText!",**kwargs): if skipthisone: return """possibly iterating over all these parameters, used by buildregex""" - self.buildregex(cvt=cvt,profile=profile,check=check,group=group) + self.buildregex(**kwargs) log.info("regexCV: {}" # "; \nregex: {}" "".format( From bb242637219c9a9b5c5c434b79830154b9bb3661 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:17:21 +0100 Subject: [PATCH 062/124] tell user what's in progress, don't duplicate reports --- xlp.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xlp.py b/xlp.py index 56a0fcdd..4079e320 100644 --- a/xlp.py +++ b/xlp.py @@ -19,6 +19,12 @@ class Report(object): def __init__(self,filename,report,langname): self.start_time=time.time() self.filename=filename + self.tmpfile=self.filename+'.tmp' + if file.exists(self.tmpfile): + log.info(_("Report {} already in process; not doing again." + ).format(self.filename)) + return + open(self.tmpfile, 'wb').close() self.stylesheetdir=file.getstylesheetdir(filename) # self.tree=ET.ElementTree(ET.Element('lingPaper')) self.node=ET.Element('lingPaper') #self.tree.getroot() @@ -41,6 +47,7 @@ def close(self,me=False): self.xlptypes() self.stylesheet() self.write() + file.remove(self.tmpfile) t=time.time()-self.start_time # m=int(t/60) # s=t%60 From 3e07101b6e1a6ac67fc0cb581f6ddb22e0d0a68a Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:18:45 +0100 Subject: [PATCH 063/124] be sensitiv to report failure --- main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.py b/main.py index aaa41686..f356d906 100755 --- a/main.py +++ b/main.py @@ -7360,6 +7360,9 @@ def examplestoXLP(examples,parent,senseid): # bylocation=self.bylocation, default=default ) + if not hasattr(xlpr,'node'): + log.info(_("Not repeating report that looks already started.")) + return s1=xlp.Section(xlpr,title='Introduction') text=_("This report follows an analysis of sortings of {} morphemes " "(roots or affixes) across the following frames: {}. {} stores these " @@ -7581,6 +7584,9 @@ def iterateUFgroups(parent,**kwargs): ,'ReportXLP.xml']) self.checkcounts={} xlpr=self.xlpstart(**kwargs) + if not hasattr(xlpr,'node'): + log.info(_("Not repeating report that looks already started.")) + return """"Do I need this?""" print(_("Getting results of Search request")) c1 = "Any" @@ -8067,6 +8073,9 @@ def iteratecvt(parent,**kwargs): log.info("kwargs['psprofiles']={}".format(kwargs['psprofiles'])) xlpr=self.xlpstart(reporttype='Multislice '+''.join(self.cvtstodo), **kwargs) + if not hasattr(xlpr,'node'): + log.info(_("Not repeating report that looks already started.")) + return si=xlp.Section(xlpr,"Introduction") p=xlp.Paragraph(si,instr) sys.stdout = open(self.basicreportfile, "w", encoding='utf-8') From ab2b3e737e479825d87b2270699664995ba38048 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:19:28 +0100 Subject: [PATCH 064/124] fix reporttype --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index f356d906..9584af4a 100755 --- a/main.py +++ b/main.py @@ -7730,18 +7730,18 @@ def xlpstart(self,**kwargs): elif not 'Basic' in reporttype: #We don't want this in the title #this is only for adhoc "big button" reports. reporttype=str(self.params.check()) - reporttype=' '.join([ps,profile,reporttype]) if 'psprofiles' in kwargs: reporttype=' '.join( [' '.join( [' '.join([ps]+ ['('+'-'.join(kwargs['psprofiles'][ps])+')' - for ps in kwargs['psprofiles'] ]) for ps in kwargs['psprofiles'] ]), # profile, reporttype]) + else: + reporttype=' '.join([ps,profile,reporttype]) bits=[str(self.reportbasefilename),rx.id(reporttype),"ReportXLP"] if not default: bits.append('mod') From d7d3b6d920a29267cc038ebc1002ef4eb6cd1707 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:19:52 +0100 Subject: [PATCH 065/124] don't die on failed report --- main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 9584af4a..0e177179 100755 --- a/main.py +++ b/main.py @@ -7748,9 +7748,11 @@ def xlpstart(self,**kwargs): reportfileXLP='_'.join(bits)+".xml" xlpreport=xlp.Report(reportfileXLP,reporttype, self.settings.languagenames[self.analang]) - langsalreadythere=[] - for lang in set([self.analang]+self.glosslangs)-set([None]): - xlpreport.addlang({'id':lang,'name': self.settings.languagenames[lang]}) + # langsalreadythere=[] + if hasattr(xlpreport,'node'): #otherwise, this will fail + for lang in set([self.analang]+self.glosslangs)-set([None]): + xlpreport.addlang({'id':lang, + 'name': self.settings.languagenames[lang]}) return xlpreport def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): log.info("Kwargs (wordsbypsprofilechecksubcheckp): {}".format(kwargs)) From 0bf5375bc4a36927b0e33bac08226b5e6486e402 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:20:28 +0100 Subject: [PATCH 066/124] genrealize for comparisons --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 0e177179..e7ac7e00 100755 --- a/main.py +++ b/main.py @@ -7769,6 +7769,9 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): kwargs['ufgroup'], kwargs['check'], kwargs['group']) + if ('x' in kwargs['check'] and hasattr(self,'groupcomparison') + and self.groupcomparison): + checkprose+='-'+self.groupcomparison if isinteger(group) or (hasattr(self,'groupcomparison') and isinteger(self.groupcomparison)): log.info(_("Skipping check {} because it would break the regex" From f7bdd321b9773a61f75348da907631b4a1582226 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:20:35 +0100 Subject: [PATCH 067/124] don't translate this --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e7ac7e00..138582c6 100755 --- a/main.py +++ b/main.py @@ -7764,7 +7764,7 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): group=kwargs['group']=kwargs.get('group',self.status.group()) ftype=kwargs['ftype']=kwargs.get('ftype',self.params.ftype()) skipthisone=False - checkprose=_("{} {} {} {}={}").format(kwargs['ps'], + checkprose="{} {} {} {}={}".format(kwargs['ps'], kwargs['profile'], kwargs['ufgroup'], kwargs['check'], From 07bfdc488a863665ba48c42760018911dcc9e143 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:21:08 +0100 Subject: [PATCH 068/124] condense logging --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 138582c6..14035dc2 100755 --- a/main.py +++ b/main.py @@ -7755,7 +7755,7 @@ def xlpstart(self,**kwargs): 'name': self.settings.languagenames[lang]}) return xlpreport def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): - log.info("Kwargs (wordsbypsprofilechecksubcheckp): {}".format(kwargs)) + # log.info("Kwargs (wordsbypsprofilechecksubcheckp): {}".format(kwargs)) usegui=kwargs['usegui']=kwargs.get('usegui',True) cvt=kwargs['cvt']=kwargs.get('cvt',self.params.cvt()) ps=kwargs['ps']=kwargs.get('ps',self.slices.ps()) @@ -7777,14 +7777,14 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): log.info(_("Skipping check {} because it would break the regex" "").format(checkprose)) skipthisone=True - log.info(checkprose) if skipthisone: return """possibly iterating over all these parameters, used by buildregex""" self.buildregex(**kwargs) - log.info("regexCV: {}" + log.info("{}; regexCV: {}" # "; \nregex: {}" "".format( + checkprose, self.regexCV, # self.regex ) ) From 1d64398333436f99bd446e7f5a2c9d3940fc8f62 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:22:21 +0100 Subject: [PATCH 069/124] log less --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 14035dc2..cac5bc54 100755 --- a/main.py +++ b/main.py @@ -4566,7 +4566,7 @@ def senseidformsbyregex(self,regex,**kwargs): self.output=[] #This is just a list of senseids now: (Do we need the dict?) # self.outputs=[] #This is just a list of senseids now: (Do we need the dict?) dicttosearch=self.settings.formstosearch[ps] - log.info("Looking for senses by regex {}".format(regex)) + # log.info("Looking for senses by regex {}".format(regex)) for form,id in [i for i in dicttosearch.items() if i[0]]: # log.info("Looking for form {}, with id {}".format(form,id)) t = threading.Thread(target=self.ifregexadd, From 44dd03237795f9e8b99e507d69cfb63e638d05ca Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:23:20 +0100 Subject: [PATCH 070/124] make psprofile correctly --- main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.py b/main.py index cac5bc54..6daeaf26 100755 --- a/main.py +++ b/main.py @@ -8069,10 +8069,8 @@ def iteratecvt(parent,**kwargs): self.basicreportfile=''.join([str(self.reportbasefilename) ,'_',''.join(sorted(self.cvtstodo)[:2]) ,'_BasicReport.txt']) - kwargs['psprofiles']={ps:profiles - for profiles in [self.slices.profiles(ps=ps)[ + kwargs['psprofiles']={ps:self.slices.profiles(ps=ps)[ :self.settings.maxprofiles] - for ps in self.slices.pss()[:self.settings.maxpss]] for ps in self.slices.pss()[:self.settings.maxpss] } log.info("kwargs['psprofiles']={}".format(kwargs['psprofiles'])) From 0d0545b202277baa19b5d57b839d99e1ddb3e1fb Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Wed, 28 Sep 2022 11:23:56 +0100 Subject: [PATCH 071/124] moved --- main.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/main.py b/main.py index 6daeaf26..210a87b6 100755 --- a/main.py +++ b/main.py @@ -7945,13 +7945,7 @@ def docheckreport(self,parent,**kwargs): for kwargs['group'] in groups: for self.groupcomparison in groupcomparisons: if kwargs['group'] != self.groupcomparison: - t=_("{} {} {} {}={}-{}".format(kwargs['ps'], - kwargs['profile'], - kwargs['ufgroup'], - kwargs['check'], - kwargs['group'], - self.groupcomparison)) - self.wordsbypsprofilechecksubcheckp(parent,t,**kwargs) + self.wordsbypsprofilechecksubcheckp(parent,**kwargs) elif group: log.info("Going to run subcheckp just for group {}".format(group)) self.wordsbypsprofilechecksubcheckp(parent,group=group,**kwargs) From d784b782e6cff5867da30c3f51cc3cf8b03f8d76 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 29 Sep 2022 16:33:43 +0100 Subject: [PATCH 072/124] multiscope --- main.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/main.py b/main.py index 210a87b6..1c969a87 100755 --- a/main.py +++ b/main.py @@ -765,6 +765,15 @@ def maxes(self): self.opts['columnplus']=1 t=(_("Max lexical categories: {}".format(self.settings.maxpss))) self.proselabel(t,cmd=self.taskchooser.getmaxpss,parent=line) + def multicheckscope(self): + if not hasattr(self.task,'cvtstodo'): + self.task.cvtstodo=['V'] + line=ui.Frame(self.proseframe,row=self.opts['row'],column=0, + columnspan=3,sticky='w') + self.opts['row']+=1 + log.info(self.task.cvtstodoprose()) + t=(_("Run all checks for {}").format(unlist(self.task.cvtstodoprose()))) + self.proselabel(t,cmd=self.taskchooser.getmulticheckscope,parent=line) def redofinalbuttons(self): if hasattr(self,'bigbutton') and self.bigbutton.winfo_exists(): self.bigbutton.destroy() @@ -2484,6 +2493,9 @@ def setmaxprofiles(self,choice,window): def setmaxpss(self,choice,window): self.maxpss=choice window.destroy() + def setmulticheckscope(self,choice,window): + self.cvtstodo=self.taskchooser.task.cvtstodo=choice + window.destroy() def setglosslang(self,choice,window): self.glosslangs.lang1(choice) self.attrschanged.append('glosslangs') @@ -3451,6 +3463,43 @@ def getcustom(): cmd=getcustom ) window.wait_window(window) + def getmulticheckscope(self,event=None): + log.info("Asking for multicheckscope...") + window=ui.Window(self.frame, title=_('Select Scope of Checks')) + ui.Label(window.frame, + text=_('What kinds of checks to you want to run?') + ).grid(column=0, row=0) + cvts=[[i] for i in self.params.cvts()] + cvts.remove(['T']) + cvtsdone=cvts[:] + # log.info("{};{}".format(len(cvts),cvts)) + for j in cvts[:2]+[[i[0] for i in cvts[:2]]]: + cvtsdone+=[j+i for i in cvts + if i[0] not in j + if set(j+i) not in [set(i) for i in cvtsdone]] + # log.info("{};{}".format(len(cvtsdone),cvtsdone)) + cvtsdone+=[[i[0] for i in cvts]] + options=[{'code':opt, + 'name':unlist([self.params.cvtdict()[i]['pl'] for i in opt]) + } + for opt in cvtsdone + ] + for opt in options: + if len(opt['code']) == 1: + opt['name']+=' '+_("(only)") + buttonFrame1=ui.ScrollingButtonFrame(window.frame, + optionlist=options, + command=self.settings.setmulticheckscope, + window=window, + column=0, row=1 + ) + def cvtstodoprose(self,cvtstodo=None): + if not cvtstodo: + cvtstodo=self.cvtstodo + output=[] + for cvt in self.cvtstodo: + output+=[self.params.cvtdict()[cvt]['pl']] + return output def secondfieldnames(self): return (self.settings.secondformfield[self.settings.verbalps], self.settings.secondformfield[self.settings.nominalps]) From 71d2fe9087d7feb76096b6cb9139c0b4c0ee93b9 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 29 Sep 2022 16:34:56 +0100 Subject: [PATCH 073/124] typo --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 1c969a87..cc633b83 100755 --- a/main.py +++ b/main.py @@ -12211,7 +12211,7 @@ def __init__(self,analang): # had, do I need check? to write? # ("CV2#", "Word-final CV") ], 3:[ - ("CxV2", _("Correspondence of third CV")), + ("CxV3", _("Correspondence of third CV")), ("CV1=CV2=CV3",_("Same First/only Three CVs")), ("CV3", _("Third CV")) ], From 3c0eacf42026353d84572c9d821891c71c34ae2f Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 29 Sep 2022 16:36:45 +0100 Subject: [PATCH 074/124] class adjustments --- main.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index cc633b83..a267be69 100755 --- a/main.py +++ b/main.py @@ -9698,6 +9698,15 @@ class ReportCitationBasicTBackground(ReportCitationBasicT,Report,Comprehensive,T """docstring for ReportCitationT.""" def tasktitle(self): return _("Comprehensive Tone Report, in the background") + # self.do=self.tonegroupreportcomprehensive + # self.do=self.tonegroupreport + # TaskDressing.__init__(self,parent) + MultisliceT.__init__(self) + # self.bylocation=False +class ReportCitationMultisliceTBackground(Background,ReportCitationMultisliceT): + """docstring for ReportCitationT.""" + def tasktitle(self): + return _("Multislice Tone Report") # Report on several slices of Citation Forms (in Tone Frames)") def taskicon(self): return program['theme'].photo['iconTRepcomp'] @@ -9715,12 +9724,21 @@ def dobuttonkwargs(self): 'sticky':'ew' } def __init__(self, parent): #frame, filename=None - Tone.__init__(self) - ui.Window.__init__(self,parent) - self.do=self.reportmulti - self.reportfn=self.tonegroupreport - TaskDressing.__init__(self,parent) - Report.__init__(self) + ReportCitationMultisliceT.__init__(self,parent) + Background.__init__(self) +class ReportCitationMultisliceTLBackground(Background,ReportCitationMultisliceTL): + """docstring for ReportCitationT.""" + def tasktitle(self): + return _("Multislice Tone Report (by location)") + def taskicon(self): + return program['theme'].photo['iconTRepcomp'] + def tooltip(self): + return _("This report gives you reports across multiple lexical " + "categories, and across multiple syllable profiles. \nIt does " + "this for all data sorted in tone frames, organized by word.") + def __init__(self, parent): #frame, filename=None + ReportCitationMultisliceTL.__init__(self,parent) + Background.__init__(self) self.bylocation=True """Task definitions end here""" class Entry(lift.Entry): #Not in use From 2d5014af4cb4de46d56e2c5c17fa25b5452d945e Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 15:35:48 +0100 Subject: [PATCH 075/124] make parent node accessible --- xlp.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xlp.py b/xlp.py index 4079e320..83310edc 100644 --- a/xlp.py +++ b/xlp.py @@ -340,7 +340,13 @@ class Table(ET.Element): """ + def destroy(self): + if hasattr(self,'numbered'): + self.parent.node.remove(self.numbered) + else: + self.parent.node.remove(self.node) def __init__(self,parent,caption=None,numbered=True): + self.parent=parent if numbered: id=rx.id('nt'+caption) self.numbered=ET.SubElement(parent.node,'tablenumbered',attrib={'id':id}) From a254fc0b644313f836f0049927f4a9e539d5cc36 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 15:42:54 +0100 Subject: [PATCH 076/124] convert analysis to class attribute --- main.py | 112 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/main.py b/main.py index a267be69..3658cbc5 100755 --- a/main.py +++ b/main.py @@ -5641,12 +5641,6 @@ def __init__(self,parent): class Tone(object): """This keeps stuff used for Tone checks.""" def makeanalysis(self,**kwargs): - return Analysis(self.params, - self.slices, - self.status, - self.db, - **kwargs - ) """was, now iterable, for multiple reports at a time:""" if not hasattr(self,'analysis'): self.analysis=Analysis(self.params, @@ -7177,9 +7171,9 @@ def next(): (type(self.examplespergrouptorecord) is not int)): self.examplespergrouptorecord=100 self.settings.storesettingsfile() - analysis=self.makeanalysis() - analysis.donoUFanalysis() - torecord=analysis.senseidsbygroup + self.makeanalysis() + self.analysis.donoUFanalysis() + torecord=self.analysis.senseidsbygroup ntorecord=len(torecord) #number of groups nexs=len([k for i in torecord for j in torecord[i] for k in j]) nslice=self.slices.count() @@ -7192,7 +7186,7 @@ def next(): self.slices.profile(), self.slices.ps() )) - analysis.do() + self.analysis.do() self.showtonegroupexs() return batch={} @@ -7365,11 +7359,11 @@ def examplestoXLP(examples,parent,senseid): return start_time=nowruntime() counts={'senses':0,'examples':0, 'audio':0} - analysis=self.makeanalysis(**kwargs) + self.makeanalysis(**kwargs) # log.info("Caller function: {}".format(callerfn())) if analysisOK: log.info(_("Looks like the analysis is good; moving on.")) - analysis.donoUFanalysis() #based on (sense) UF fields + self.analysis.donoUFanalysis() #based on (sense) UF fields elif callerfn() == 'run': #self.tonegroupreportmulti log.info(_("Sorry, the analysis isn't good, and we're running " "in the background. That isn't going to work, so I'm " @@ -7378,22 +7372,24 @@ def examplestoXLP(examples,parent,senseid): else: log.info(_("Looks like the analysis isn't good, but we're not " "in the background, so I'm doing a new analysis now.")) - analysis.do() #full analysis from scratch, output to UF fields + self.analysis.do() #full analysis from scratch, output to UF fields """These are from LIFT, ordered by similarity for the report.""" - if not analysis.orderedchecks or not analysis.orderedUFs: + if not self.analysis.orderedchecks or not self.analysis.orderedUFs: log.error("Problem with checks: {} (in {} {})." "".format(checks,ps,profile)) log.error("valuesbygroupcheck: {}, valuesbycheckgroup: {}" - "".format(analysis.valuesbygroupcheck, - analysis.valuesbycheckgroup)) + "".format(self.analysis.valuesbygroupcheck, + self.analysis.valuesbycheckgroup)) log.error("Ordered checks is {}, ordered UFs: {}" - "".format(analysis.orderedchecks, - analysis.orderedUFs)) + "".format(self.analysis.orderedchecks, + self.analysis.orderedUFs)) log.error("comparisonUFs: {}, comparisonchecks: {}" - "".format(analysis.comparisonUFs, - analysis.comparisonchecks)) - grouplist=analysis.orderedUFs - checks=analysis.orderedchecks + "".format(self.analysis.comparisonUFs, + self.analysis.comparisonchecks)) + grouplist=[i for i in self.analysis.orderedUFs + if len(self.analysis.senseidsbygroup[i]) > kwargs['minwords'] + ] + checks=self.analysis.orderedchecks r = open(self.tonereportfile, "w", encoding='utf-8') title=_("Tone Report") if usegui: @@ -7471,38 +7467,38 @@ def output(window,r,text): "And here are the structured similarity relationships for the " "Frames: {}" "".format(program['name'], - str(analysis.comparisonUFs), - str(analysis.comparisonchecks))) + str(self.analysis.comparisonUFs), + str(self.analysis.comparisonchecks))) else: ptext+=_("This is a non-default report, where a user has changed " "the default (hyper-split) groups created by {}.".format( program['name'])) p0=xlp.Paragraph(s1s,text=ptext) - analysis.orderedchecks=list(analysis.valuesbycheckgroup) - for slice in range(int(len(analysis.orderedchecks)/m)+1): - locslice=analysis.orderedchecks[slice*m:(slice+1)*m] + self.analysis.orderedchecks=list(self.analysis.valuesbycheckgroup) + for slice in range(int(len(self.analysis.orderedchecks)/m)+1): + locslice=self.analysis.orderedchecks[slice*m:(slice+1)*m] if len(locslice) >0: self.buildXLPtable(s1s,caption+str(slice), yterms=grouplist, xterms=locslice, values=lambda x,y:nn(unlist( - analysis.valuesbygroupcheck[y][x],ignore=[None, 'NA'] + self.analysis.valuesbygroupcheck[y][x],ignore=[None, 'NA'] )), - ycounts=lambda x:len(analysis.senseidsbygroup[x]), - xcounts=lambda y:len(analysis.valuesbycheck[y])) + ycounts=lambda x:len(self.analysis.senseidsbygroup[x]), + xcounts=lambda y:len(self.analysis.valuesbycheck[y])) #Can I break this for multithreading? for group in grouplist: #These already include ps-profile log.info("building report for {} ({}/{}, n={})".format(group, grouplist.index(group)+1,len(grouplist), - len(analysis.senseidsbygroup[group]) + len(self.analysis.senseidsbygroup[group]) )) sectitle=_('\n{}'.format(str(group))) s1=xlp.Section(xlpr,title=sectitle) output(window,r,sectitle) l=list() - for x in analysis.valuesbygroupcheck[group]: + for x in self.analysis.valuesbygroupcheck[group]: l.append("{}: {}".format(x,', '.join( - [i for i in analysis.valuesbygroupcheck[group][x] + [i for i in self.analysis.valuesbygroupcheck[group][x] if i is not None] ))) if not l: @@ -7514,15 +7510,15 @@ def output(window,r,text): if self.bylocation: textout=list() #This is better than checks, just whats there for this group - for check in analysis.valuesbygroupcheck[group]: + for check in self.analysis.valuesbygroupcheck[group]: id=rx.id('x'+sectitle+check) headtext='{}: {}'.format(check,', '.join( [i for i in - analysis.valuesbygroupcheck[group][check] + self.analysis.valuesbygroupcheck[group][check] if i is not None] )) e1=xlp.Example(s1,id,heading=headtext) - for senseid in analysis.senseidsbygroup[group]: + for senseid in self.analysis.senseidsbygroup[group]: #This is for window/text output only, not in XLP file framed=self.taskchooser.datadict.getframeddata(senseid,check=None) text=framed.formatted(noframe=True,showtonegroup=False) @@ -7536,7 +7532,7 @@ def output(window,r,text): if not e1.node.find('listWord'): s1.node.remove(e1.node) #Don't show examples w/o data else: - for senseid in analysis.senseidsbygroup[group]: + for senseid in self.analysis.senseidsbygroup[group]: #This is for window/text output only, not in XLP file framed=self.taskchooser.datadict.getframeddata(senseid,check=None) if not framed: @@ -7650,8 +7646,8 @@ def iterateUFgroups(parent,**kwargs): self.runwindow.wait() si=xlp.Section(xlpr,text) if self.byUFgroup: - analysis=self.makeanalysis() - analysis.donoUFanalysis() + self.makeanalysis() + self.analysis.donoUFanalysis() # torecord=analysis.senseidsbygroup ufgroupsnsenseids=analysis.senseidsbygroup.items() kwargs['sectlevel']=4 @@ -8156,10 +8152,12 @@ def iteratecvt(parent,**kwargs): print(t) log.info(t) if self.byUFgroup: - analysis=self.makeanalysis() - analysis.donoUFanalysis() + self.makeanalysis(**kwargs) + self.analysis.donoUFanalysis() # torecord=analysis.senseidsbygroup - ufgroupsnids=analysis.senseidsbygroup.items() + ufgroupsnids=[(i,j) for i,j in + self.analysis.senseidsbygroup.items() + if len(j)>2] #don't report groups of 1 or 2 words kwargs['sectlevel']=4 for kwargs['ufgroup'],kwargs['ufsenseids'] in ufgroupsnids: if 'ufgroup' in kwargs: @@ -9178,28 +9176,28 @@ def submitform(): groupsselected+=[group.get()] #value, name if selected, 0 if not groupsselected=[x for x in groupsselected if x != ''] log.info("groupsselected:{}".format(groupsselected)) - if uf in analysis.orderedUFs and uf not in groupsselected: + if uf in self.analysis.orderedUFs and uf not in groupsselected: deja=_("That name is already there! (did you forget to include " "the ‘{}’ group?)".format(uf)) log.debug(deja) errorlabel['text'] = deja return for group in groupsselected: - if group in analysis.senseidsbygroup: #selected ones only + if group in self.analysis.senseidsbygroup: #selected ones only log.debug("Changing values from {} to {} for the following " "senseids: {}".format(group,uf, - analysis.senseidsbygroup[group])) - for senseid in analysis.senseidsbygroup[group]: + self.analysis.senseidsbygroup[group])) + for senseid in self.analysis.senseidsbygroup[group]: self.db.addtoneUF(senseid,uf,analang=self.analang, write=False) self.db.write() self.runwindow.destroy() self.status.last('joinUF',update=True) self.tonegroupsjoinrename() #call again, in case needed - analysis=self.makeanalysis() + self.makeanalysis() def redo(timestamps): self.wait(_("Redoing Tone Analysis")+'\n'+timestamps) - analysis.do() + self.analysis.do() self.waitdone() # self.runwindow.destroy() self.tonegroupsjoinrename() #call again, in case needed @@ -9272,9 +9270,9 @@ def done(): rwrow+=1 scroll=ui.ScrollingFrame(self.runwindow.frame) scroll.grid(row=rwrow,column=0,sticky='ew') - analysis.donoUFanalysis() + self.analysis.donoUFanalysis() nheaders=0 - if not analysis.orderedUFs: + if not self.analysis.orderedUFs: self.runwindow.waitdone() self.runwindow.destroy() ErrorNotice(title=_("No draft UF groups found for {} words!" @@ -9285,18 +9283,18 @@ def done(): ) return # ufgroups= # order by structured groups? Store this somewhere? - for group in analysis.orderedUFs: #make a variable and button to select - idn=analysis.orderedUFs.index(group) + for group in self.analysis.orderedUFs: #make a variable and button to select + idn=self.analysis.orderedUFs.index(group) if idn % 5 == 0: #every five rows col=1 - for check in analysis.orderedchecks: + for check in self.analysis.orderedchecks: col+=1 cbh=ui.Label(scroll.content, text=check, font='small') cbh.grid(row=idn+nheaders, column=col,sticky='ew') nheaders+=1 groupvars.append(ui.StringVar()) - n=len(analysis.senseidsbygroup[group]) + n=len(self.analysis.senseidsbygroup[group]) buttontext=group+' ({})'.format(n) cb=ui.CheckButton(scroll.content, text = buttontext, variable = groupvars[idn], @@ -9305,12 +9303,12 @@ def done(): cb.grid(row=idn+nheaders,column=0,sticky='ew') # analysis.valuesbygroupcheck[group]: col=1 - for check in analysis.orderedchecks: + for check in self.analysis.orderedchecks: col+=1 - if check in analysis.valuesbygroupcheck[group]: + if check in self.analysis.valuesbygroupcheck[group]: cbl=ui.Label(scroll.content, text=unlist( - analysis.valuesbygroupcheck[group][check] + self.analysis.valuesbygroupcheck[group][check] ) ) cbl.grid(row=idn+nheaders,column=col,sticky='ew') From b1f366b8de3b5e7b1f8ad3528f2f85ae44520f3f Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 15:45:07 +0100 Subject: [PATCH 077/124] generalise this to work on its own or in a section --- main.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 3658cbc5..46725a72 100755 --- a/main.py +++ b/main.py @@ -7399,16 +7399,23 @@ def examplestoXLP(examples,parent,senseid): window.row=0 else: window=None - xlpr=self.xlpstart(reporttype='Tone', + if 'xlpr' in kwargs: + xlpr=kwargs['xlpr'] + s1parent=s0=xlp.Section(xlpr,title='{} {}'.format(ps,profile)) + else: + s1parent=xlpr=self.xlpstart(reporttype='Tone', ps=ps, profile=profile, # bylocation=self.bylocation, default=default ) - if not hasattr(xlpr,'node'): - log.info(_("Not repeating report that looks already started.")) - return - s1=xlp.Section(xlpr,title='Introduction') + if not hasattr(xlpr,'node'): + log.info(_("Not repeating report that looks already started.")) + if kwargs['usegui']: + self.waitdone() + return + title=_('Introduction to {} {}').format(ps,profile) + s1=xlp.Section(s1parent,title=title) text=_("This report follows an analysis of sortings of {} morphemes " "(roots or affixes) across the following frames: {}. {} stores these " "sortings in lift examples, which are output here, with any glossing " From 06f328e8049e4fa783e4be2472336fbb48e6402c Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 15:45:30 +0100 Subject: [PATCH 078/124] ge --- main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 46725a72..b5f4f32e 100755 --- a/main.py +++ b/main.py @@ -7448,14 +7448,14 @@ def output(window,r,text): row=window.row,column=0, sticky="w" ) window.row+=1 - t=_("Summary of Frames by Draft Underlying Melody") + t=_("Summary of Frames by {} {} Draft Underlying Melody").format(ps,profile) m=7 #only this many columns in a table # Don't bother with lanscape if we're splitting the table in any case. if m >= len(checks) > 6: landscape=True else: landscape=False - s1s=xlp.Section(xlpr,t,landscape=landscape) + s1s=xlp.Section(s1parent,t,landscape=landscape) caption=' '.join([ps,profile]) ptext=_("The following table shows correspondences across sortings by " "tone frames, with a row for each unique pairing. ") @@ -7500,7 +7500,7 @@ def output(window,r,text): len(self.analysis.senseidsbygroup[group]) )) sectitle=_('\n{}'.format(str(group))) - s1=xlp.Section(xlpr,title=sectitle) + s1=xlp.Section(s1parent,title=sectitle) output(window,r,sectitle) l=list() for x in self.analysis.valuesbygroupcheck[group]: @@ -7560,8 +7560,8 @@ def output(window,r,text): self.framedtoXLP(framed,parent=s1,ftype=ftype, showgroups=showgroups) output(window,r,text) - sectitle=_('\nData Summary') - s2=xlp.Section(xlpr,title=sectitle) + sectitle=_('{} {} Data Summary').format(ps,profile) + s2=xlp.Section(s1parent,title=sectitle) try: eps='{:.2}'.format(float(counts['examples']/counts['senses'])) except ZeroDivisionError: @@ -7576,7 +7576,8 @@ def output(window,r,text): "").format(counts['senses'],counts['examples'],counts['audio'], eps,audiopercent) ps2=xlp.Paragraph(s2,text=ptext) - xlpr.close(me=me) + if 'xlpr' not in kwargs: + xlpr.close(me=me) text=_("Finished in {} seconds.").format(nowruntime()-start_time) text=logfinished(start_time,msg="report {} {}".format(ps,profile)) logfinished(start_time) From af2e6e49e4193965b0e780478145192f694d2e04 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 17:17:54 +0100 Subject: [PATCH 079/124] report cleanup and reorganization --- main.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index b5f4f32e..07805439 100755 --- a/main.py +++ b/main.py @@ -9373,7 +9373,7 @@ def __init__(self, parent): #frame, filename=None class ReportCitation(Report,Segments,TaskDressing,ui.Window): """docstring for ReportCitation.""" def tasktitle(self): - return _("Alphabet Report") # on One Data Slice + return _("Alphabet Report (Not background)") # on One Data Slice def taskicon(self): return program['theme'].photo['iconReport'] def tooltip(self): @@ -9384,7 +9384,6 @@ def tooltip(self): def dobuttonkwargs(self): return {'text':"Report!", 'fn':self.do, - # column=0, 'font':'title', 'compound':'bottom', #image bottom, left, right, or top of text 'image':self.taskchooser.theme.photo['Report'], @@ -9708,12 +9707,10 @@ def tasktitle(self): # self.do=self.tonegroupreport # TaskDressing.__init__(self,parent) MultisliceT.__init__(self) - # self.bylocation=False class ReportCitationMultisliceTBackground(Background,ReportCitationMultisliceT): """docstring for ReportCitationT.""" def tasktitle(self): return _("Multislice Tone Report") - # Report on several slices of Citation Forms (in Tone Frames)") def taskicon(self): return program['theme'].photo['iconTRepcomp'] def tooltip(self): @@ -9723,13 +9720,12 @@ def tooltip(self): def dobuttonkwargs(self): return {'text':"Report!", 'fn':self.do, - # column=0, 'font':'title', 'compound':'bottom', #image bottom, left, right, or top of text 'image':self.taskchooser.theme.photo['TRepcomp'], 'sticky':'ew' } - def __init__(self, parent): #frame, filename=None + def __init__(self, parent): ReportCitationMultisliceT.__init__(self,parent) Background.__init__(self) class ReportCitationMultisliceTLBackground(Background,ReportCitationMultisliceTL): @@ -9742,10 +9738,9 @@ def tooltip(self): return _("This report gives you reports across multiple lexical " "categories, and across multiple syllable profiles. \nIt does " "this for all data sorted in tone frames, organized by word.") - def __init__(self, parent): #frame, filename=None + def __init__(self, parent): ReportCitationMultisliceTL.__init__(self,parent) Background.__init__(self) - self.bylocation=True """Task definitions end here""" class Entry(lift.Entry): #Not in use def __init__(self, db, guid, window=None, check=None, problem=None, From 0dc37447bc3bd955ff1a003a55cb67428477d642 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 17:18:39 +0100 Subject: [PATCH 080/124] r --- main.py | 248 +++++++++++++++++++++----------------------------------- 1 file changed, 92 insertions(+), 156 deletions(-) diff --git a/main.py b/main.py index 07805439..69732f48 100755 --- a/main.py +++ b/main.py @@ -9429,34 +9429,63 @@ def __init__(self, parent): #frame, filename=None class ReportCitationBackground(Background,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): - return _("Alphabet Report (Background)") # on One Data Slice - def __init__(self, parent): #frame, filename=None - # self.reportfn=self.getresults + return _("Alphabet Report") # on One Data Slice + def __init__(self, parent): + ReportCitation.__init__(self,parent) + Background.__init__(self) + """Does the above not work? was turned off...""" + # self.do=lambda fn=self.getresults:self.background(fn) + # self.frame.status.redofinalbuttons() #because the fns changed +class ReportCitationMulticheckBackground(Multicheck,Background,ReportCitation): + """docstring for ReportCitation.""" + def tasktitle(self): + return _("Alphabet Report (Multicheck)") # on One Data Slice + def __init__(self, parent): + ReportCitation.__init__(self,parent) + Multicheck.__init__(self) + Background.__init__(self) +class ReportCitationMultichecksliceBackground(Multicheckslice,Background,ReportCitation): + """docstring for ReportCitation.""" + def tasktitle(self): + return _("Alphabet Report (Multislice, Multicheck)") # on One Data Slice + def __init__(self, parent): ReportCitation.__init__(self,parent) - Background.__init__(self,parent) - # self.do=self.reportmulti - log.info("Setting up reports with do: {}; reportfn:{}" - "".format(self.do.__name__,self.reportfn.__name__)) + Multicheckslice.__init__(self) + Background.__init__(self) class ReportCitationByUF(ByUF,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): - return _("Alphabet Report by Tone group") # on One Data Slice - def __init__(self, parent): #frame, filename=None + return _("Alphabet Report by Tone group (not background)") # on One Data Slice + def __init__(self, parent): ReportCitation.__init__(self, parent) ByUF.__init__(self) - log.info("Setting up reports with do: {}; reportfn:{}" - "".format(self.do.__name__,self.reportfn.__name__)) +class ReportCitationByUFMulticheckBackground(Multicheck,Background,ReportCitationByUF): + """docstring for ReportCitation.""" + def tasktitle(self): + return _("Alphabet Report by Tone group (Multicheck)") # on One Data Slice + def __init__(self, parent): + ReportCitationByUF.__init__(self, parent) + Multicheck.__init__(self) + Background.__init__(self) +class ReportCitationByUFMultichecksliceBackground(Multicheckslice,Background,ReportCitationByUF): + """docstring for ReportCitation.""" + def tasktitle(self): + return _("Alphabet Report by Tone Group (Multislice, Multicheck)") # on One Data Slice + def __init__(self, parent): + ReportCitationByUF.__init__(self,parent) + Multicheckslice.__init__(self) + Background.__init__(self) class ReportCitationByUFBackground(ByUF,ReportCitationBackground): """docstring for ReportCitation.""" def tasktitle(self): - return _("Alphabet Report by Tone group (Background)") # on One Data Slice - def __init__(self, parent): #frame, filename=None + return _("Alphabet Report by Tone group") # on One Data Slice + def __init__(self, parent): ReportCitationBackground.__init__(self, parent) ByUF.__init__(self) -class ReportCitationBasic(Comprehensive,ReportCitation): +class ReportCitationMultislice(MultisliceS,ReportCitation): """docstring for ReportCitation.""" def tasktitle(self): - return _("Comprehensive Alphabet Report") # on Citation Forms + return _("Multislice Alphabet Report") # on Citation Forms def dobuttonkwargs(self): return {'text':"Report!", 'fn':self.do, @@ -9468,102 +9497,12 @@ def dobuttonkwargs(self): } def __init__(self, parent): #frame, filename=None ReportCitation.__init__(self,parent) - self.do=self.basicreport - # ui.Window.__init__(self,parent) - # TaskDressing.__init__(self,parent) - # Report.__init__(self) self.cvtstodo=['V','C','CV'] - Comprehensive.__init__(self) -class ReportCitationBasicV(Report,Comprehensive,Segments,TaskDressing,ui.Window): - """docstring for ReportCitation.""" - def tasktitle(self): - return _("Comprehensive Vowel Report") # on Citation Forms - def taskicon(self): - return program['theme'].photo['iconVRepcomp'] - def tooltip(self): - return _("This report gives you reports across multiple lexical " - "categories, and across multiple syllable profiles. \nIt does " - "this just for vowel checks.") - def dobuttonkwargs(self): - return {'text':"Report!", - 'fn':self.do, - # column=0, - 'font':'title', - 'compound':'bottom', #image bottom, left, right, or top of text - 'image':self.taskchooser.theme.photo['VRepcomp'], - 'sticky':'ew' - } - def __init__(self, parent): #frame, filename=None - Segments.__init__(self,parent) - ui.Window.__init__(self,parent) - TaskDressing.__init__(self,parent) - Report.__init__(self) - self.cvtstodo=['V'] - Comprehensive.__init__(self) -class ReportCitationBasicVByUF(ByUF,ReportCitationBasicV): - """docstring for ReportCitation.""" - def tasktitle(self): - return _("Comprehensive Vowel Report by tone group") # on Citation Forms - def __init__(self, parent): #frame, filename=None - ReportCitationBasicV.__init__(self, parent) - ByUF.__init__(self) -class ReportCitationBasicC(Report,Comprehensive,Segments,TaskDressing,ui.Window): - """docstring for ReportCitation.""" - def tasktitle(self): - return _("Comprehensive Consonant Report") # on Citation Forms - def taskicon(self): - return program['theme'].photo['iconCRepcomp'] - def tooltip(self): - return _("This report gives you reports across multiple lexical " - "categories, and across multiple syllable profiles. \nIt does " - "this just for consonant checks.") - def dobuttonkwargs(self): - return {'text':"Report!", - 'fn':self.basicreport, - # column=0, - 'font':'title', - 'compound':'bottom', #image bottom, left, right, or top of text - 'image':self.taskchooser.theme.photo['CRepcomp'], - 'sticky':'ew' - } - def __init__(self, parent): #frame, filename=None - Segments.__init__(self,parent) - ui.Window.__init__(self,parent) - TaskDressing.__init__(self,parent) - Report.__init__(self) - self.cvtstodo=['C'] - # This is really hard on memory, with correspondences. - Comprehensive.__init__(self) -class ReportCitationBasicCV(Comprehensive,Background,ReportCitation): - """docstring for ReportCitation.""" - def tasktitle(self): - return _("Comprehensive CxV Phonotactics Report") # on Citation Forms - def taskicon(self): - return program['theme'].photo['iconCVRepcomp'] - def __init__(self, parent): #frame, filename=None - ReportCitation.__init__(self,parent) - self.cvtstodo=['CV'] - Comprehensive.__init__(self) - Background.__init__(self,parent) - log.info("Setting up reports with cvtstodo: {}; do: {}; reportfn:{}" - "".format(self.cvtstodo,self.do.__name__,self.reportfn.__name__)) -class ReportCitationBasicVC(Comprehensive,Background,ReportCitation): - """docstring for ReportCitation.""" - def tasktitle(self): - return _("Comprehensive VxC Phonotactics Report") # on Citation Forms - def taskicon(self): - return program['theme'].photo['iconCVRepcomp'] - def __init__(self, parent): #frame, filename=None - ReportCitation.__init__(self,parent) - self.cvtstodo=['VC'] - Comprehensive.__init__(self) - Background.__init__(self,parent) - log.info("Setting up reports with cvtstodo: {}; do: {}; reportfn:{}" - "".format(self.cvtstodo,self.do.__name__,self.reportfn.__name__)) + MultisliceS.__init__(self) class ReportConsultantCheck(Report,Tone,TaskDressing,ui.Window): """docstring for ReportCitationT.""" def tasktitle(self): - return _("Initialize Consultant Check") + return _("Consultant Check") def taskicon(self): return program['theme'].photo['icontall'] def tooltip(self): @@ -9587,9 +9526,7 @@ def __init__(self, parent): #frame, filename=None class ReportCitationT(Report,Tone,TaskDressing,ui.Window): """docstring for ReportCitationT.""" def tasktitle(self): - return _("Tone Report") - # "Make Reports on Citation Form Sorting in Tone Frames") - # return _("Report on one slice of Citation Forms (in Tone Frames)") + return _("Tone Report (not backgrounded)") def taskicon(self): return program['theme'].photo['iconTRep'] def tooltip(self): @@ -9599,53 +9536,54 @@ def tooltip(self): def dobuttonkwargs(self): return {'text':"Report!", 'fn':self.do, - # column=0, 'font':'title', 'compound':'bottom', #image bottom, left, right, or top of text 'image':self.taskchooser.theme.photo['TRep'], 'sticky':'ew' } - def __init__(self, parent): #frame, filename=None + def __init__(self, parent): Tone.__init__(self) ui.Window.__init__(self,parent) self.do=self.tonegroupreport TaskDressing.__init__(self,parent) Report.__init__(self) self.bylocation=False -class ReportCitationTlocation(Report,Tone,TaskDressing,ui.Window): +class ReportCitationTBackground(Background,ReportCitationT): """docstring for ReportCitationT.""" def tasktitle(self): - return _("Tone Report (by frames)") - # "Make Reports on Citation Form Sorting in Tone Frames") - # return _("Report on one slice of Citation Forms (in Tone Frames)") + return _("Tone Report") def taskicon(self): return program['theme'].photo['iconTRep'] def tooltip(self): return _("This report gives you report for one lexical " "category, in one syllable profile. \nIt does " - "this for all data sorted in tone frames, organized by frame.") + "this for all data sorted in tone frames.") def dobuttonkwargs(self): return {'text':"Report!", 'fn':self.do, - # column=0, 'font':'title', 'compound':'bottom', #image bottom, left, right, or top of text 'image':self.taskchooser.theme.photo['TRep'], 'sticky':'ew' } - def __init__(self, parent): #frame, filename=None - Tone.__init__(self) - ui.Window.__init__(self,parent) - self.do=self.tonegroupreport - TaskDressing.__init__(self,parent) - Report.__init__(self) + def __init__(self, parent): + ReportCitationT.__init__(self,parent) + Background.__init__(self) +class ReportCitationTL(ReportCitationT): + """docstring for ReportCitationT.""" + def tasktitle(self): + return _("Tone Report (by frames, not backgrounded)") + def tooltip(self): + return _("This report gives you report for one lexical " + "category, in one syllable profile. \nIt does " + "this for all data sorted in tone frames, organized by frame.") + def __init__(self, parent): + ReportCitationT.__init__(self,parent) self.bylocation=True -class ReportCitationTlocationBackground(ReportCitationTlocation,Report,Tone,TaskDressing,ui.Window): +class ReportCitationTLBackground(Background,ReportCitationTL): """docstring for ReportCitationT.""" def tasktitle(self): - return _("Tone Report (by frames, in the background)") - # "Make Reports on Citation Form Sorting in Tone Frames") - # return _("Report on one slice of Citation Forms (in Tone Frames)") + return _("Tone Report (by frames)") def taskicon(self): return program['theme'].photo['iconTRep'] def tooltip(self): @@ -9655,27 +9593,18 @@ def tooltip(self): def dobuttonkwargs(self): return {'text':"Report!", 'fn':self.do, - # column=0, 'font':'title', 'compound':'bottom', #image bottom, left, right, or top of text 'image':self.taskchooser.theme.photo['TRep'], 'sticky':'ew' } - def __init__(self, parent): #frame, filename=None - Tone.__init__(self) - ui.Window.__init__(self,parent) - self.do=self.reportmulti - self.reportfn=self.tonegroupreport - TaskDressing.__init__(self,parent) - self.settings.maxprofiles=None - self.settings.maxpss=None - Report.__init__(self) - self.bylocation=True -class ReportCitationBasicT(Report,Comprehensive,Tone,TaskDressing,ui.Window): + def __init__(self, parent): + ReportCitationTL.__init__(self,parent) + Background.__init__(self) +class ReportCitationMultisliceT(MultisliceT,ReportCitationT): """docstring for ReportCitationT.""" def tasktitle(self): - return _("Comprehensive Tone Report") - # Report on several slices of Citation Forms (in Tone Frames)") + return _("Multislice Tone Report (not background)") def taskicon(self): return program['theme'].photo['iconTRepcomp'] def tooltip(self): @@ -9685,27 +9614,34 @@ def tooltip(self): def dobuttonkwargs(self): return {'text':"Report!", 'fn':self.do, - # column=0, 'font':'title', 'compound':'bottom', #image bottom, left, right, or top of text 'image':self.taskchooser.theme.photo['TRepcomp'], 'sticky':'ew' } - def __init__(self, parent): #frame, filename=None - Tone.__init__(self) - ui.Window.__init__(self,parent) - self.do=self.tonegroupreportcomprehensive - # self.do=self.tonegroupreport - TaskDressing.__init__(self,parent) - Report.__init__(self) - self.bylocation=False -class ReportCitationBasicTBackground(ReportCitationBasicT,Report,Comprehensive,Tone,TaskDressing,ui.Window): + def __init__(self, parent): + ReportCitationT.__init__(self,parent) + MultisliceT.__init__(self) +class ReportCitationMultisliceTL(MultisliceT,ReportCitationTL): """docstring for ReportCitationT.""" def tasktitle(self): - return _("Comprehensive Tone Report, in the background") - # self.do=self.tonegroupreportcomprehensive - # self.do=self.tonegroupreport - # TaskDressing.__init__(self,parent) + return _("Multislice Tone Report (not background)") + def taskicon(self): + return program['theme'].photo['iconTRepcomp'] + def tooltip(self): + return _("This report gives you reports across multiple lexical " + "categories, and across multiple syllable profiles. \nIt does " + "this for all data sorted in tone frames, organized by word.") + def dobuttonkwargs(self): + return {'text':"Report!", + 'fn':self.do, + 'font':'title', + 'compound':'bottom', #image bottom, left, right, or top of text + 'image':self.taskchooser.theme.photo['TRepcomp'], + 'sticky':'ew' + } + def __init__(self, parent): + ReportCitationTL.__init__(self,parent) MultisliceT.__init__(self) class ReportCitationMultisliceTBackground(Background,ReportCitationMultisliceT): """docstring for ReportCitationT.""" From fddf42aabd1454e35fea3e41b943ca7251b0ff1d Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 17:20:20 +0100 Subject: [PATCH 081/124] recording --- main.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 69732f48..7017ce85 100755 --- a/main.py +++ b/main.py @@ -6961,7 +6961,7 @@ def makelabelsnrecordingbuttons(self,parent,sense): lxl.grid(row=sense['row'],column=sense['column']+1,sticky='w') def __init__(self): self.soundcheck() -class Record(Sound): +class Record(Sound,TaskDressing,ui.Window): """This holds all the Sound methods specific for Recording.""" def showentryformstorecordpage(self): #The info we're going for is stored above sense, hence guid. @@ -7219,6 +7219,8 @@ def next(): command=next).grid(row=1,column=0) self.donewpyaudio() def __init__(self): + ui.Window.__init__(self,parent) + TaskDressing.__init__(self,parent) Sound.__init__(self) self.mikecheck() #only ask for settings check if recording class Report(object): @@ -9326,8 +9328,7 @@ def __init__(self, parent): Tone.__init__(self) ui.Window.__init__(self, parent) TaskDressing.__init__(self, parent) -class RecordCitation(Record,Segments,TaskDressing,ui.Window): - """docstring for RecordCitation.""" +class RecordCitation(Record,Segments): def tooltip(self): return _("This task helps you record words in isolation forms.") def dobuttonkwargs(self): @@ -9344,12 +9345,10 @@ def taskicon(self): return program['theme'].photo['iconWordRec'] def __init__(self, parent): #frame, filename=None Segments.__init__(self,parent) - ui.Window.__init__(self,parent) - TaskDressing.__init__(self,parent) + # ui.Window.__init__(self,parent) + # TaskDressing.__init__(self,parent) Record.__init__(self) - # self.do=self.showentryformstorecord -class RecordCitationT(Record,Tone,TaskDressing,ui.Window): - """docstring for RecordCitation.""" +class RecordCitationT(Record,Tone): def tooltip(self): return _("This task helps you record words in tone frames, in citation form.") def dobuttonkwargs(self): @@ -9366,10 +9365,7 @@ def tasktitle(self): return _("Record Tone") #Citation Form Sorting in Tone Frames def __init__(self, parent): #frame, filename=None Tone.__init__(self) - ui.Window.__init__(self,parent) - TaskDressing.__init__(self,parent) Record.__init__(self) - # self.do=self.showtonegroupexs class ReportCitation(Report,Segments,TaskDressing,ui.Window): """docstring for ReportCitation.""" def tasktitle(self): From dc15db0f0b56aad248827584abe4d3ef496c2e7d Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 17:26:24 +0100 Subject: [PATCH 082/124] updates to transcribe --- main.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index 7017ce85..08b4022e 100755 --- a/main.py +++ b/main.py @@ -8633,7 +8633,7 @@ def marktosortguid(self,guid): self.guidstosort.append(guid) self.guidssorted.remove(guid) """Doing stuff""" -class Transcribe(Sound,Sort): +class Transcribe(Sound,Sort,TaskDressing,ui.Window): def updateerror(self,event=None): self.errorlabel['text'] = '' def switchgroups(self,comparison=None): @@ -9030,11 +9030,13 @@ def changegroupnow(event=None): """Store these variables above, finish with (destroying window with local variables):""" def __init__(self,parent): #frame, filename=None + ui.Window.__init__(self, parent) + TaskDressing.__init__(self, parent) parent.settings.makeeverythingok() self.mistake=False #track when a user has made a mistake self.status.makecheckok() Sound.__init__(self) -class TranscribeV(Transcribe,Segments,Sound,Sort,TaskDressing,ui.Window): +class TranscribeV(Transcribe,Segments): def tasktitle(self): return _("Vowel Letters") def tooltip(self): @@ -9050,9 +9052,6 @@ def dobuttonkwargs(self): def taskicon(self): return program['theme'].photo['iconTranscribeV'] def __init__(self, parent): #frame, filename=None - # Tone.__init__(self, parent) - ui.Window.__init__(self, parent) - TaskDressing.__init__(self, parent) self.glyphspossible=[ #'a','e','i','o','u','ɛ','ɔ','ɨ','ʉ'] #tilde (decomposed): 'ã', 'ẽ', 'ɛ̃', 'ə̃', 'ɪ̃', 'ĩ', 'õ', 'ɔ̃', 'ũ', 'ʊ̃', @@ -9074,7 +9073,7 @@ def __init__(self, parent): #frame, filename=None ] self.params.cvt('V') Transcribe.__init__(self,parent) -class TranscribeC(Transcribe,Segments,Sound,Sort,TaskDressing,ui.Window): +class TranscribeC(Transcribe,Segments): def tasktitle(self): return _("Consonant Letters") def tooltip(self): @@ -9090,8 +9089,6 @@ def dobuttonkwargs(self): def taskicon(self): return program['theme'].photo['iconTranscribeC'] def __init__(self, parent): #frame, filename=None - ui.Window.__init__(self, parent) - TaskDressing.__init__(self, parent) self.glyphspossible=[#'p','b','k','g','d','t',] 'bh','dh','gh','gb', 'b',#'B', @@ -9130,7 +9127,7 @@ def __init__(self, parent): #frame, filename=None ] self.params.cvt('C') Transcribe.__init__(self,parent) -class TranscribeT(Transcribe,Tone,Sound,Sort,TaskDressing,ui.Window): +class TranscribeT(Transcribe,Tone): def tasktitle(self): return _("Transcribe Tone") def tooltip(self): @@ -9148,8 +9145,6 @@ def taskicon(self): return program['theme'].photo['iconTranscribe'] def __init__(self, parent): #frame, filename=None Tone.__init__(self) - ui.Window.__init__(self, parent) - TaskDressing.__init__(self, parent) self.glyphspossible=None self.params.cvt('T') Transcribe.__init__(self,parent) @@ -9200,7 +9195,7 @@ def submitform(): for senseid in self.analysis.senseidsbygroup[group]: self.db.addtoneUF(senseid,uf,analang=self.analang, write=False) - self.db.write() + self.maybewrite() self.runwindow.destroy() self.status.last('joinUF',update=True) self.tonegroupsjoinrename() #call again, in case needed @@ -9219,9 +9214,9 @@ def done(): if not analysisOK: redo(timestamps) #otherwise, the user will almost certainly be upset to have to do it later return - self.update() self.getrunwindow(msg=_("Preparing to join draft underlying form groups" "")+'\n'+timestamps) + self.update() title=_("Join/Rename Draft Underlying {}-{} tone groups".format( ps,profile)) self.runwindow.title(title) From 3219a122dedc061024f95faecbe8e4a86b8530ac Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 17:27:02 +0100 Subject: [PATCH 083/124] updates to report superclasses --- main.py | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 08b4022e..0234b8b0 100755 --- a/main.py +++ b/main.py @@ -8277,15 +8277,34 @@ def __init__(self): self.profilesbysense=self.settings.profilesbysense self.s=self.settings.s self.byUFgroup=False -class Comprehensive(object): +class Multislice(object): + """This class just triggers which settings are visible to the user, and + updates changes from child classes""" def __init__(self): + # log.info("Setting up Multislice report, with {}".format(dir())) + """I think these two should go:""" + self.frame.status.redofinalbuttons() #because the fns changed +class MultisliceS(Multislice): + def __init__(self): + self.do=self.basicreport self.status.group(None) - log.info("Setting up Multislice report, based on {}" - "".format(self.do.__name__)) + Multislice.__init__(self) +class MultisliceT(Multislice): + def __init__(self): + self.do=self.tonegroupreportcomprehensive + Multislice.__init__(self) +class Multicheck(object): + def __init__(self): + """This should only be used for segmental checks; tone reports are + always multiple checks""" + self.status.group(None) + log.info("Setting up Multicheck report, based on {}".format(dir())) self.do=self.basicreport self.frame.status.redofinalbuttons() #because the fns changed - log.info("doing basic report on {} with groups {}".format(self.cvtstodo, - self.status.group())) +class Multicheckslice(Multicheck,MultisliceS): + def __init__(self): + Multicheck.__init__(self) + MultisliceS.__init__(self) class ByUF(Tone): def __init__(self): Tone.__init__(self) #Nothing here; just make methods available @@ -8293,13 +8312,11 @@ def __init__(self): log.info("doing report by UF groups") class Background(object): """This class runs a report function in the background, where possible""" - def __init__(self,parent): + def __init__(self): log.info("Setting up background report, based on {}" "".format(self.do.__name__)) - self.reportfn=self.do - self.do=self.reportmulti + self.do=lambda fn=self.do:self.background(fn) self.frame.status.redofinalbuttons() #because the fns changed - # super(Background, self).__init__(parent) class SortCV(Sort,Segments,TaskDressing,ui.Window): """docstring for SortCV.""" def __init__(self, parent): From c2dc7a238c2c30df1dad984a768c3a4026586d9c Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 17:28:41 +0100 Subject: [PATCH 084/124] update to coocurrence tables --- main.py | 87 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index 0234b8b0..f2d00386 100755 --- a/main.py +++ b/main.py @@ -8199,28 +8199,90 @@ def coocurrencetables(self,xlpr): self.checkcounts[ps][profile].keys())) for ufg in self.checkcounts[ps][profile]: checks=self.orderchecks(self.checkcounts[ps][profile][ufg]) - for check in checks: + columncounts={} + # Divide checks into those with multiple columns, and others + xchecks=[i for i in checks if 'x' in i] + onecolchecks=[i for i in checks if 'x' not in i] + # Put all single column tables into one dataset: + for check in onecolchecks: + counts=self.checkcounts[ps][profile][ufg][check] + for row in counts: + try: + columncounts[row][check]=counts[row] + except (KeyError,UnboundLocalError): + try: + columncounts[row]={check:counts[row]} + except (KeyError,UnboundLocalError): + columncounts={row:{check:counts[row]}} + # Test the other checks, to see if any is wider than tall: + wide=False + for check in xchecks: counts=self.checkcounts[ps][profile][ufg][check] - if len(list(counts)) and len([counts[k] for k in counts - ]): - log.debug("Counts by ({}-{}) check: {}".format(ufg, - check,counts)) - caption=' '.join([ufg,ps,profile,check]) - table=xlp.Table(s3s,caption) - self.coocurrencetable(table,check,counts) + for r in [i for i in counts if counts[i]]: + if len([i for i in counts[r] if counts[r][i]] + )>len([i for i in counts if counts[i]]): + wide=True + if not wide: + #if all are not wide, join them into one row + caption=' '.join([ufg,ps,profile,check]) + table=xlp.Table(s3s,caption) + row=xlp.Row(table) + for check in xchecks: + counts=self.checkcounts[ps][profile][ufg][check] + if (len(list(counts)) and + len([counts[k] for k in counts])): + cell=xlp.Cell(row) + caption=' '.join([ufg,ps,profile,check]) + tableb=xlp.Table(cell,caption,numbered=False) + log.debug("Counts by ({}-{}) check: {}".format( + ufg, + check, + counts)) + self.coocurrencetable(tableb,check,counts) + else: + #if they are wide, just leave them in their own tables: + for check in xchecks: + counts=self.checkcounts[ps][profile][ufg][check] + if (len(list(counts)) and + len([counts[k] for k in counts])): + log.debug("Counts by ({}-{}) check: {}".format( + ufg, + check, + counts)) + caption=' '.join([ufg,ps,profile,check]) + table=xlp.Table(s3s,caption) + self.coocurrencetable(table,check,counts) + #Finally, do all single column tables in one table: + if (columncounts and len(list(columncounts)) and + len([columncounts[k] for k in columncounts])): + log.debug("Counts by ({}-{}) check: {}".format(ufg, + check,columncounts)) + caption=' '.join([ufg,ps,profile,check]) + table=xlp.Table(s3s,caption) + self.coocurrencetable(table,'x',columncounts) def coocurrencetable(self,table,check,counts): """This needs to work with an additional layer, for UF groups""" """Basic report doesn't seem to put out any data""" - rows=list(counts)#self.checkcounts[ps][profile][check]) if 'x' in check: + rows=[r for r,c in counts.items() + if [c[v] for v in c + if c[v] + ] + ] cols=sorted(set(ck for r,c in counts.items() for ck,cv in c.items() if c[ck] )) else: + rows=[r for r,c in counts.items() + if c + ] cols=[check] maxcols=20 + if not rows: + table.destroy() + return if len(cols) >maxcols: #break table ncols=int(len(cols)/2)+1 colsa=cols[:ncols] @@ -8254,7 +8316,7 @@ def coocurrencetable(self,table,check,counts): if x1 == 'header' and x2 == 'header': # log.debug("header corner") # cell=xlp.Cell(h,content=name,header=True) - cell=xlp.Cell(h,content='',header=True) + cell=xlp.Cell(h,content=check,header=True) elif x1 == 'header': # log.debug("header row") cell=xlp.Cell(h,content=x2,header=True) @@ -8266,7 +8328,10 @@ def coocurrencetable(self,table,check,counts): if x2 == check: value=counts[x1] else: - value=counts[x1][x2] + try: + value=counts[x1][x2] + except KeyError: + value='' if not value: value='' cell=xlp.Cell(h,content=value) From de5b1f9d816706d723994b27e0f9b7d614b172dc Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 17:30:33 +0100 Subject: [PATCH 085/124] profilestodo --- main.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index f2d00386..74389bea 100755 --- a/main.py +++ b/main.py @@ -7234,16 +7234,13 @@ def consultantcheck(self): def tonegroupreportcomprehensive(self,**kwargs): """Should set this to do all analyses upfront, then run all in the background""" - pss=self.slices.pss()[:self.settings.maxpss] - d={} - for ps in pss: - d[ps]=self.slices.profiles(ps=ps)[:self.settings.maxprofiles] - log.info("Starting comprehensive reports for {}".format(d)) + kwargs['psprofiles']=self.psprofilestodo() + kwargs['xlpr']=self.xlpstart(reporttype='MultisliceTone',**kwargs) + log.info("Starting comprehensive reports for {}".format( + kwargs['psprofiles'])) kwargs['usegui']=False - for ps in pss: - for profile in d[ps]: - kwargs['ps']=ps - kwargs['profile']=profile + for kwargs['ps'] in kwargs['psprofiles']: + for kwargs['profile'] in kwargs['psprofiles'][kwargs['ps']]: # self.tonegroupreport(**kwargs) #ps=ps,profile=profile) self.tonegroupreport(**kwargs) #ps=ps,profile=profile) """Not working:""" @@ -8086,6 +8083,13 @@ def printprofilesbyps(self): continue print(ps, self.profilesbysense[ps]) def basicreport(self,**kwargs): + def psprofilestodo(self): + if isinstance(self,Multislice): + return {ps:self.slices.profiles(ps=ps)[:self.settings.maxprofiles] + for ps in self.slices.pss()[:self.settings.maxpss] + } + else: + return {self.slices.ps():[self.slices.profile()]} """We iterate across these values in this script, so we save current values here, and restore them at the end.""" def iteratecvt(parent,**kwargs): @@ -8118,10 +8122,7 @@ def iteratecvt(parent,**kwargs): self.basicreportfile=''.join([str(self.reportbasefilename) ,'_',''.join(sorted(self.cvtstodo)[:2]) ,'_BasicReport.txt']) - kwargs['psprofiles']={ps:self.slices.profiles(ps=ps)[ - :self.settings.maxprofiles] - for ps in self.slices.pss()[:self.settings.maxpss] - } + kwargs['psprofiles']=self.psprofilestodo() log.info("kwargs['psprofiles']={}".format(kwargs['psprofiles'])) xlpr=self.xlpstart(reporttype='Multislice '+''.join(self.cvtstodo), **kwargs) From d2218846a2a7bdfbdc91642933766f5706146701 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:47:36 +0100 Subject: [PATCH 086/124] rework status lines --- main.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/main.py b/main.py index 74389bea..2a5cb64a 100755 --- a/main.py +++ b/main.py @@ -1016,32 +1016,32 @@ def __init__(self, parent, taskchooser, task, **kwargs): self.glosslangline() if isinstance(self.task,Segments): self.fieldsline() - if hasattr(self.settings,'slices') and (isinstance(self.task,Sort) or - (isinstance(self.task,Tone) and not isinstance(self.task,Report)) or - (isinstance(self.task,Report) and - not isinstance(self.task,Comprehensive)) or - isinstance(self.task,ParseSlice) - ): + if (hasattr(self.settings,'slices') and + not isinstance(self.task,TaskChooser)): self.cvt=self.settings.params.cvt() self.ps=self.settings.slices.ps() self.profile=self.settings.slices.profile() self.check=self.settings.params.check() self.checks=self.settings.status.checks() - self.sliceline() - if not (isinstance(self.task,Report) or + if isinstance(self.task,Multislice): #any cvt + self.maxes() + else: + self.sliceline() + if isinstance(self.task,Multicheck): #segments only + self.multicheckscope() + elif not isinstance(self.task,ReportCitationT): + self.cvtline() + if isinstance(self.task,Sort): + self.buttoncolumnsline() + if not ( + # isinstance(self.task,Report) or + isinstance(self.task,TaskChooser) or isinstance(self.task,Record) or isinstance(self.task,JoinUFgroups) or isinstance(self.task,Parse) ): - self.cvtline() - self.buttoncolumnsline() self.maybeboard() - elif isinstance(self.task,Segments): - self.cvtline() - if isinstance(self.task,Comprehensive): - self.maxes() - if not self.taskchooser.showreports: - self.finalbuttons() + self.finalbuttons() class Settings(object): """docstring for Settings.""" def interfacelangwrapper(self,choice=None,window=None): From 32856c4ef111d6550d96838ee93526b3f4135125 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:48:01 +0100 Subject: [PATCH 087/124] look for this, too --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index 2a5cb64a..4155f1df 100755 --- a/main.py +++ b/main.py @@ -2897,6 +2897,8 @@ def makestatusframe(self,dict=None): 'maxprofiles':self.settings.maxprofiles, 'maxpss':self.settings.maxpss } + if isinstance(self.task,Multicheck): + dictnow['cvtstodo']=self.task.cvtstodo else: dictnow={ 'iflang':self.settings.interfacelangwrapper(), From 8be7dce129a3067ad2c79ea0b1d163d3039a1b3c Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:48:44 +0100 Subject: [PATCH 088/124] rework reports and buttons --- main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 4155f1df..2d3e5a1c 100755 --- a/main.py +++ b/main.py @@ -777,7 +777,7 @@ def multicheckscope(self): def redofinalbuttons(self): if hasattr(self,'bigbutton') and self.bigbutton.winfo_exists(): self.bigbutton.destroy() - self.finalbuttons() + self.finalbuttons() def finalbuttons(self): # self.opts['row']+=6 self.opts['row']+=1 @@ -2664,6 +2664,9 @@ def _taskchooserbutton(self): text=_("Analyze") else: text=_("Collect Data") + elif isinstance(self,Report): + text=_("Reports") + self.taskchooser.showreports=True else: text=_("Tasks") if hasattr(self,'chooserbutton'): @@ -3980,7 +3983,10 @@ def gettask(self,event=None): """This function allows the user to select from any of tasks whose prerequisites are minimally satisfied.""" # if self.reports: - self.frame.status.bigbutton.destroy() + try: + self.frame.status.bigbutton.destroy() + except AttributeError: + log.info("There doesn't seem to be a big button") if not self.showreports: self.frame.status.finalbuttons() if not self.mainwindow: From c78c18f5ef8911913839978d2fa215b25e613698 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:48:58 +0100 Subject: [PATCH 089/124] give default --- main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.py b/main.py index 2d3e5a1c..dd418385 100755 --- a/main.py +++ b/main.py @@ -3883,6 +3883,11 @@ def __init__(self,parent): """These are raw attributes from file""" """these are objects made by the task chooser""" self.inherittaskattrs() + if hasattr(self,'task') and isinstance(self.task,Multicheck): + if hasattr(self.settings,'cvtstodo'): + self.cvtstodo=self.settings.cvtstodo + else: + self.cvtstodo=['V'] self.analang=self.params.analang() # Every task gets this here # super(TaskDressing, self).__init__(parent) for k in ['settings', From 207b1ddc18ca62b3a7fea2f5fc443196e4c00a6d Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:50:41 +0100 Subject: [PATCH 090/124] new report availabaility --- main.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/main.py b/main.py index dd418385..21c89113 100755 --- a/main.py +++ b/main.py @@ -4094,27 +4094,22 @@ def makeoptions(self): self.whatsdone() if self.showreports: tasks=[ - ReportCitation, - ReportCitationBackground + ReportCitationBackground, + ReportCitationMulticheckBackground, + ReportCitationMultichecksliceBackground ] if self.doneenough['collectionlc']: """This currently takes way too much time. Until it gets mutithreaded, it will not be an option""" - tasks.append(ReportCitationBasicV) - tasks.append(ReportCitationBasicC) - tasks.append(ReportCitationBasicCV) - tasks.append(ReportCitationBasicVC) - tasks.append(ReportCitationBasic) if self.doneenough['sortT']: - tasks.append(ReportCitationT) - tasks.append(ReportCitationTlocation) - tasks.append(ReportCitationTlocationBackground) - tasks.append(ReportCitationBasicT) - tasks.append(ReportCitationBasicTBackground) + tasks.append(ReportCitationTBackground) + tasks.append(ReportCitationTLBackground) + tasks.append(ReportCitationMultisliceTBackground) + tasks.append(ReportCitationMultisliceTLBackground) if self.doneenough['analysis']: - tasks.append(ReportCitationByUF) tasks.append(ReportCitationByUFBackground) - tasks.append(ReportCitationBasicVByUF) + tasks.append(ReportCitationByUFMulticheckBackground) + tasks.append(ReportCitationByUFMultichecksliceBackground) elif self.datacollection: tasks=[ WordCollectionCitation, From f28dd1194f5ccd995ea71f045c94416d2c4cf817 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:52:04 +0100 Subject: [PATCH 091/124] add ufg layer --- main.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 21c89113..8cfbb0cb 100755 --- a/main.py +++ b/main.py @@ -7705,18 +7705,19 @@ def iterateUFgroups(parent,**kwargs): for ps in self.checkcounts: for profile in self.checkcounts[ps]: for check in self.checkcounts[ps][profile]: - for group in self.checkcounts[ps][profile][check]: - i=self.checkcounts[ps][profile][check][group] - if isinstance(i,int): - n+=i - else: - for g2 in i: - i2=i[g2] - if isinstance(i2,int): - n+=i2 - else: - log.info("Not sure what I'm dealing with! " - "({})".format(i2)) + for ufg in self.checkcounts[ps][profile][ufg]: + for group in self.checkcounts[ps][profile][ufg][check]: + i=self.checkcounts[ps][profile][ufg][check][group] + if isinstance(i,int): + n+=i + else: + for g2 in i: + i2=i[g2] + if isinstance(i2,int): + n+=i2 + else: + log.info("Not sure what I'm dealing with! " + "({})".format(i2)) if not n: #i.e., nothing was found above text=_("No results for {}/{} ({})!").format(kwargs['profile'], kwargs['check'], @@ -7802,6 +7803,8 @@ def xlpstart(self,**kwargs): reporttype]) else: reporttype=' '.join([ps,profile,reporttype]) + elif self.byUFgroup: + reporttype+='byUFgroup' bits=[str(self.reportbasefilename),rx.id(reporttype),"ReportXLP"] if not default: bits.append('mod') From 4051e65c60e76f41f16d86bc75673fc681113e0c Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:52:36 +0100 Subject: [PATCH 092/124] distinguish between disontinuous and continuous comparisons --- main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 8cfbb0cb..622524d2 100755 --- a/main.py +++ b/main.py @@ -4578,10 +4578,15 @@ def buildregex(self,**kwargs): S=str(cvt) #should this ever be cvt? Do I ever want CV1xCV2,CV1=CV2? regexS='.*?'+S #This will be a problem if S=NC or CG... # log.info("regexS: {}".format(regexS)) - if 'x' in check: - replS='\\1'+group+self.groupcomparison + if 'x' in check and cvt in ['V','C']: + replScomp='\\1'+self.groupcomparison + replS='\\1'+group + compared=False # log.info("Making regex for {} check with group {} and " # "comparison {} ({})".format(check,group,self.groupcomparison,replS)) + elif 'x' in check: + replS='\\1'+group+self.groupcomparison + compared=True #well, don't do two runs, in any case. else: # log.info("Not comparing: {}".format(check)) replS='\\1'+group From 2e5fe81492845677df48c818270bfc2439516ae9 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:52:59 +0100 Subject: [PATCH 093/124] d --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 622524d2..99e3e313 100755 --- a/main.py +++ b/main.py @@ -4607,7 +4607,11 @@ def buildregex(self,**kwargs): # log.info("regS: {}".format(regS)) # log.info("replS: {}".format(replS)) # log.info("self.regexCV: {}".format(self.regexCV)) - self.regexCV=rx.sub(regS,replS,self.regexCV, count=1) + if 'x' in check and not compared: + self.regexCV=rx.sub(regS,replScomp,self.regexCV, count=1) + compared=True + else: + self.regexCV=rx.sub(regS,replS,self.regexCV, count=1) # log.info("self.regexCV: {}".format(self.regexCV)) # else: # log.info("{} not found in {}".format(S+str(occurrence), From 3559c7c70edeff89fd5ccc6ddcc689f0aa7a7f46 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:56:10 +0100 Subject: [PATCH 094/124] wrap --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 99e3e313..ffa1c467 100755 --- a/main.py +++ b/main.py @@ -7264,6 +7264,7 @@ def tonegroupreportcomprehensive(self,**kwargs): # with multiprocessing.Pool(processes=4) as pool: # pool.map(self.tonegroupreport,[ # {'ps':ps,'profile':p,'usegui':False} for p in d[ps]]) + kwargs['xlpr'].close(me=me) def reportmulti(self,**kwargs): # threading.Thread(target=self.tonegroupreport,kwargs=kwargs).start() start_time=nowruntime() From 0894915c674ae1622fd609f9d3d26fd736823c30 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 18:57:33 +0100 Subject: [PATCH 095/124] reporttype --- main.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index ffa1c467..bfaa7a5d 100755 --- a/main.py +++ b/main.py @@ -7793,26 +7793,27 @@ def buildXLPtable(self,parent,caption,yterms,xterms,values,ycounts=None,xcounts= def xlpstart(self,**kwargs): ps=kwargs.get('ps',self.slices.ps()) profile=kwargs.get('profile',self.slices.profile()) - reporttype=kwargs.get('reporttype','adhoc') default=kwargs.get('default',True) - if reporttype == 'Tone': - if self.bylocation: - reporttype='Tone-bylocation' - elif not 'Basic' in reporttype: #We don't want this in the title #this is only for adhoc "big button" reports. - reporttype=str(self.params.check()) - if 'psprofiles' in kwargs: + + if isinstance(self, Multislice) and 'psprofiles' in kwargs: reporttype=' '.join( - [' '.join( [' '.join([ps]+ ['('+'-'.join(kwargs['psprofiles'][ps])+')' ]) for ps in kwargs['psprofiles'] - ]), # profile, - reporttype]) else: - reporttype=' '.join([ps,profile,reporttype]) + reporttype=' '.join([ps,profile]) + if isinstance(self,Multicheck): + reporttype+=' '+'-'.join(self.cvtstodo) + else: + reporttype+='-'+self.params.check() + if isinstance(self,Tone) and not isinstance(self,Segments): #not byUF + if self.bylocation: + reporttype='Tone-bylocation' + else: + reporttype='Tone' elif self.byUFgroup: reporttype+='byUFgroup' bits=[str(self.reportbasefilename),rx.id(reporttype),"ReportXLP"] From a75e99c5604b8aeda501586373c73cfd873ca8af Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:00:28 +0100 Subject: [PATCH 096/124] rework --- main.py | 58 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/main.py b/main.py index bfaa7a5d..6c67abc9 100755 --- a/main.py +++ b/main.py @@ -7865,39 +7865,51 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): matches=set(self.senseidformsbyregex(self.regex,**kwargs)) if 'ufsenseids' in kwargs: matches=matches&set(kwargs['ufsenseids']) - if 'x' not in check and '=' not in check: #only pull from simple reports - for ncvt in self.ncvts: #for basic reports - try: # this removes senses already reported (e.g., in V1=V2) - matches-=self.basicreported[ncvt] - except AttributeError: - log.info("Not removing ids from basic reported because it " - "isn't there. Hope that's appropriate (e.g., in an " - "ad hoc report)") - except KeyError: - log.info("Not removing ncvt {} ids from basic reported; " - "hope that's appropriate." - "".format(ncvt)) + if check in self.basicreported: + # log.info("Removing {} entries already found from {} entries found " + # "by {} check".format(len(self.basicreported[check]), + # len(matches), + # check)) + # log.info("Entries found ({}):".format(len(matches))) + for m in list(matches)[:4]: + log.info(self.taskchooser.datadict.getframeddata(m).framed) + # log.info("Entries removed ({}):".format(len(self.basicreported[check]&matches))) + for m in list(self.basicreported[check]&matches)[:4]: + log.info(self.taskchooser.datadict.getframeddata(m).framed) + # log.info("Entries remaining ({}):".format(len(matches-self.basicreported[check]))) + for m in list(matches-self.basicreported[check])[:4]: + log.info(self.taskchooser.datadict.getframeddata(m).framed) + matches-=self.basicreported[check] + # log.info("{} entries remaining.".format(len(matches))) ufg=kwargs['ufgroup'] n=len(matches) # log.info("{} matches found!: {}".format(len(matches),matches)) if 'x' not in check: - try: - self.checkcounts[ps][profile][ufg][check][group]=n - except KeyError: + ncheckssimple=len(check.split('=')) #how many syllables impacted + chks=check.split('=')+[check] #each and all together + for r in range(1,ncheckssimple): #make other splits (e.g., V2=V3) + chks+=check.split('=',r)+check.rsplit('=',r) + for c in set(chks): #get each bit, and whole, too try: - self.checkcounts[ps][profile][ufg][check]={group:n} + self.checkcounts[ps][profile][ufg][c][group]+=n except KeyError: try: - self.checkcounts[ps][profile][ufg]={check:{group:n}} + self.checkcounts[ps][profile][ufg][c][group]=n except KeyError: try: - self.checkcounts[ps][profile]={ufg:{check:{ - group:n}}} + self.checkcounts[ps][profile][ufg][c]={group:n} except KeyError: - self.checkcounts[ps]={profile:{ufg:{check:{ - group:n}}}} - log.info("ps: {}, profile: {}, check: {}, group: {}" - "".format(ps,profile,check,group)) + try: + self.checkcounts[ps][profile][ufg]={c:{group:n}} + except KeyError: + try: + self.checkcounts[ps][profile]={ufg:{c:{ + group:n}}} + except KeyError: + self.checkcounts[ps]={profile:{ufg:{c:{ + group:n}}}} + # log.info("ps: {}, profile: {}, check: {}, " + # "group: {}".format(ps,profile,c,group)) if 'x' in check or len(check.split('=')) == 2: if 'x' in check: othergroup=self.groupcomparison From 18c19e479f21841d49138687296b5ba6b8bee5a3 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:03:22 +0100 Subject: [PATCH 097/124] syntax --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 6c67abc9..a65944b9 100755 --- a/main.py +++ b/main.py @@ -7802,7 +7802,7 @@ def xlpstart(self,**kwargs): ['('+'-'.join(kwargs['psprofiles'][ps])+')' ]) for ps in kwargs['psprofiles'] - # profile, + ]) else: reporttype=' '.join([ps,profile]) if isinstance(self,Multicheck): From b3cde0096b245bed2f71d539e0b6f05ed256c78a Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:04:32 +0100 Subject: [PATCH 098/124] track basicreported --- main.py | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index a65944b9..8566bce4 100755 --- a/main.py +++ b/main.py @@ -7913,31 +7913,32 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): if 'x' in check or len(check.split('=')) == 2: if 'x' in check: othergroup=self.groupcomparison + c=check else: #if len(check.split('=')) == 2: """put X=Y data in XxY""" othergroup=group - check=rx.sub('=','x',check, count=1) + c=rx.sub('=','x',check, count=1) #copy V1=V2 into V1xV2 try: - self.checkcounts[ps][profile][ufg][check][ + self.checkcounts[ps][profile][ufg][c][ group][othergroup]=n except KeyError: try: - self.checkcounts[ps][profile][ufg][check][ + self.checkcounts[ps][profile][ufg][c][ group]={othergroup:n} except KeyError: try: - self.checkcounts[ps][profile][ufg][check]={group:{ + self.checkcounts[ps][profile][ufg][c]={group:{ othergroup:n}} except KeyError: try: - self.checkcounts[ps][profile][ufg]={check:{group:{ + self.checkcounts[ps][profile][ufg]={c:{group:{ othergroup:n}}} except KeyError: try: - self.checkcounts[ps][profile]={ufg:{check:{ + self.checkcounts[ps][profile]={ufg:{c:{ group:{othergroup:n}}}} except KeyError: - self.checkcounts[ps]={profile:{ufg:{check:{ + self.checkcounts[ps]={profile:{ufg:{c:{ group:{othergroup:n}}}}} if n>0: titlebits='x'+ps+profile+check+group @@ -7947,17 +7948,21 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): titlebits+=kwargs['ufgroup'] id=rx.id(titlebits) ex=xlp.Example(parent,id,heading=checkprose) + if '=' in check: + # log.info(self.basicreported.keys()) + log.info("Adding to basicreported for keys {}".format(check.split('='))) + for c in check.split('='): + log.info("adding {} matches".format(len(matches))) + try: + log.info("to {} matches for {}".format( + len(self.basicreported[c]),c)) + self.basicreported[c]|=matches + log.info("Last entries: {}".format(list(self.basicreported[c])[-5:])) + except KeyError: + log.info("to a new key for {}".format(c)) + self.basicreported[c]=matches + log.info("First entries: {}".format(list(self.basicreported[c])[:5])) for senseid in matches: - if 'x' not in check: #This won't add XxY data again. - for ncvt in self.ncvts: - try: - self.basicreported[ncvt].add(senseid) - except AttributeError: - pass - # log.info("Not adding ids to basic reported because " - # "it isn't there.") - except KeyError: - self.basicreported[ncvt]=set([senseid]) framed=self.taskchooser.datadict.getframeddata(senseid) self.framedtoXLP(framed,parent=ex,ftype=ftype,listword=True) #showgroups? if usegui and hasattr(self,'results'): #i.e., showing results in window From f5e3f4ffaa3b1b771499648b51df2c3aaecf5995 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:05:00 +0100 Subject: [PATCH 099/124] make check logic work for one or more checks --- main.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 8566bce4..024d3c21 100755 --- a/main.py +++ b/main.py @@ -7997,10 +7997,15 @@ def wordsbypsprofilechecksubcheck(self,parent='NoXLPparent',**kwargs): kwargs['profile']=kwargs.get('profile',self.slices.profile()) groups=self.status.groups(**kwargs) #was cvt only #CV checks depend on profile, too - checksunordered=self.status.checks(**kwargs) - self.checks=self.orderchecks(checksunordered) - """check set here""" - for kwargs['check'] in self.checks: #self.checkcodesbyprofile: + if isinstance(self,Multicheck): + checksunordered=self.status.checks(**kwargs) + checks=self.orderchecks(checksunordered) + log.info("Going to do these checks: {}".format(checksunordered)) + log.info("Going to do this order checks: {}".format(checks)) + else: + checks=[kwargs.get('check',self.params.check())] + """check set here""" + for kwargs['check'] in checks: #self.checkcodesbyprofile: """multithread here""" self.docheckreport(parent,**kwargs) def orderchecks(self,checklist): From d768043331696cd4849466cf5884905f8909d601 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:05:20 +0100 Subject: [PATCH 100/124] cleanup --- main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main.py b/main.py index 024d3c21..a2434475 100755 --- a/main.py +++ b/main.py @@ -8126,7 +8126,6 @@ def printprofilesbyps(self): if ps in ['Invalid','analang']: continue print(ps, self.profilesbysense[ps]) - def basicreport(self,**kwargs): def psprofilestodo(self): if isinstance(self,Multislice): return {ps:self.slices.profiles(ps=ps)[:self.settings.maxprofiles] From 81b86c0ec70df5fe3d9d86b1270b1f9c73e704a6 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:05:50 +0100 Subject: [PATCH 101/124] wrapping for reports --- main.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index a2434475..9873bf4d 100755 --- a/main.py +++ b/main.py @@ -7656,6 +7656,8 @@ def iterateUFgroups(parent,**kwargs): xlpr=self.xlpstart(**kwargs) if not hasattr(xlpr,'node'): log.info(_("Not repeating report that looks already started.")) + if kwargs['usegui']: + self.waitdone() return """"Do I need this?""" print(_("Getting results of Search request")) @@ -8133,6 +8135,10 @@ def psprofilestodo(self): } else: return {self.slices.ps():[self.slices.profile()]} + def basicreport(self,usegui=True,**kwargs): + """This does both multiple slices (starting with largest) and + multiple checks (all available per profile). + These should be separated""" """We iterate across these values in this script, so we save current values here, and restore them at the end.""" def iteratecvt(parent,**kwargs): @@ -8160,17 +8166,20 @@ def iteratecvt(parent,**kwargs): "examples of a segment type occur with different values, e.g., " "V1≠V2, those words will appear multiple times, e.g., for " "both V1=x and V2=y.") + kwargs['usegui']=usegui if kwargs['usegui']: #i.e., showing results in window self.wait(msg=_("Running {}").format(self.tasktitle())) self.basicreportfile=''.join([str(self.reportbasefilename) ,'_',''.join(sorted(self.cvtstodo)[:2]) - ,'_BasicReport.txt']) + ,'_MultisliceReport.txt']) kwargs['psprofiles']=self.psprofilestodo() log.info("kwargs['psprofiles']={}".format(kwargs['psprofiles'])) - xlpr=self.xlpstart(reporttype='Multislice '+''.join(self.cvtstodo), - **kwargs) + reporttype='Multislice '+'-'.join(self.cvtstodo) + xlpr=self.xlpstart(**kwargs) if not hasattr(xlpr,'node'): log.info(_("Not repeating report that looks already started.")) + if kwargs['usegui']: + self.waitdone() return si=xlp.Section(xlpr,"Introduction") p=xlp.Paragraph(si,instr) @@ -8231,7 +8240,8 @@ def iteratecvt(parent,**kwargs): xlpr.close(me=me) sys.stdout.close() sys.stdout=sys.__stdout__ #In case we want to not crash afterwards...:-) - self.waitdone() + if kwargs['usegui']: + self.waitdone() def coocurrencetables(self,xlpr): t=_("Summary Co-ocurrence Tables") s1s=xlp.Section(xlpr,t) From c9359d64b8ab6c308125bdba6e68cb92ccf7ad88 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:06:09 +0100 Subject: [PATCH 102/124] make this not die on button push --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 9873bf4d..a3890f97 100755 --- a/main.py +++ b/main.py @@ -9336,7 +9336,7 @@ def submitform(): self.status.last('joinUF',update=True) self.tonegroupsjoinrename() #call again, in case needed self.makeanalysis() - def redo(timestamps): + def redo(timestamps="By manual request"): self.wait(_("Redoing Tone Analysis")+'\n'+timestamps) self.analysis.do() self.waitdone() From 9bb963efe1417a2a3d3d2ea639652bc5da673299 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:06:22 +0100 Subject: [PATCH 103/124] doc --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index a3890f97..145f0f8d 100755 --- a/main.py +++ b/main.py @@ -7266,6 +7266,8 @@ def tonegroupreportcomprehensive(self,**kwargs): # {'ps':ps,'profile':p,'usegui':False} for p in d[ps]]) kwargs['xlpr'].close(me=me) def reportmulti(self,**kwargs): + """This backgrounds multiple reports at a time, not multiple sections + in one report""" # threading.Thread(target=self.tonegroupreport,kwargs=kwargs).start() start_time=nowruntime() log.info("reportmulti starting with fn {} and kwargs {} ".format( From 9eaa40eef685e7b406e4e53148e276eff58249d5 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:07:39 +0100 Subject: [PATCH 104/124] define this --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 145f0f8d..e1582ca7 100755 --- a/main.py +++ b/main.py @@ -7347,6 +7347,7 @@ def examplestoXLP(examples,parent,senseid): ps=kwargs.get('ps',self.slices.ps()) profile=kwargs.get('profile',self.slices.profile()) checks=self.status.checks(wsorted=True,**kwargs) + kwargs['minwords']=kwargs.get('minwords',0) if not checks: if 'profile' in kwargs: log.error("{} {} came up with no checks.".format(ps,profile)) From a7f076c8d35b8f6294ea390d9ac5a6367e363683 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 19:18:02 +0100 Subject: [PATCH 105/124] implement minimum words --- main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index e1582ca7..9ce95050 100755 --- a/main.py +++ b/main.py @@ -1104,6 +1104,7 @@ def settingsbyfile(self): 'giturls', 'hgurls', 'aztrepourls', + 'minimumwordstoreportUFgroup', 'writeeverynwrites' ]}, 'profiledata':{ @@ -7347,7 +7348,6 @@ def examplestoXLP(examples,parent,senseid): ps=kwargs.get('ps',self.slices.ps()) profile=kwargs.get('profile',self.slices.profile()) checks=self.status.checks(wsorted=True,**kwargs) - kwargs['minwords']=kwargs.get('minwords',0) if not checks: if 'profile' in kwargs: log.error("{} {} came up with no checks.".format(ps,profile)) @@ -7407,7 +7407,7 @@ def examplestoXLP(examples,parent,senseid): "".format(self.analysis.comparisonUFs, self.analysis.comparisonchecks)) grouplist=[i for i in self.analysis.orderedUFs - if len(self.analysis.senseidsbygroup[i]) > kwargs['minwords'] + if len(self.analysis.senseidsbygroup[i]) >= self.minwords ] checks=self.analysis.orderedchecks r = open(self.tonereportfile, "w", encoding='utf-8') @@ -8223,7 +8223,8 @@ def iteratecvt(parent,**kwargs): # torecord=analysis.senseidsbygroup ufgroupsnids=[(i,j) for i,j in self.analysis.senseidsbygroup.items() - if len(j)>2] #don't report groups of 1 or 2 words + #don't report small groups + if len(j) >= self.minwords] kwargs['sectlevel']=4 for kwargs['ufgroup'],kwargs['ufsenseids'] in ufgroupsnids: if 'ufgroup' in kwargs: @@ -8397,6 +8398,10 @@ def __init__(self): self.reporttoaudiorelURL=self.settings.reporttoaudiorelURL self.distinguish=self.settings.distinguish self.profilesbysense=self.settings.profilesbysense + if self.settings.minimumwordstoreportUFgroup: + self.minwords=self.settings.minimumwordstoreportUFgroup + else: #provide a default, return to settings file for modification + self.minwords=self.settings.minimumwordstoreportUFgroup=3 self.s=self.settings.s self.byUFgroup=False class Multislice(object): From 13ed9e5977877d339dfaf241bc3324504b4defb1 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 21:02:02 +0100 Subject: [PATCH 106/124] make table logic sensitive to various table dimentions --- main.py | 80 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/main.py b/main.py index 9ce95050..bcdd1af4 100755 --- a/main.py +++ b/main.py @@ -8260,6 +8260,20 @@ def coocurrencetables(self,xlpr): columncounts={} # Divide checks into those with multiple columns, and others xchecks=[i for i in checks if 'x' in i] + # eventually, this should have logic to see how wide each + # table is, and whether it makes sense to put it where. + # short tables should go next to short tables, but no more + # than two (or one) wide table in a row + if len(xchecks)>4: #only so many tables wide on a page + xchecksVx=[i for i in xchecks if i.startswith('V')] + xchecksCx=[i for i in xchecks if (not i.startswith('V') + and i.startswith('Cx'))] + xchecksCyx=[i for i in xchecks if (not i.startswith('V') + and not i.startswith('Cx'))] + else: + xchecksVx=xchecks + xchecksCx=[] + xchecksCyx=[] onecolchecks=[i for i in checks if 'x' not in i] # Put all single column tables into one dataset: for check in onecolchecks: @@ -8273,43 +8287,45 @@ def coocurrencetables(self,xlpr): except (KeyError,UnboundLocalError): columncounts={row:{check:counts[row]}} # Test the other checks, to see if any is wider than tall: - wide=False - for check in xchecks: - counts=self.checkcounts[ps][profile][ufg][check] - for r in [i for i in counts if counts[i]]: - if len([i for i in counts[r] if counts[r][i]] - )>len([i for i in counts if counts[i]]): - wide=True - if not wide: - #if all are not wide, join them into one row - caption=' '.join([ufg,ps,profile,check]) - table=xlp.Table(s3s,caption) - row=xlp.Row(table) + for xchecks in [i for i in + [xchecksVx,xchecksCx,xchecksCyx] if i]: + wide=False for check in xchecks: counts=self.checkcounts[ps][profile][ufg][check] - if (len(list(counts)) and - len([counts[k] for k in counts])): - cell=xlp.Cell(row) - caption=' '.join([ufg,ps,profile,check]) - tableb=xlp.Table(cell,caption,numbered=False) - log.debug("Counts by ({}-{}) check: {}".format( - ufg, - check, - counts)) - self.coocurrencetable(tableb,check,counts) - else: - #if they are wide, just leave them in their own tables: - for check in xchecks: - counts=self.checkcounts[ps][profile][ufg][check] - if (len(list(counts)) and - len([counts[k] for k in counts])): - log.debug("Counts by ({}-{}) check: {}".format( + for r in [i for i in counts if counts[i]]: + if len([i for i in counts[r] if counts[r][i]] + )>len([i for i in counts if counts[i]]): + wide=True + if not wide: + #if all are not wide, join them into one row + caption=' '.join([ufg,ps,profile,check]) + table=xlp.Table(s3s,caption) + row=xlp.Row(table) + for check in xchecks: + counts=self.checkcounts[ps][profile][ufg][check] + if (len(list(counts)) and + len([counts[k] for k in counts])): + cell=xlp.Cell(row) + caption=' '.join([ufg,ps,profile,check]) + tableb=xlp.Table(cell,caption,numbered=False) + log.debug("Counts by ({}-{}) check: {}".format( ufg, check, counts)) - caption=' '.join([ufg,ps,profile,check]) - table=xlp.Table(s3s,caption) - self.coocurrencetable(table,check,counts) + self.coocurrencetable(tableb,check,counts) + else: + #if they are wide, just leave them in their own tables: + for check in xchecks: + counts=self.checkcounts[ps][profile][ufg][check] + if (len(list(counts)) and + len([counts[k] for k in counts])): + log.debug("Counts by ({}-{}) check: {}".format( + ufg, + check, + counts)) + caption=' '.join([ufg,ps,profile,check]) + table=xlp.Table(s3s,caption) + self.coocurrencetable(table,check,counts) #Finally, do all single column tables in one table: if (columncounts and len(list(columncounts)) and len([columncounts[k] for k in columncounts])): From 715ec4d8bdf9f23e6be57bdf72a70167f0199c66 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Tue, 4 Oct 2022 21:02:24 +0100 Subject: [PATCH 107/124] cleanup --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index bcdd1af4..5338f0a3 100755 --- a/main.py +++ b/main.py @@ -8224,7 +8224,7 @@ def iteratecvt(parent,**kwargs): ufgroupsnids=[(i,j) for i,j in self.analysis.senseidsbygroup.items() #don't report small groups - if len(j) >= self.minwords] + if len(j) >= self.minwords] kwargs['sectlevel']=4 for kwargs['ufgroup'],kwargs['ufsenseids'] in ufgroupsnids: if 'ufgroup' in kwargs: From 770cb40c7cf6880e7902929b017c5cb72a639442 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 11:30:16 +0100 Subject: [PATCH 108/124] this has to run outside of basic report --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 5338f0a3..3ae2ca8e 100755 --- a/main.py +++ b/main.py @@ -7870,7 +7870,7 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): matches=set(self.senseidformsbyregex(self.regex,**kwargs)) if 'ufsenseids' in kwargs: matches=matches&set(kwargs['ufsenseids']) - if check in self.basicreported: + if hasattr(self,'basicreported') and check in self.basicreported: # log.info("Removing {} entries already found from {} entries found " # "by {} check".format(len(self.basicreported[check]), # len(matches), @@ -7953,7 +7953,7 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): titlebits+=kwargs['ufgroup'] id=rx.id(titlebits) ex=xlp.Example(parent,id,heading=checkprose) - if '=' in check: + if hasattr(self,'basicreported') and '=' in check: # log.info(self.basicreported.keys()) log.info("Adding to basicreported for keys {}".format(check.split('='))) for c in check.split('='): From bd9e03a27c789fb173d5b518d7f420246318ec45 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 14:13:59 +0100 Subject: [PATCH 109/124] for future reference --- rx.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rx.py b/rx.py index 800249a7..9cefe0ed 100644 --- a/rx.py +++ b/rx.py @@ -226,6 +226,8 @@ def nX(segmentsin,segmentsout,n): overlap=set(segmentsin) & set(segmentsout) if overlap: log.error("Your in/out segment lists overlap: {}".format(overlap)) + # log.error("in: {}".format(segmentsin)) + # log.error("out: {}".format(segmentsout)) # for each of in/out, make a dict keyed by length, with value listing glyphs # with that length (automatically separate trigraphs, digraphs, etc) sindict={n:[i for i in segmentsin if len(i) == n] From 1538ff93eb909c325faa3be71753b71850ff1d6c Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 14:14:26 +0100 Subject: [PATCH 110/124] this didn't get updated earlier --- main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 3ae2ca8e..9dc097c7 100755 --- a/main.py +++ b/main.py @@ -1988,7 +1988,10 @@ def slists(self): self.s[lang]={} """These should always be there, no matter what""" for sclass in [x for x in self.db.s[lang] - if 'dg' not in x and 'tg' not in x]: #Just populate each list now + if 'dg' not in x + and 'tg' not in x + and 'qg' not in x + ]: #Just populate each list now if sclass in self.polygraphs[lang]: pgthere=[k for k,v in self.polygraphs[lang][sclass].items() if v] log.debug("Polygraphs for {} in {}: {}".format(lang,sclass, From 81145d3e8981daba64039ff72a6013aa5a48e23c Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 14:14:39 +0100 Subject: [PATCH 111/124] iteration was misordered --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 9dc097c7..feea6fe1 100755 --- a/main.py +++ b/main.py @@ -7722,8 +7722,8 @@ def iterateUFgroups(parent,**kwargs): n=0 for ps in self.checkcounts: for profile in self.checkcounts[ps]: - for check in self.checkcounts[ps][profile]: - for ufg in self.checkcounts[ps][profile][ufg]: + for ufg in self.checkcounts[ps][profile]: + for check in self.checkcounts[ps][profile][ufg]: for group in self.checkcounts[ps][profile][ufg][check]: i=self.checkcounts[ps][profile][ufg][check][group] if isinstance(i,int): From 3b460ca9b64d67b24e2d941ac73a79bbf1c2ead8 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 14:14:59 +0100 Subject: [PATCH 112/124] for future reference --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index feea6fe1..a4300796 100755 --- a/main.py +++ b/main.py @@ -2037,6 +2037,7 @@ def compileCVrxforsclass(self,sclass): self.distinguish[k]))) for i in v ] + # log.info("Looking for sclass {} in {}".format(sclass,self.s[self.analang])) for n in range(1,7): #just get the Nth C or V, don't worry about polygraphs self.rx[sclass+str(n)]=rx.nX(sin,sout,n) #no polygraphs here def setupCVrxs(self): From 72ff9d6352222b74c33e7fecfc8409cb315b7080 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 15:48:51 +0100 Subject: [PATCH 113/124] look for labialisation everywhere --- lift.py | 80 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/lift.py b/lift.py index 42c9864b..9c878b8f 100644 --- a/lift.py +++ b/lift.py @@ -1105,43 +1105,47 @@ def clist(self): #This variable gives lists, to iterate over. c['pvd']={} c['pvd'][2]=['bh','dh','gh','gb', 'bb','dd','gg', #French - 'gw','dw', 'ɗw', #gnd + # 'gw','dw', 'ɗw', #gnd 'mb','nd','ŋg', 'Mb', 'Bw', #tsh ] c['pvd'][3]=[ - 'ndw', 'ŋgw' #gnd + # 'ndw', 'ŋgw' #gnd ] c['pvd'][1]=['b','B','d','g','ɡ'] #,'G' messes with profiles c['p']={} c['p'][2]=['kk','kp','cc','pp','pt','tt','ck', - 'kw','tw', + # 'kw','tw', 'Pk','Pw' #tsh ] #gnd c['p'][1]=['p','P','ɓ','Ɓ','t','ɗ','ɖ','c','k','q'] c['fvd']={} - c['fvd'][2]=['bh','vh','zh'] + c['fvd'][2]=['bh','vh','zh', + # 'zw' #gnd + ] c['fvd'][1]=['j','J','v','z','Z','ʒ','ð','ɣ'] #problems w x? c['f']={} c['f'][3]=['sch'] c['f'][2]=['ch','ph','sh','hh','pf','bv','ff','sc','ss','th', - 'hw' #gnd + # 'hw','sw' #gnd ] #Assuming x is voiceless, per IPA and most useage... c['f'][1]=['F','f','s','ʃ','θ','x','h'] #not 'S' c['avd']={} c['avd'][2]=['dj','dz','dʒ'] - c['avd'][3]=['ndz','dzw'] #gnd - c['avd'][4]=['ndzw'] #gnd + c['avd'][3]=['ndz', + # 'dzw' #gnd + ] + # c['avd'][4]=['ndzw'] #gnd c['a']={} c['a'][3]=['chk','tch'] c['a'][2]=['ts','tʃ'] c['lfvd']={} - c['lfvd'][3]=['zlw'] + # c['lfvd'][3]=['zlw'] c['lfvd'][2]=['zl'] c['lfvd'][1]=['ɮ'] c['lf']={} - c['lf'][3]=['slw'] + # c['lf'][3]=['slw'] c['lf'][2]=['sl'] c['lf'][1]=['ɬ'] c['pn']={} @@ -1149,41 +1153,41 @@ def clist(self): #This variable gives lists, to iterate over. c['pn'][2]=['ᵐb','ᵐp','ᵐv','ᵐf','ⁿd','ⁿt','ᵑg','ⁿg','ᵑg','ⁿk','ᵑk', 'ⁿj','ⁿs','ⁿz'] x={} #dict to put all hypothetical segements in, by category - for nglyphs in [4,3,2,1]: - if nglyphs == 4: - consvar='Cqg' - dconsvar='Dqg' - elif nglyphs == 3: - consvar='Ctg' - dconsvar='Dtg' - elif nglyphs == 2: - consvar='Cdg' - dconsvar='Ddg' - elif nglyphs == 1: + c['G']={1:['ẅ','y','Y','w','W']} + c['N']={1:['m','M','n','ŋ','ɲ','ɱ']} #'N', messed with profiles + c['N'][2]=['mm','ŋŋ','ny','gn','nn'] + c['N'][3]=["ng'"] + """Non-Nasal/Glide Sonorants""" + c['S']={1:['l','r']} + c['S'][2]=['rh','wh','ll','rr', + # 'rw','lw' #gnd + ] + for stype in c: + if stype in ['ʔ','G','N','S']: #'V'? + consvar=stype + elif 'vd' in stype: + consvar='D' + else: consvar='C' - dconsvar='D' - x[consvar]=list() #to store valid consonants in - x[dconsvar]=list() #to store valid depressor consonants in - for stype in c: - if c[stype].get(nglyphs) is not None: - if 'vd' in stype: - x[dconsvar]+=c[stype][nglyphs] - else: - x[consvar]+=c[stype][nglyphs] + for nglyphs in [i for i in range(5) if i in c[stype]]: + for glyph in [i for i in c[stype][nglyphs] + if not set(['w','ʷ'])&set(i) + ]: + try: + c[stype][nglyphs+1]+=[glyph+'w'] + except KeyError: + c[stype][nglyphs+1]=[glyph+'w'] + for nglyphs,varsfx in [(4,'qg'),(3,'tg'),(2,'dg'),(1,'')]: + if c[stype].get(nglyphs): + try: + x[consvar+varsfx]+=c[stype][nglyphs] + except KeyError: + x[consvar+varsfx]=c[stype][nglyphs] x['ʔ']=['ʔ', "ꞌ", #Latin Small Letter Saltillo "'", #Tag Apostrophe 'ʼ' #modifier letter apostrophe ] - x['G']=['ẅ','y','Y','w','W'] - x['N']=['m','M','n','ŋ','ɲ','ɱ'] #'N', messed with profiles - x['Ndg']=['mm','ŋŋ','ny','gn','nn'] - x['Ntg']=["ng'"] - """Non-Nasal/Glide Sonorants""" - x['S']=['l','r'] - x['Sdg']=['rh','wh','ll','rr', - 'rw','lw' #gnd - ] x['V']=[ #decomposed first: #tilde (decomposed): From 55117763fa0883621a38402014ecdc3349192776 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 15:53:35 +0100 Subject: [PATCH 114/124] new fn, which doesn't change much --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index a4300796..a06ec26c 100755 --- a/main.py +++ b/main.py @@ -4630,6 +4630,13 @@ def ifregexadd(self,regex,form,id): # This fn is just to make this threadable if regex.search(form): self.output+=id + def formspsprofile(self,**kwargs): + log.info("Asked for forms to search for a data slice (only do once!)") + ps=kwargs.get('ps',self.slices.ps()) + d=self.settings.formstosearch[ps] + # log.info("Looking at {} entries".format(len(d))) + return {k:d[k] for k in d + if set(d[k]) & set(self.slices.senseids(**kwargs))} def senseidformsbyregex(self,regex,**kwargs): """This function takes in a compiled regex, and outputs a list/dictionary of senseid/{senseid:form} form.""" From a61796ecd4a66e8ddeaa8a280455b59e1caecd02 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 15:54:59 +0100 Subject: [PATCH 115/124] use new fn --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index a06ec26c..10d84086 100755 --- a/main.py +++ b/main.py @@ -4643,7 +4643,9 @@ def senseidformsbyregex(self,regex,**kwargs): ps=kwargs.get('ps',self.slices.ps()) self.output=[] #This is just a list of senseids now: (Do we need the dict?) # self.outputs=[] #This is just a list of senseids now: (Do we need the dict?) - dicttosearch=self.settings.formstosearch[ps] + dicttosearch=kwargs.get('formstosearch') + if not dicttosearch: + dicttosearch=self.formspsprofile(**kwargs) # log.info("Looking for senses by regex {}".format(regex)) for form,id in [i for i in dicttosearch.items() if i[0]]: # log.info("Looking for form {}, with id {}".format(form,id)) From 0de82e70f3b68bdb4106693f2001b42a69d2ce0e Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 15:55:20 +0100 Subject: [PATCH 116/124] use --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 10d84086..9761285c 100755 --- a/main.py +++ b/main.py @@ -7681,6 +7681,7 @@ def iterateUFgroups(parent,**kwargs): c2 = "Any" """nn() here keeps None and {} from the output, takes one string, list, or tuple.""" + kwargs['formstosearch']=self.formspsprofile(**kwargs) text=(_("{} roots of form {} by {}".format(kwargs['ps'], kwargs['profile'], kwargs['check']))) From 83459ad68c2e96d28a07ba06ee95c3fc64ae5696 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 15:55:46 +0100 Subject: [PATCH 117/124] use --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 9761285c..60168fee 100755 --- a/main.py +++ b/main.py @@ -8227,6 +8227,7 @@ def iteratecvt(parent,**kwargs): log.info(t) print(t) for kwargs['profile'] in profiles: + kwargs['formstosearch']=self.formspsprofile(**kwargs) t=_("{} {}s".format(kwargs['profile'],kwargs['ps'])) s2=xlp.Section(s1,t,level=2) print(t) From 15a440170796ee200dff327d795267db366f53f2 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 15:56:13 +0100 Subject: [PATCH 118/124] more sensible logging --- main.py | 60 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/main.py b/main.py index 60168fee..a1f1b457 100755 --- a/main.py +++ b/main.py @@ -4641,11 +4641,13 @@ def senseidformsbyregex(self,regex,**kwargs): """This function takes in a compiled regex, and outputs a list/dictionary of senseid/{senseid:form} form.""" ps=kwargs.get('ps',self.slices.ps()) - self.output=[] #This is just a list of senseids now: (Do we need the dict?) - # self.outputs=[] #This is just a list of senseids now: (Do we need the dict?) + self.output=[] + # log.info("Kwargs keys: {} (formstosearch n={})".format(kwargs.keys(), + # len(kwargs['formstosearch']))) dicttosearch=kwargs.get('formstosearch') if not dicttosearch: dicttosearch=self.formspsprofile(**kwargs) + # log.info("Reduced to {} entries".format(len(dicttosearch))) # log.info("Looking for senses by regex {}".format(regex)) for form,id in [i for i in dicttosearch.items() if i[0]]: # log.info("Looking for form {}, with id {}".format(form,id)) @@ -4656,8 +4658,7 @@ def senseidformsbyregex(self,regex,**kwargs): t.join() except: log.info("Looks like no forms in senseidstocheck: {}".format( - senseidstocheck)) - # log.info("Found sensess: {}".format(self.outputs)) + dicttosearch)) # log.info("Found senses: {}".format(self.output)) return self.output def presortgroups(self,**kwargs): @@ -4674,6 +4675,8 @@ def presortgroups(self,**kwargs): groups=self.status.groups(cvt=cvt) #multiprocess from here? w=self.getrunwindow(msg=_("Presorting ({}={})").format(check,groups)) + # test this before implementing it: + # kwargs['formstosearch']=self.formsthisprofile(**kwargs) for group in groups: self.buildregex(group=group,cvt=cvt,profile=profile,check=check) # log.info("self.regex: {}; self.regexCV: {}".format(self.regex, @@ -7874,13 +7877,13 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): return """possibly iterating over all these parameters, used by buildregex""" self.buildregex(**kwargs) - log.info("{}; regexCV: {}" - # "; \nregex: {}" - "".format( - checkprose, - self.regexCV, - # self.regex - ) ) + # log.info("{}; regexCV: {}" + # # "; \nregex: {}" + # "".format( + # checkprose, + # self.regexCV, + # # self.regex + # ) ) matches=set(self.senseidformsbyregex(self.regex,**kwargs)) if 'ufsenseids' in kwargs: matches=matches&set(kwargs['ufsenseids']) @@ -7890,14 +7893,14 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): # len(matches), # check)) # log.info("Entries found ({}):".format(len(matches))) - for m in list(matches)[:4]: - log.info(self.taskchooser.datadict.getframeddata(m).framed) - # log.info("Entries removed ({}):".format(len(self.basicreported[check]&matches))) - for m in list(self.basicreported[check]&matches)[:4]: - log.info(self.taskchooser.datadict.getframeddata(m).framed) - # log.info("Entries remaining ({}):".format(len(matches-self.basicreported[check]))) - for m in list(matches-self.basicreported[check])[:4]: - log.info(self.taskchooser.datadict.getframeddata(m).framed) + # for m in list(matches)[:4]: + # log.info(self.taskchooser.datadict.getframeddata(m).framed) + # # log.info("Entries removed ({}):".format(len(self.basicreported[check]&matches))) + # for m in list(self.basicreported[check]&matches)[:4]: + # log.info(self.taskchooser.datadict.getframeddata(m).framed) + # # log.info("Entries remaining ({}):".format(len(matches-self.basicreported[check]))) + # for m in list(matches-self.basicreported[check])[:4]: + # log.info(self.taskchooser.datadict.getframeddata(m).framed) matches-=self.basicreported[check] # log.info("{} entries remaining.".format(len(matches))) ufg=kwargs['ufgroup'] @@ -7969,18 +7972,21 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): ex=xlp.Example(parent,id,heading=checkprose) if hasattr(self,'basicreported') and '=' in check: # log.info(self.basicreported.keys()) - log.info("Adding to basicreported for keys {}".format(check.split('='))) + # log.info("Adding to basicreported for keys {}" + # "".format(check.split('='))) for c in check.split('='): - log.info("adding {} matches".format(len(matches))) + # log.info("adding {} matches".format(len(matches))) try: - log.info("to {} matches for {}".format( - len(self.basicreported[c]),c)) + # log.info("to {} matches for {}".format( + # len(self.basicreported[c]),c)) self.basicreported[c]|=matches - log.info("Last entries: {}".format(list(self.basicreported[c])[-5:])) + # log.info("Last entries: {}".format( + # list(self.basicreported[c])[-5:])) except KeyError: - log.info("to a new key for {}".format(c)) + # log.info("to a new key for {}".format(c)) self.basicreported[c]=matches - log.info("First entries: {}".format(list(self.basicreported[c])[:5])) + # log.info("First entries: {}".format( + # list(self.basicreported[c])[:5])) for senseid in matches: framed=self.taskchooser.datadict.getframeddata(senseid) self.framedtoXLP(framed,parent=ex,ftype=ftype,listword=True) #showgroups? @@ -11451,7 +11457,7 @@ def validate(self): def inslice(self,senseids): senseidstochange=set(self._senseids).intersection(senseids) return senseidstochange - def senseids(self,ps=None,profile=None): + def senseids(self,ps=None,profile=None,**kwargs): #don't die on other kwargs """This returns an up to date list of senseids in the curent slice (because changing ps or profile calls renewsenseids), or else the specified slice""" From 2d8e55a1d93e295e2dbed1efdc98ce151f996ba6 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 16:57:28 +0100 Subject: [PATCH 119/124] just log/list names --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index a1f1b457..491493c7 100755 --- a/main.py +++ b/main.py @@ -4058,7 +4058,8 @@ def makedefaulttask(self): optionlist=self.makeoptions() # task,title,icon optionlist=[i for i in optionlist if not issubclass(i[0],Sound)] - log.info("getting default from option list {}".format(optionlist)) + # log.info("getting default from option list {}".format( + # [i[1] for i in optionlist])) if program['testing'] and hasattr(self,'testdefault'): self.maketask(self.testdefault) else: @@ -4179,7 +4180,8 @@ def makeoptions(self): tasktuples.append((task,str(task),task.taskicon(task))) else: tasktuples.append((task,str(task),None)) - log.info("Tasks available ({}): {}".format(len(tasktuples),tasktuples)) + log.info("Tasks available ({}): {}".format(len(tasktuples), + [i[1] for i in tasktuples])) return tasktuples # [(Check,"Citation Form Sorting in Tone Frames"), # (WordCollection,"Placeholder for future checks"), From df5ff318715549d10494c6b25ce99a2e6aaa3603 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 16:57:53 +0100 Subject: [PATCH 120/124] do log this much --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index 491493c7..b220eae4 100755 --- a/main.py +++ b/main.py @@ -7877,6 +7877,7 @@ def wordsbypsprofilechecksubcheckp(self,parent,**kwargs): skipthisone=True if skipthisone: return + log.info(checkprose) """possibly iterating over all these parameters, used by buildregex""" self.buildregex(**kwargs) # log.info("{}; regexCV: {}" From d8d8c940914a1b74725e8bb129b773b7270d6f87 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 16:58:18 +0100 Subject: [PATCH 121/124] reduce logging --- main.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index b220eae4..d6387b75 100755 --- a/main.py +++ b/main.py @@ -8028,8 +8028,8 @@ def wordsbypsprofilechecksubcheck(self,parent='NoXLPparent',**kwargs): if isinstance(self,Multicheck): checksunordered=self.status.checks(**kwargs) checks=self.orderchecks(checksunordered) - log.info("Going to do these checks: {}".format(checksunordered)) - log.info("Going to do this order checks: {}".format(checks)) + # log.info("Going to do these checks: {}".format(checksunordered)) + log.info("Going to do checks in this order: {}".format(checks)) else: checks=[kwargs.get('check',self.params.check())] """check set here""" @@ -8047,7 +8047,7 @@ def docheckreport(self,parent,**kwargs): kwargs['ps']=kwargs.get('ps',self.slices.ps()) kwargs['profile']=kwargs.get('profile',self.slices.profile()) kwargs['check']=kwargs.get('check',self.params.check()) - log.info("docheckreport starting with kwargs {}".format(kwargs)) + # log.info("docheckreport starting with kwargs {}".format(kwargs)) groups=self.status.groups(**kwargs) group=self.status.group() self.ncvts=rx.split('[=x]',kwargs['check']) @@ -8173,7 +8173,7 @@ def iteratecvt(parent,**kwargs): for kwargs['cvt'] in self.cvtstodo: t=_("{} checks".format(self.params.cvtdict()[ kwargs['cvt']]['sg'])) - print(t) + # print(t) log.info(t) sid=" ".join([t,"for",kwargs['ufgroup'],kwargs['profile'], kwargs['ps']+'s']) @@ -8730,6 +8730,8 @@ def taskicon(self): return program['theme'].photo['iconV'] def tasktitle(self): return _("Sort Vowels") #Citation Form Sorting in Tone Frames + def tooltip(self): + return _("This task helps you sort words in citation form by vowels.") def dobuttonkwargs(self): return {'text':_("Sort!"), 'fn':self.runcheck, @@ -8752,6 +8754,8 @@ def taskicon(self): return program['theme'].photo['iconC'] def tasktitle(self): return _("Sort Consonants") #Citation Form Sorting in Tone Frames + def tooltip(self): + return _("This task helps you sort words in citation form by consonants.") def dobuttonkwargs(self): return {'text':_("Sort!"), 'fn':self.runcheck, @@ -10176,11 +10180,12 @@ def getframeddata(self, source=None, senseid=None, check=None, **kwargs): if element: # log.info("getting framed data from element") d=self[source]=FramedDataElement(self,source,senseid,**kwargs) - log.info("FramedData from {} made with forms {}".format(source, - d.forms)) + # log.info("FramedData from {} made with forms {}".format(source, + # d.forms)) elif d: - log.info("FramedData used from ealier ({},with forms {})".format( - source,d.forms)) + pass + # log.info("FramedData used from ealier ({},with forms {})".format( + # source,d.forms)) else: log.error("FramedData confused: ({}, with d={})".format( source,d)) From 67108de9ea24f4c2a82558652b1b190fd91c149f Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 16:58:36 +0100 Subject: [PATCH 122/124] This doesn't seem to change much... --- main.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/main.py b/main.py index d6387b75..d1aed232 100755 --- a/main.py +++ b/main.py @@ -4651,16 +4651,21 @@ def senseidformsbyregex(self,regex,**kwargs): dicttosearch=self.formspsprofile(**kwargs) # log.info("Reduced to {} entries".format(len(dicttosearch))) # log.info("Looking for senses by regex {}".format(regex)) - for form,id in [i for i in dicttosearch.items() if i[0]]: - # log.info("Looking for form {}, with id {}".format(form,id)) - t = threading.Thread(target=self.ifregexadd, - args=(regex,form,id)) - t.start() - try: - t.join() - except: - log.info("Looks like no forms in senseidstocheck: {}".format( - dicttosearch)) + self.output=[ + j for k,v in dicttosearch.items() + if k and regex.search(k) + for j in v + ] + # for form,id in [i for i in dicttosearch.items() if i[0]]: + # # log.info("Looking for form {}, with id {}".format(form,id)) + # t = threading.Thread(target=self.ifregexadd, + # args=(regex,form,id)) + # t.start() + # try: + # t.join() + # except: + # log.info("Looks like no forms in senseidstocheck: {}".format( + # dicttosearch)) # log.info("Found senses: {}".format(self.output)) return self.output def presortgroups(self,**kwargs): From b04db55acc6f650c85b30f7cf5ca0082936f427c Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 20:27:21 +0100 Subject: [PATCH 123/124] bump --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index d1aed232..52b0fc47 100755 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ program['testing']=False program['demo']=True #sets me=False, production=True, testing=False program['demo']=False -program['version']='0.9.6' #This is a string... +program['version']='0.9.7' #This is a string... program['testversionname']='testing' #always have some real test branch here program['url']='https://github.com/kent-rasmussen/azt' program['Email']='kent_rasmussen@sil.org' From 83904eb5dd8b2f67435477f73dfaeee51e4d0107 Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Thu, 6 Oct 2022 20:31:38 +0100 Subject: [PATCH 124/124] update --- docs/CHANGELOG.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2744ba2e..f6918b12 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,9 +1,13 @@ # A→Z+T Changelog +# Version 0.9.7 +- Substantial reworking of reports, which all now run in the background, and with improved initial placement of tables. +- Git integration works, both for updating A→Z+T and for language data. If your data is in a git repository, A→Z+T can make automatic commits for you, as well as pull and push from/to a respository on flash drive for sharing. + # Version 0.9.4 -- Zulgo workshop tweaks --lots of issues surrounding weird interface on their computer. For instance, the square consonant pushes everything off their screen, becausae of large space in buttons... -- A number of additions to make the update process smoother (now you can restart or retry, as appropriate, from the notification window) +## Zulgo workshop tweaks +- lots of issues surrounding weird interface on their computer. For instance, the square consonant pushes everything off their screen, becausae of large space in buttons... +- A number of additions to make the update process smoother (now you can restart or retry, as appropriate, from the notification window) - Multiple attempts to fix auto-reboot on Windows —sorry, nothing working yet. # Version 0.9.3