Skip to content

Commit

Permalink
the new xbgf overview
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@394 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Oct 30, 2008
1 parent a6f2dc7 commit 6470619
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions topics/presentation/metrics/xbgf_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import elementtree.ElementTree as ET

safexbgf = ('deyaccify', 'yaccify','chain', 'unchain', 'extract', 'fold', 'inline', 'unfold', 'distribute', 'factor', 'massage', 'designate', 'strip','eliminate','introduce')
rkeys = ('LOC','NOI','NOX','NI~','NI+','NI!','SGO','COR','NI^')
incdecxbgf = ('add','narrow','remove','unite','widen')
rkeys = ('LOC','NOI','NOX','NI~','NI+','NI!','SGO','COR','NI^','SID','SRE')

names = []
targets = {}
Expand All @@ -18,11 +19,11 @@
ET._namespace_map[xbgfns]='xbgf'
ET._namespace_map[xsdns] = 'xsd'

def noni(filename):
def noni(filename,arrayxbgf):
global xbgfns
cx = 0
xbgf = ET.parse(filename)
for c in safexbgf:
for c in arrayxbgf:
cx += len(xbgf.findall('//{'+xbgfns+'}'+c))
return cx

Expand Down Expand Up @@ -91,7 +92,9 @@ def report(keys,key,note):
results['NI!'][x] += nosi(path+y+'.xbgf','CORRECT')
results['NI^'][x] += nosi(path+y+'.xbgf','PERMISSIVENESS')
results['COR'][x] += nosi(path+y+'.xbgf','EXTRACTERROR')
results['SGO'][x] += noni(path+y+'.xbgf')+nosi(path+y+'.xbgf','BREFACTOR')
results['SGO'][x] += noni(path+y+'.xbgf',safexbgf)+nosi(path+y+'.xbgf','BREFACTOR')
results['SID'][x] += noni(path+y+'.xbgf',incdecxbgf)+nosi(path+y+'.xbgf','GENERALITY')
results['SRE'][x] += nosi(path+y+'.xbgf','REVISE')
#for z in rkeys:
# print 'DEBUG',z,x,y,':',results[z][x]
xbgf = ET.parse(path+y+'.xbgf')
Expand All @@ -116,6 +119,8 @@ def report(keys,key,note):
report(sorted,'LOC','\\numberOfLines')
report(sorted,'NOX','\\numberOfTransformations')
report(sorted,'SGO','\\numberOfRefactors')
report(sorted,'SID','\\numberOfGeneralises')
report(sorted,'SRE','\\numberOfRevisings')
print '\\numberOfSteps',
cx = 0
for x in sorted:
Expand Down

0 comments on commit 6470619

Please sign in to comment.