Skip to content

Commit

Permalink
bugfixes and preparatory refactorings
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@935 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Feb 3, 2011
1 parent 912cf56 commit 45f88b7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion shared/python/BGF.py
Expand Up @@ -12,7 +12,7 @@ def __init__(self):
def parse(self,fname):
self.roots = []
self.prods = []
self.xml = ET.parse(sys.argv[1])
self.xml = ET.parse(fname)
for e in self.xml.findall('root'):
self.roots.append(e.text)
for e in self.xml.findall(slpsns.bgf_('production')):
Expand Down
4 changes: 2 additions & 2 deletions shared/python/diffShort.py
Expand Up @@ -2,11 +2,11 @@
import os
import sys
import string
import metrics
import mismatches

if __name__ == "__main__":
if len(sys.argv) == 4:
pnm,psm = metrics.mismatches(sys.argv[3],sys.argv[1],sys.argv[2])
pnm,psm = mismatches.mismatches(sys.argv[3],sys.argv[1],sys.argv[2])
print 'Mismatches:',pnm,'+',psm,'=',pnm+psm
else:
print '''This is the shortest possible version of Grammar Diff Tool.
Expand Down
4 changes: 2 additions & 2 deletions shared/python/lcf2csv.py
Expand Up @@ -4,7 +4,7 @@
import string
import elementtree.ElementTree as ET
import slpsns
import metrics
import mismatches

synch = {}

Expand Down Expand Up @@ -70,7 +70,7 @@ def measure(gdt,x,y):
z=synch[y][0]
else:
z=synch[y][1]
nm,sm = metrics.mismatches(gdt,'bgf/'+x+'.bgf','bgf/'+z+'.bgf')
nm,sm = mismatches.mismatches(gdt,'bgf/'+x+'.bgf','bgf/'+z+'.bgf')
return nm+sm,str(nm)+'\t'+str(sm)+'\t'+str(nm+sm)

def cutName(lbl):
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions shared/python/runSliced.py
Expand Up @@ -5,7 +5,7 @@
import elementtree.ElementTree as ET
import slpsns
import slicing
import metrics
import mismatches

def main(xbgfFile,bgfFile,xbgf,gdt,synch):
xbgfDir = '/'.join(xbgfFile.split('/')[:-1])
Expand All @@ -16,7 +16,7 @@ def main(xbgfFile,bgfFile,xbgf,gdt,synch):
print 'Slicing...'
sliced = slicing.sliceFile(xbgfDir,xbgfDir,xbgfFile.split('/')[-1].replace('.xbgf',''))
print 'Runnning...'
pnm,psm = metrics.mismatches(gdt,bgfFile,synch)
pnm,psm = mismatches.mismatches(gdt,bgfFile,synch)
print 'Mismatches originally:',pnm,'+',psm,'...',len(sliced),'steps to go'
cx = ''
for p in sliced:
Expand All @@ -25,7 +25,7 @@ def main(xbgfFile,bgfFile,xbgf,gdt,synch):
print 'Error running',p,'!'
print run
sys.exit(2)
nm,sm = metrics.mismatches(gdt,bgfFile+cx+'_',synch)
nm,sm = mismatches.mismatches(gdt,bgfFile+cx+'_',synch)
print 'Mismatches:',nm,'+',sm
if nm>pnm:
print 'Observed increase in name mismatches!'
Expand Down
1 change: 0 additions & 1 deletion shared/python/xbgfSlice.py
Expand Up @@ -5,7 +5,6 @@
import elementtree.ElementTree as ET
import slpsns
import slicing
import metrics

def main(xbgfFile):
xbgfDir = '/'.join(xbgfFile.split('/')[:-1])
Expand Down

0 comments on commit 45f88b7

Please sign in to comment.