Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new generator reroot2top and introducing it to FL case study
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@653 ab42f6e0-554d-0410-b580-99e487e6eeb2
- Loading branch information
1 parent
d832775
commit fd61402
Showing
12 changed files
with
87 additions
and
27 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
|
||
# Get our hands on basedir | ||
LOCAL1=${PWD} | ||
cd `dirname $0` | ||
cd ../.. | ||
SLPS=${PWD} | ||
cd ${LOCAL1} | ||
|
||
if [ $# -ne 2 ]; then | ||
echo "Usage: reroot2top <BGF-input> <XBGF-input>" | ||
exit 1 | ||
elif [ ! -r $1 ]; then | ||
echo "Oops: $1 not found or not readable." | ||
exit 1 | ||
else | ||
rm -f $2 | ||
xpath $1 `cat ${SLPS}/topics/presentation/metrics/listtops.xpath` 1> $2.tmp 2> /dev/null | ||
python ${SLPS}/shared/python/reroot2nts.py $2.tmp $2 | ||
rm -f $2.tmp | ||
fi |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/python | ||
import os | ||
import sys | ||
import string | ||
import elementtree.ElementTree as ET | ||
import slpsns | ||
|
||
def main(bgffile,xbgffile): | ||
seq = ET.Element(slpsns.xbgf_('sequence')) | ||
rr = ET.SubElement(seq,slpsns.xbgf_('reroot')) | ||
for r in ET.XML('<list>'+''.join(open(bgffile,'r').readlines()).strip()+'</list>').findall('*'): | ||
x = ET.SubElement(rr,'root') | ||
x.text = r.text | ||
ET.ElementTree(seq).write(xbgffile) | ||
return | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) == 3: | ||
slpsns.init(ET) | ||
apply(main,sys.argv[1:3]) | ||
else: | ||
print '''Reroot2Nonterminals generator | ||
Usage:''' | ||
print ' ',sys.argv[0],'<input file>','<output file>' | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,7 +132,4 @@ | |
</bgf:production> | ||
</xbgf:deanonymize> | ||
|
||
<xbgf:reroot> | ||
<root>Program</root> | ||
</xbgf:reroot> | ||
</xbgf:sequence> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,4 @@ | |
<to>Program</to> | ||
</nonterminal> | ||
</xbgf:rename> | ||
<xbgf:reroot> | ||
<root>Program</root> | ||
</xbgf:reroot> | ||
</xbgf:sequence> |
This file was deleted.
Oops, something went wrong.