All Samples(3393) | Call(3248) | Derive(0) | Import(145)
popen(command [, mode='r' [, bufsize]]) -> pipe Open a pipe to/from a command returning a file object.
src/p/r/practice_python-HEAD/bookexample/src/bvista/b15_1_rewho.py practice_python(Download)
'''
from os import popen
from re import split
f = popen('dir','r')
src/g/a/galateia-HEAD/WebScraper/oldcode/originalcode.py galateia(Download)
from random import * import string import re from myscraper import MyScraper import process from os import popen from os import path
def activeSample(testfiles, model, testdata):
popen("rm FEATURES.txt")
filelist = string.join(testfiles, " ")
for file in testfiles:
text = popen("cat " + file).read()
features = extractFeatures(text, "test") + "\n\n\n"
popen('echo "' + features + '" >> FEATURES.txt')
def evaluate(testfiles, model, testdata):
popen("rm FEATURES.txt")
filelist = string.join(testfiles, " ")
taglist = ['content','headline','date']
for file in testfiles:
text = popen("cat " + file).read()
features = extractFeatures(text, "test") + "\n\n\n"
popen('echo "' + features + '" >> FEATURES.txt')
file.close()
popen(buildmodel % ("models/Random/model0", "models/Random/traindata.txt"))
accuracies = []
file.close()
# rebuild the model with the new, larger set
popen(buildmodel % ("models/Random/model"+str(iteration+1), "models/Random/traindata.txt"))
set.append(filename)
file.close()
popen(buildmodel % ("models/Random/model0", "models/Random/traindata.txt"))
accuracies = []
file.close()
# rebuild the model with the new, larger set
popen(buildmodel % ("models/Random/model"+str(iteration+1), "models/Random/traindata.txt"))
set.append(filename)
# the list to hold the accuracies as the model gets bigger
accuracies = []
popen(buildmodel % ("models/ActiveLearning/model0", "models/ActiveLearning/traindata.txt"))
output = comparetags(ufiles, "models/ActiveLearning/model0", testdata)
file.close()
# rebuild the model
popen(buildmodel % ("models/ActiveLearning/model"+str(iteration+1), "models/ActiveLearning/traindata.txt"))
# remove the newly added training file from the development as it is added to the training set.
tfiles.remove(filepath)
randomFscores = [0]*size
ALfscores = [0]*size
for i in range(repeat):
popen("rm FEATURES.txt")
popen("echo '" + str(i) + "\n' >> iteration.txt")
trainingfile.close()
popen(buildmodel % ("models/ActiveLearning/model0", "models/ActiveLearning/traindata.txt"))
accuraciesAL = []
accuraciesRandom = []
trainingfile.write(trainingtext)
trainingfile.close()
popen(buildmodel % ("models/ActiveLearning/model"+str(iteration+1), "models/ActiveLearning/traindata.txt"))
output = evaluate(testfiles, "models/ActiveLearning/model"+str(iteration+1), "TESTEST")
trainingfile.close()
popen(buildmodel % ("models/Random/model0", "models/Random/traindata.txt"))
accuracies = []
trainingfile.write(origtraintext)
trainingfile.close()
popen(buildmodel % ("models/Random/model"+str(iteration+1), "models/Random/traindata.txt"))
output = evaluate(testfiles, "models/Random/model"+str(iteration+1), "TESTEST")
def build(folder, modelname):
popen("rm ../data/HUGEGERMAN.txt ../data/GERMANFEATURES.txt")
files = map(string.strip, popen("find "+ folder + "*-t").readlines())
print files
#sublists = splitlist(files,1000)
for file in files:
#print "moo"
#filestring = string.join(l, " ")
popen("cat " + file + ">> ../data/HUGEGERMAN.txt")
popen('echo "' + "\nNEW PAGE\n" + '" >> ../data/HUGEGERMAN.txt')
for page in pages:
page = page.strip()
features = extractFeatures(page, "train")
popen('echo "' + features + "\n\n\n" + '" >> ../data/GERMANFEATURES.txt')
popen(buildmodel % (modelname, "../data/GERMANFEATURES.txt"))
def tagFileList(files, model, testdata):
popen("rm ../data/HUGE.txt ../data/FEATURES.txt")
for l in sublists:
filestring = string.join(l, " ")
popen("cat " + filestring + ">> ../data/HUGE.txt")
#for path in files:
for page in pages:
page = page.strip()
features = extractFeatures(page, "train")
popen('echo "' + features + "\n\n\n" + '" >> ../data/FEATURES.txt')
#output += features + "\n\nNEW\n\n"
testfiles = map(string.strip, output.split("NEW"))
def tagConcatFiles(folder, model, testdata):
popen("rm ../data/HUGE.txt ../data/FEATURES.txt")
files = map(string.strip,popen("find " + folder + " -name '*.html'").readlines())
orig = copy.copy(files)
for l in sublists:
filestring = string.join(l, " ")
popen("cat " + filestring + ">> ../data/HUGE.txt")
#for path in files:
for page in pages:
page = page.strip()
features = extractFeatures(page, "train")
popen('echo "' + features + "\n\n\n" + '" >> ../data/FEATURES.txt')
#output += features + "\n\nNEW\n\n"
testfiles = map(string.strip, output.split("NEW"))
src/g/a/galateia-HEAD/WebScraper/oldcode/features2.py galateia(Download)
from random import * import string import re from myscraper import MyScraper import process from os import popen from os import path
def activeSample(testfiles, model, testdata):
popen("rm FEATURES.txt")
filelist = string.join(testfiles, " ")
for file in testfiles:
text = popen("cat " + file).read()
features = extractFeatures(text, "test") + "\n\n\n"
popen('echo "' + features + '" >> FEATURES.txt')
def evaluate(testfiles, model, testdata):
popen("rm FEATURES.txt")
filelist = string.join(testfiles, " ")
taglist = ['content','headline','date']
for file in testfiles:
text = popen("cat " + file).read()
features = extractFeatures(text, "test") + "\n\n\n"
popen('echo "' + features + '" >> FEATURES.txt')
file.close()
popen(buildmodel % ("models/Random/model0", "models/Random/traindata.txt"))
accuracies = []
file.close()
# rebuild the model with the new, larger set
popen(buildmodel % ("models/Random/model"+str(iteration+1), "models/Random/traindata.txt"))
set.append(filename)
file.close()
popen(buildmodel % ("models/Random/model0", "models/Random/traindata.txt"))
accuracies = []
file.close()
# rebuild the model with the new, larger set
popen(buildmodel % ("models/Random/model"+str(iteration+1), "models/Random/traindata.txt"))
set.append(filename)
# the list to hold the accuracies as the model gets bigger
accuracies = []
popen(buildmodel % ("models/ActiveLearning/model0", "models/ActiveLearning/traindata.txt"))
output = comparetags(ufiles, "models/ActiveLearning/model0", testdata)
file.close()
# rebuild the model
popen(buildmodel % ("models/ActiveLearning/model"+str(iteration+1), "models/ActiveLearning/traindata.txt"))
# remove the newly added training file from the development as it is added to the training set.
tfiles.remove(filepath)
randomFscores = [0]*size
ALfscores = [0]*size
for i in range(repeat):
popen("rm FEATURES.txt")
popen("echo '" + str(i) + "\n' >> iteration.txt")
trainingfile.close()
popen(buildmodel % ("models/ActiveLearning/model0", "models/ActiveLearning/traindata.txt"))
accuraciesAL = []
accuraciesRandom = []
trainingfile.write(trainingtext)
trainingfile.close()
popen(buildmodel % ("models/ActiveLearning/model"+str(iteration+1), "models/ActiveLearning/traindata.txt"))
output = evaluate(testfiles, "models/ActiveLearning/model"+str(iteration+1), "TESTEST")
trainingfile.close()
popen(buildmodel % ("models/Random/model0", "models/Random/traindata.txt"))
accuracies = []
trainingfile.write(origtraintext)
trainingfile.close()
popen(buildmodel % ("models/Random/model"+str(iteration+1), "models/Random/traindata.txt"))
output = evaluate(testfiles, "models/Random/model"+str(iteration+1), "TESTEST")
def build(folder, modelname):
popen("rm ../data/HUGEGERMAN.txt ../data/GERMANFEATURES.txt")
files = map(string.strip, popen("find "+ folder + "*-t").readlines())
print files
#sublists = splitlist(files,1000)
for file in files:
#print "moo"
#filestring = string.join(l, " ")
popen("cat " + file + ">> ../data/HUGEGERMAN.txt")
popen('echo "' + "\nNEW PAGE\n" + '" >> ../data/HUGEGERMAN.txt')
for page in pages:
page = page.strip()
features = extractFeatures(page, "train")
popen('echo "' + features + "\n\n\n" + '" >> ../data/GERMANFEATURES.txt')
popen(buildmodel % (modelname, "../data/GERMANFEATURES.txt"))
def tagFileList(files, model, testdata):
popen("rm ../data/HUGE.txt ../data/FEATURES.txt")
for l in sublists:
filestring = string.join(l, " ")
popen("cat " + filestring + ">> ../data/HUGE.txt")
#for path in files:
for page in pages:
page = page.strip()
features = extractFeatures(page, "train")
popen('echo "' + features + "\n\n\n" + '" >> ../data/FEATURES.txt')
#output += features + "\n\nNEW\n\n"
testfiles = map(string.strip, output.split("NEW"))
def tagConcatFiles(folder, model, testdata):
popen("rm ../data/HUGE.txt ../data/FEATURES.txt")
files = map(string.strip,popen("find " + folder + " -name '*.html'").readlines())
orig = copy.copy(files)
for l in sublists:
filestring = string.join(l, " ")
popen("cat " + filestring + ">> ../data/HUGE.txt")
#for path in files:
for page in pages:
page = page.strip()
features = extractFeatures(page, "train")
popen('echo "' + features + "\n\n\n" + '" >> ../data/FEATURES.txt')
#output += features + "\n\nNEW\n\n"
testfiles = map(string.strip, output.split("NEW"))
src/s/a/sage-HEAD/trunk/local/lib/python2.4/site-packages/Gnuplot/gp_unix.py sage(Download)
# ############ End of configuration options ############################ from os import popen def test_persist():
if GnuplotOpts.recognizes_persist is None:
import string
g = popen('echo | %s -persist 2>&1' % GnuplotOpts.gnuplot_command, 'r')
response = g.readlines()
g.close()
GnuplotOpts.recognizes_persist = (
if not test_persist():
raise ('-persist does not seem to be supported '
'by your version of gnuplot!')
self.gnuplot = popen('%s -persist' % GnuplotOpts.gnuplot_command,
'w')
else:
self.gnuplot = popen(GnuplotOpts.gnuplot_command, 'w')
src/s/a/sage-HEAD/trunk/local/lib/python2.4/site-packages/Gnuplot/gp_macosx.py sage(Download)
# ############ End of configuration options ############################ from os import popen def test_persist():
if GnuplotOpts.recognizes_persist is None:
import string
g = popen('echo | %s -persist 2>&1' % GnuplotOpts.gnuplot_command, 'r')
response = g.readlines()
g.close()
GnuplotOpts.recognizes_persist = (
if not test_persist():
raise ('-persist does not seem to be supported '
'by your version of gnuplot!')
self.gnuplot = popen('%s -persist' % GnuplotOpts.gnuplot_command,
'w')
else:
self.gnuplot = popen(GnuplotOpts.gnuplot_command, 'w')
src/s/a/sage-HEAD/local/lib/python2.4/site-packages/Gnuplot/gp_unix.py sage(Download)
# ############ End of configuration options ############################ from os import popen def test_persist():
if GnuplotOpts.recognizes_persist is None:
import string
g = popen('echo | %s -persist 2>&1' % GnuplotOpts.gnuplot_command, 'r')
response = g.readlines()
g.close()
GnuplotOpts.recognizes_persist = (
if not test_persist():
raise ('-persist does not seem to be supported '
'by your version of gnuplot!')
self.gnuplot = popen('%s -persist' % GnuplotOpts.gnuplot_command,
'w')
else:
self.gnuplot = popen(GnuplotOpts.gnuplot_command, 'w')
src/s/a/sage-HEAD/local/lib/python2.4/site-packages/Gnuplot/gp_macosx.py sage(Download)
# ############ End of configuration options ############################ from os import popen def test_persist():
if GnuplotOpts.recognizes_persist is None:
import string
g = popen('echo | %s -persist 2>&1' % GnuplotOpts.gnuplot_command, 'r')
response = g.readlines()
g.close()
GnuplotOpts.recognizes_persist = (
if not test_persist():
raise ('-persist does not seem to be supported '
'by your version of gnuplot!')
self.gnuplot = popen('%s -persist' % GnuplotOpts.gnuplot_command,
'w')
else:
self.gnuplot = popen(GnuplotOpts.gnuplot_command, 'w')
src/g/a/galateia-HEAD/WebScraper/extract.py galateia(Download)
import os import string from os import popen from os import path from os import makedirs from os import environ
def fileTest(folder):
popen("rm ../HUGE.txt")
files = map(string.strip,popen("find "+folder+" -name '*.html'").readlines())
print "Number of files : " + str(len(files))
cmd = "%s -cp MozillaHtmlParser/lib/dom4j-1.6.1.jar:MozillaHtmlParser/lib/commons-httpclient-3.1-rc1.jar:MozillaHtmlParser/lib/junit-4.1.jar:MozillaHtmlParser/lib/tagsoup-1.0.1.jar:MozillaHtmlParser: ParseExample ondisk files" % javaloc
#cmd = "%s -cp MozillaHtmlParser/lib/dom4j-1.6.1.jar;MozillaHtmlParser/lib/commons-httpclient-3.1-rc1.jar;MozillaHtmlParser/lib/junit-4.1.jar;MozillaHtmlParser/lib/tagsoup-1.0.1.jar;MozillaHtmlParser; ParseExample ondisk files" % javaloc
docs = []
current = []
popen("rm ./features.txt")
featurefile = open("./features.txt","a")
count = 0
bar = ProgressBar(len(files))
def tagFiles(pages, model, testdata):
popen("rm %s" % featurelocation )
print "Extracting features..."
count = 0
trainingfile.write(trainingtext) trainingfile.close() popen(buildmodel % (javaloc, model, "./trainingdata.txt")) def buildModel(folder,model):
trainingfile.write(trainingtext) trainingfile.close() popen(buildmodel % (javaloc, model, "./traindata.txt"))
src/g/n/gnuplot-py-HEAD/trunk/gp_unix.py gnuplot-py(Download)
# ############ End of configuration options ############################ from os import popen def test_persist():
if GnuplotOpts.recognizes_persist is None:
import string
g = popen('echo | %s -persist 2>&1' % GnuplotOpts.gnuplot_command, 'r')
response = g.readlines()
g.close()
GnuplotOpts.recognizes_persist = (
if not test_persist():
raise ('-persist does not seem to be supported '
'by your version of gnuplot!')
self.gnuplot = popen('%s -persist' % GnuplotOpts.gnuplot_command,
'w')
else:
self.gnuplot = popen(GnuplotOpts.gnuplot_command, 'w')
src/g/n/gnuplot-py-HEAD/trunk/gp_macosx.py gnuplot-py(Download)
# ############ End of configuration options ############################ from os import popen def test_persist():
if GnuplotOpts.recognizes_persist is None:
import string
g = popen('echo | %s -persist 2>&1' % GnuplotOpts.gnuplot_command, 'r')
response = g.readlines()
g.close()
GnuplotOpts.recognizes_persist = (
if not test_persist():
raise ('-persist does not seem to be supported '
'by your version of gnuplot!')
self.gnuplot = popen('%s -persist' % GnuplotOpts.gnuplot_command,
'w')
else:
self.gnuplot = popen(GnuplotOpts.gnuplot_command, 'w')
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next