Removing some more rude words and automation of examples
This commit is contained in:
parent
f47ea87475
commit
9cdd13343a
10
README.md
10
README.md
|
@ -7,9 +7,9 @@ Try it: http://these3words.herokuapp.com/
|
||||||
|
|
||||||
Some interesting locations:
|
Some interesting locations:
|
||||||
|
|
||||||
* [Battery Park, NYC](http://these3words.herokuapp.com/nikaya-caput-mahon)
|
* [Battery Park, NYC](http://these3words.herokuapp.com/huai-sora-pelayo)
|
||||||
* [Downtown San Francisco](http://these3words.herokuapp.com/stitt-budged-tower)
|
* [Downtown San Francisco](http://these3words.herokuapp.com/smite-arends-nagler)
|
||||||
* [Sydney, Australia](http://these3words.herokuapp.com/scone-scud-inbox)
|
* [Sydney, Australia](http://these3words.herokuapp.com/cuyler-propor-marias)
|
||||||
|
|
||||||
This app was inspired by http://what3words.com/
|
This app was inspired by http://what3words.com/
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ example
|
||||||
|
|
||||||
>>> three = these.three_words(CERN)
|
>>> three = these.three_words(CERN)
|
||||||
>>> print three
|
>>> print three
|
||||||
'closet-chou-maurel'
|
'turks-yunnan-salant'
|
||||||
>>> these.decode(three)
|
>>> these.decode(three)
|
||||||
(46.232335567474365, 6.055419445037842)
|
(46.232335567474365, 6.055419445037842)
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ brought to you by [@betatim][betatim] and [@kdungs][kdungs] productions
|
||||||
|
|
||||||
[humanhash]: https://github.com/zacharyvoase/humanhash
|
[humanhash]: https://github.com/zacharyvoase/humanhash
|
||||||
[geohash]: https://code.google.com/p/python-geohash/
|
[geohash]: https://code.google.com/p/python-geohash/
|
||||||
[cernmap]: http://these3words.herokuapp.com/closet-chou-maurel
|
[cernmap]: http://these3words.herokuapp.com/turks-yunnan-salant
|
||||||
[othercernmap]: http://these3words.herokuapp.com/spaghetti-carolina-kentucky-utah-seventeen-neptune
|
[othercernmap]: http://these3words.herokuapp.com/spaghetti-carolina-kentucky-utah-seventeen-neptune
|
||||||
[bottlepy]: http://bottlepy.org/
|
[bottlepy]: http://bottlepy.org/
|
||||||
[betatim]: https://twitter.com/betatim
|
[betatim]: https://twitter.com/betatim
|
||||||
|
|
13
app.py
13
app.py
|
@ -11,6 +11,11 @@ from bottle import (
|
||||||
import thesethreewords as these
|
import thesethreewords as these
|
||||||
|
|
||||||
|
|
||||||
|
example_locs = [("sydney", (-33.867480754852295, 151.20700120925903)),
|
||||||
|
("battery", (40.70329427719116, -74.0170168876648)),
|
||||||
|
("san_fran", (37.790114879608154, -122.4202036857605))]
|
||||||
|
example_locs = dict((name,these.three_words(pos)) for name,pos in example_locs)
|
||||||
|
|
||||||
@get('/static/<filename:path>')
|
@get('/static/<filename:path>')
|
||||||
def serve_static(filename):
|
def serve_static(filename):
|
||||||
return static_file(filename, root='static')
|
return static_file(filename, root='static')
|
||||||
|
@ -18,7 +23,7 @@ def serve_static(filename):
|
||||||
|
|
||||||
@get('/')
|
@get('/')
|
||||||
def index():
|
def index():
|
||||||
return template('index', err=None)
|
return template('index', err=None, **example_locs)
|
||||||
|
|
||||||
|
|
||||||
@get('/<threewords>')
|
@get('/<threewords>')
|
||||||
|
@ -28,7 +33,8 @@ def showMap(threewords):
|
||||||
return template('map', lat=lat, lng=lng, threewords=threewords)
|
return template('map', lat=lat, lng=lng, threewords=threewords)
|
||||||
except:
|
except:
|
||||||
return template('index',
|
return template('index',
|
||||||
err="Could not find location {}".format(threewords))
|
err="Could not find location {}".format(threewords),
|
||||||
|
**example_locs)
|
||||||
|
|
||||||
|
|
||||||
@get('/latlng/<lat:float>,<lng:float>')
|
@get('/latlng/<lat:float>,<lng:float>')
|
||||||
|
@ -38,7 +44,8 @@ def showMapFromLatLng(lat, lng):
|
||||||
return template('map', lat=lat, lng=lng, threewords=threewords)
|
return template('map', lat=lat, lng=lng, threewords=threewords)
|
||||||
except:
|
except:
|
||||||
return template('index',
|
return template('index',
|
||||||
err="Could not find location {}".format(threewords))
|
err="Could not find location {}".format(threewords),
|
||||||
|
**example_locs)
|
||||||
|
|
||||||
|
|
||||||
# API
|
# API
|
||||||
|
|
|
@ -28,12 +28,12 @@
|
||||||
<p>
|
<p>
|
||||||
<ul class="lead">
|
<ul class="lead">
|
||||||
<li>Type in a location to find out the three words by which to remember it (try <i>1600 Pennsylvania avenue ...</i>)</li>
|
<li>Type in a location to find out the three words by which to remember it (try <i>1600 Pennsylvania avenue ...</i>)</li>
|
||||||
<li>To find the location referenced by a set of three words given to you, type them in separated by a dash (try <i>scone-scud-inbox</i>)</li>
|
<li>To find the location referenced by a set of three words given to you, type them in separated by a dash (try <i>{{ sydney }}</i>)</li>
|
||||||
<li>Go straight to exploring the map by clicking the <i>Find on Map</i> button, it will take you to Sydney</li>
|
<li>Go straight to exploring the map by clicking the <i>Find on Map</i> button, it will take you to Sydney</li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
<p id="input3wordsContainer">
|
<p id="input3wordsContainer">
|
||||||
<input type="text" class="form-control" id="input3words" placeholder="1600 Pennsylvania .. OR scone-scud-inbox">
|
<input type="text" class="form-control" id="input3words" placeholder="1600 Pennsylvania .. OR {{ sydney }}">
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<button id="button3words" class="btn btn-lg btn-primary">Find on Map</button>
|
<button id="button3words" class="btn btn-lg btn-primary">Find on Map</button>
|
||||||
|
@ -41,9 +41,9 @@
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
Some interesting locations to try out:
|
Some interesting locations to try out:
|
||||||
<ul class="lead">
|
<ul class="lead">
|
||||||
<li><a href="nikaya-caput-mahon">Battery Park, NYC</a></li>
|
<li><a href="{{ battery }}">Battery Park, NYC</a></li>
|
||||||
<li><a href="stitt-budged-tower">Downtown San Francisco</a></li>
|
<li><a href="{{ san_fran }}">Downtown San Francisco</a></li>
|
||||||
<li><a href="scone-scud-inbox">Sydney, Australia</a></li>
|
<li><a href="{{ sydney }}">Sydney, Australia</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
</main>
|
</main>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
var initialise = function () {
|
var initialise = function () {
|
||||||
var default3words = 'scone-scud-inbox';
|
var default3words = '{{ sydney }}';
|
||||||
var searchbox = new google.maps.places.SearchBox(
|
var searchbox = new google.maps.places.SearchBox(
|
||||||
(document.getElementById('input3words')));
|
(document.getElementById('input3words')));
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,27 @@
|
||||||
|
refus
|
||||||
|
sowler
|
||||||
|
steyr
|
||||||
|
tamari
|
||||||
|
tawil
|
||||||
|
zapf
|
||||||
|
zelaya
|
||||||
|
baska
|
||||||
|
batey
|
||||||
|
besar
|
||||||
|
bolten
|
||||||
|
cusses
|
||||||
|
dtsch
|
||||||
|
elac
|
||||||
|
iesop
|
||||||
|
immo
|
||||||
|
isonzo
|
||||||
|
jehuda
|
||||||
|
kabaka
|
||||||
|
kokko
|
||||||
|
kuch
|
||||||
|
larsan
|
||||||
|
limbu
|
||||||
|
naiads
|
||||||
ombre
|
ombre
|
||||||
penta
|
penta
|
||||||
planks
|
planks
|
||||||
|
@ -188,7 +212,6 @@ unrwa
|
||||||
wender
|
wender
|
||||||
aisled
|
aisled
|
||||||
bordes
|
bordes
|
||||||
buttle
|
|
||||||
crave
|
crave
|
||||||
craw
|
craw
|
||||||
dantas
|
dantas
|
||||||
|
@ -452,7 +475,6 @@ sidley
|
||||||
solidi
|
solidi
|
||||||
tiptop
|
tiptop
|
||||||
wint
|
wint
|
||||||
xxxxxx
|
|
||||||
alloa
|
alloa
|
||||||
andj
|
andj
|
||||||
bribe
|
bribe
|
||||||
|
@ -1011,7 +1033,6 @@ jiaoyu
|
||||||
khare
|
khare
|
||||||
newdow
|
newdow
|
||||||
notman
|
notman
|
||||||
nudity
|
|
||||||
piazzi
|
piazzi
|
||||||
raheem
|
raheem
|
||||||
rukh
|
rukh
|
||||||
|
@ -2524,7 +2545,6 @@ vilar
|
||||||
wigged
|
wigged
|
||||||
zdenek
|
zdenek
|
||||||
adopts
|
adopts
|
||||||
barf
|
|
||||||
bassin
|
bassin
|
||||||
carpe
|
carpe
|
||||||
chefoo
|
chefoo
|
||||||
|
@ -3128,7 +3148,6 @@ kimchi
|
||||||
kobal
|
kobal
|
||||||
marke
|
marke
|
||||||
neils
|
neils
|
||||||
rapee
|
|
||||||
remade
|
remade
|
||||||
seow
|
seow
|
||||||
sombre
|
sombre
|
||||||
|
@ -3655,7 +3674,6 @@ liia
|
||||||
maciej
|
maciej
|
||||||
ninths
|
ninths
|
||||||
pernod
|
pernod
|
||||||
pron
|
|
||||||
strato
|
strato
|
||||||
tacos
|
tacos
|
||||||
tarter
|
tarter
|
||||||
|
@ -10994,7 +11012,6 @@ bere
|
||||||
byram
|
byram
|
||||||
caryn
|
caryn
|
||||||
flier
|
flier
|
||||||
nudist
|
|
||||||
resi
|
resi
|
||||||
shai
|
shai
|
||||||
tura
|
tura
|
||||||
|
@ -11587,7 +11604,6 @@ coos
|
||||||
crated
|
crated
|
||||||
fortes
|
fortes
|
||||||
loisy
|
loisy
|
||||||
nipple
|
|
||||||
pontic
|
pontic
|
||||||
renie
|
renie
|
||||||
ativan
|
ativan
|
||||||
|
@ -14679,7 +14695,6 @@ lukan
|
||||||
nder
|
nder
|
||||||
okun
|
okun
|
||||||
omri
|
omri
|
||||||
xxxxx
|
|
||||||
yuppie
|
yuppie
|
||||||
jemez
|
jemez
|
||||||
severo
|
severo
|
||||||
|
@ -15672,7 +15687,6 @@ cocker
|
||||||
gleich
|
gleich
|
||||||
glueck
|
glueck
|
||||||
maumee
|
maumee
|
||||||
xxxx
|
|
||||||
dunked
|
dunked
|
||||||
ilona
|
ilona
|
||||||
mino
|
mino
|
||||||
|
@ -22819,7 +22833,6 @@ otro
|
||||||
reboot
|
reboot
|
||||||
shrew
|
shrew
|
||||||
mesmer
|
mesmer
|
||||||
xxxix
|
|
||||||
mezzo
|
mezzo
|
||||||
vanya
|
vanya
|
||||||
rizzo
|
rizzo
|
||||||
|
@ -23424,7 +23437,6 @@ ostrom
|
||||||
negev
|
negev
|
||||||
sahel
|
sahel
|
||||||
cued
|
cued
|
||||||
xxxvii
|
|
||||||
quale
|
quale
|
||||||
mohun
|
mohun
|
||||||
cowles
|
cowles
|
||||||
|
@ -23440,7 +23452,6 @@ mersey
|
||||||
hecate
|
hecate
|
||||||
drusus
|
drusus
|
||||||
narnia
|
narnia
|
||||||
xxxvi
|
|
||||||
flavia
|
flavia
|
||||||
mercia
|
mercia
|
||||||
maitre
|
maitre
|
||||||
|
@ -23512,7 +23523,6 @@ sonja
|
||||||
prynne
|
prynne
|
||||||
gilson
|
gilson
|
||||||
oudh
|
oudh
|
||||||
xxxv
|
|
||||||
uzbek
|
uzbek
|
||||||
qaida
|
qaida
|
||||||
smit
|
smit
|
||||||
|
@ -23818,7 +23828,6 @@ cavour
|
||||||
hellas
|
hellas
|
||||||
samoan
|
samoan
|
||||||
dhabi
|
dhabi
|
||||||
xxxiv
|
|
||||||
rahner
|
rahner
|
||||||
dabbed
|
dabbed
|
||||||
pawns
|
pawns
|
||||||
|
@ -24722,10 +24731,8 @@ amen
|
||||||
chats
|
chats
|
||||||
felons
|
felons
|
||||||
heroic
|
heroic
|
||||||
xxxiii
|
|
||||||
dickey
|
dickey
|
||||||
madmen
|
madmen
|
||||||
rapist
|
|
||||||
alger
|
alger
|
||||||
sinha
|
sinha
|
||||||
kama
|
kama
|
||||||
|
@ -24797,7 +24804,6 @@ jaunty
|
||||||
kemal
|
kemal
|
||||||
dykes
|
dykes
|
||||||
willi
|
willi
|
||||||
xxxii
|
|
||||||
bree
|
bree
|
||||||
bering
|
bering
|
||||||
fates
|
fates
|
||||||
|
@ -25595,7 +25601,6 @@ spiced
|
||||||
orphan
|
orphan
|
||||||
wholes
|
wholes
|
||||||
tinker
|
tinker
|
||||||
xxxi
|
|
||||||
alarm
|
alarm
|
||||||
croats
|
croats
|
||||||
lili
|
lili
|
||||||
|
@ -29919,7 +29924,6 @@ cette
|
||||||
benton
|
benton
|
||||||
flat
|
flat
|
||||||
writer
|
writer
|
||||||
nude
|
|
||||||
brenda
|
brenda
|
||||||
stew
|
stew
|
||||||
connor
|
connor
|
||||||
|
@ -29971,7 +29975,6 @@ canaan
|
||||||
pius
|
pius
|
||||||
docks
|
docks
|
||||||
severe
|
severe
|
||||||
raped
|
|
||||||
pang
|
pang
|
||||||
ruskin
|
ruskin
|
||||||
guess
|
guess
|
||||||
|
@ -31273,7 +31276,6 @@ justly
|
||||||
junior
|
junior
|
||||||
flock
|
flock
|
||||||
norm
|
norm
|
||||||
negro
|
|
||||||
tanks
|
tanks
|
||||||
waving
|
waving
|
||||||
wiped
|
wiped
|
||||||
|
@ -31423,7 +31425,6 @@ keith
|
||||||
purse
|
purse
|
||||||
cope
|
cope
|
||||||
beans
|
beans
|
||||||
rape
|
|
||||||
calmly
|
calmly
|
||||||
admire
|
admire
|
||||||
linda
|
linda
|
||||||
|
@ -31432,7 +31433,6 @@ sally
|
||||||
along
|
along
|
||||||
watson
|
watson
|
||||||
jason
|
jason
|
||||||
nazi
|
|
||||||
holmes
|
holmes
|
||||||
dashed
|
dashed
|
||||||
gown
|
gown
|
||||||
|
|
|
@ -13,7 +13,9 @@ damn hell homo jerk jizz knobend knob end labia lmao lmfao muff nigger
|
||||||
nigga omg penis piss poop prick pube pussy queer scrotum sex shit sh1t
|
nigga omg penis piss poop prick pube pussy queer scrotum sex shit sh1t
|
||||||
slut smegma spunk suicide tit tosser turd twat vagina wank whore wtf
|
slut smegma spunk suicide tit tosser turd twat vagina wank whore wtf
|
||||||
xxx sexual sexily sexist sexing sexta sextet sexier sexton sextus
|
xxx sexual sexily sexist sexing sexta sextet sexier sexton sextus
|
||||||
wessex sexism sussex sexes sexual""".split()
|
wessex sexism sussex sexes sexual rapist rape raped rapee rapes nude
|
||||||
|
nudist muff negro nazi nipple nudity lolita milf piss pissing porn
|
||||||
|
pron pube pubes barf""".split()
|
||||||
|
|
||||||
# Words that sound similar to others
|
# Words that sound similar to others
|
||||||
HOMOPHONES = """there their than then hear here capital capitol won to too lose
|
HOMOPHONES = """there their than then hear here capital capitol won to too lose
|
||||||
|
@ -104,17 +106,20 @@ wile whine, wine whirl, whorl whirled, world whit, wit white, wight
|
||||||
who's, whose woe, whoa wood, would yaw, yore, your, you're yoke, yolk
|
who's, whose woe, whoa wood, would yaw, yore, your, you're yoke, yolk
|
||||||
you'll, yule""".replace(",", " ").lower().split()
|
you'll, yule""".replace(",", " ").lower().split()
|
||||||
|
|
||||||
HANDPICKED = """buttel buttle wholes""".lower().split()
|
HANDPICKED = """xxxiii buttel buttle wholes""".lower().split()
|
||||||
|
|
||||||
wnl = stem.WordNetLemmatizer()
|
wnl = stem.WordNetLemmatizer()
|
||||||
|
|
||||||
REMOVE = HOMOPHONES + MORE_HOMOPHONES + RUDEWORDS
|
REMOVE = HOMOPHONES + MORE_HOMOPHONES + RUDEWORDS + HANDPICKED
|
||||||
REMOVE = set(wnl.lemmatize(R) for R in REMOVE)
|
REMOVE = set(wnl.lemmatize(R) for R in REMOVE)
|
||||||
|
|
||||||
for line in fileinput.input():
|
for line in fileinput.input():
|
||||||
count, word = line.split()
|
count, word = line.split()
|
||||||
word = word.lower()
|
word = word.lower()
|
||||||
|
|
||||||
|
if "xxx" in word:
|
||||||
|
continue
|
||||||
|
|
||||||
if word in REMOVE:
|
if word in REMOVE:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue