perl - Error in Python Program in Subproces.Popen -
I have written the following Python program which lesk_similarity wrapper function to calculate the similarity score using Perl programs. The GetMAxSim function gives the maximum simulation score by the number of combinations from both synstes. Nltk.corpus import wordnet import subprocess def lesk_similarity (a, b) from nltk Import: cmd = [ 'perl',
'./sample.pl'aab] proc = subprocess.Popen (cmd, stdout = subprocess.PIPE) to line proc.stdout: If the line 'equality': equality = int (line.split ( '=') [- 1]) returns equality def getMaxSim (synsets1, synsets2): maxSim = None in synsets1 for s1: for s2 in synsets2: sim = lesk_similarity (s1, s2) maxSim == none or maxSimI get the following error Make: Traceback (most recent call last): File "test4":
madhusudan @ maddy: ~ / WordNet- equality Create -2.05 / samples $ python test4.py & lt; & Gt; Py ", line 40, & lt; Module & gt; The file "test4.py", line 7, lesk_similarity proc = subprocess in print "create:", getMaxSim file ("Cricinetset, Template Syntset") file "test4.py", line 17, getMaxSim sim = lesk_similarity (s1, s2) Popin (CMD, standout = subprances.ppe) file "/usr/lib/python2.7/subprocess.py", line 679, __init__, misleading, error) "/usr/lib/python2.7/subprocess Py" file , Line 1249, _execute_child in child_exception Typewriter: execv () arg 2 should contain only the string
Please help me solve this problem.
Try changing this line cmd = ['perl', '. / Sample.pl ', a, b]
CMD = [' Pearl ','. / Sample.pl ', str (a), str (b)]
Comments
Post a Comment