-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
153 lines (129 loc) · 5.03 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2014 [email protected]
#
# This file is part of evilometer.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
''''Rates arbitrary names based on a pre-rated list of names on some characteristic (ie "evilness")
Overview
========
Given a pre-rated list of names on some characteristic,
it decomposes them using n_grams and applies information retrieval rating[inv_index]_
to estimate the rating of any other name on that characteristic.
Install:
========
To install it, assuming you have download the sources,
do the usual::
python setup.py install
Or get it directly from the PIP repository::
pip3 install evilometer
Tested with Python 3.4.
Usage:
======
Fuefit accepts as input 2 vectors of names, the "training" set and the set of names to be rated.
A usage example::
>> import evilometer
>> train_names = {'trendy': 1, 'good':2, 'better':2, 'talon':-5, 'bad_ass':-10}
>> asked_names = {'kolon':1, 'trekking':2, 'trepper':-10}
>> name_scores = evilometer(train_names, asked_names)
>> print_scored_names_sorted(name_scores)
@author: [email protected], Apr-2014, (c) AGPLv3 or later
.. rubric:: Footnotes
.. [inv_index] http://nlp.stanford.edu/IR-book/html/htmledition/inverse-document-frequency-1.html
'''
#from setuptools import setup
from cx_Freeze import setup, Executable
import os
projname = 'evilometer'
mydir = os.path.dirname(__file__)
## Version-trick to have version-info in a single place,
## taken from: http://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package
##
def readversioninfo(fname):
fglobals = {'__version_info__':('x', 'x', 'x')} # In case reading the version fails.
exec(open(os.path.join(mydir, fname)).read(), fglobals) # To read __version_info__
return fglobals['__version_info__']
# Trick to use README file as long_description.
# It's nice, because now 1) we have a top level README file and
# 2) it's easier to type in the README file than to put a raw string in below ...
def readtxtfile(fname):
with open(os.path.join(mydir, fname)) as fd:
return fd.read()
_myverstr = '.'.join(str(s) for s in readversioninfo('_version.py'))
setup(
name = projname,
# packages = [projname],
# package_data= {'projname': ['data/*.csv']},
py_modules = ['evilometer'],
package_data = {
'': ["prerated-*"]
},
# test_suite="fuefit.test", #TODO: check setup.py testsuit indeed works.
version = _myverstr,
description = __doc__.strip().split("\n")[0],
author = "ankostis",
author_email = "[email protected]",
url = "https://github.com/ankostis/%s" % projname,
license = "GNU Affero General Public License v3 or later (AGPLv3+)",
keywords = ['text-rating', 'text-processing', 'natural-language', 'mind-game', 'fun'],
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: Manufacturing",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Operating System :: OS Independent",
"Topic :: Artistic Software",
"Topic :: Games/Entertainmen",
"Topic :: Text Processing",
"Topic :: Text Processing :: Indexing",
"Topic :: Text Processing :: Linguistic",
"",
],
long_description = __doc__,
install_requires = [
'numpy',
'pandas',
],
test_requires = [
],
options = {
'build_exe': {
"excludes": [ "tkinter","PyQt4","PySide",
"scipy", "IPython", "numexpr",
"pygments", "pyreadline", "jinja2",
"setuptools",
"matplotlib", "statsmodels", "docutils",
"xml", "xmlrpc",
"nose",
"Cython", "pydoc_data", "sphinx", "docutils",
#urllib<--email<--http<--pandas
#distutils" <-- pandas.compat
],
'include_msvcr': True,
'compressed': True,
'include_in_shared_zip': True,
}, 'bdist_msi': {
'add_to_path': False,
},
},
executables = [Executable("evilometer.py")]
)