python trans, extendedTransforms

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

python trans, extendedTransforms

progster
hi i'm trynig to check this levenshtein function in v23, but I see this error. I've installed a package called trans-2.0.2 and extendedTransforms in C:\Python27\Lib\site-packages

*python_extendedTransforms_levenshtein.sps.
DATA LIST FREE /str1 (A8) str2 (A8).
BEGIN DATA
untied united
END DATA.

BEGIN PROGRAM.
import trans, extendedTransforms
tproc = trans.Tfunction()
tproc.append(extendedTransforms.levenshteindistance,
                    'ldistance',
                    'f',
                    ['str1','str2'])
tproc.execute()
END PROGRAM.
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ImportError: No module named trans
Reply | Threaded
Open this post in threaded view
|

Re: python trans, extendedTransforms

Jon Peck
I would suggest that you use that function like this, making use of the SPSSINC TRANS extension command.
data list free /str1(a8) str2(a8).
begin data
untied united
end data

spssinc trans result = lev
/formula "extendedTransforms.levenshteindistance(str1, str2)".

The old trans module is not installed with the Statistics Python Essentials, but I think you can get it by following the Python Modules link on the SPSS Community website.



On Fri, Feb 26, 2016 at 4:19 PM, progster <[hidden email]> wrote:
hi i'm trynig to check this levenshtein function in v23, but I see this
error. I've installed a package called trans-2.0.2 and extendedTransforms in
C:\Python27\Lib\site-packages

*python_extendedTransforms_levenshtein.sps.
DATA LIST FREE /str1 (A8) str2 (A8).
BEGIN DATA
untied united
END DATA.

BEGIN PROGRAM.
import trans, extendedTransforms
tproc = trans.Tfunction()
tproc.append(extendedTransforms.levenshteindistance,
                    'ldistance',
                    'f',
                    ['str1','str2'])
tproc.execute()
END PROGRAM.
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ImportError: No module named trans




--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/python-trans-extendedTransforms-tp5731624.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD



--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD