Skip to content

Commit 3eef004

Browse files
author
Tom De Smedt
committed
typos & small bug fixes
1 parent 8742c5b commit 3eef004

File tree

7 files changed

+32
-16
lines changed

7 files changed

+32
-16
lines changed

examples/08-server/02-api/api.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# You should see some JSON-output:
3030
# {"language": "en", "confidence": 0.83}
3131

32-
@app.route("/language", limit=100, time=HOUR, key=lambda data: app.request.ip)
32+
@app.route("/language", limit=100, time=HOUR)
3333
def predict_language(q=""):
3434
#print q
3535
iso, confidence = language(q) # (takes some time to load the first time)
@@ -53,10 +53,6 @@ def predict_language(q=""):
5353
# In this example, limit=100 and time=HOUR means up to a 100 requests/hour.
5454
# After that, the user will get a HTTP 429 Too Many Requests error.
5555

56-
# The "key" function takes a dictionary of all query parameters
57-
# and returns a unique ID for each user.
58-
# In this example we simply used the user's IP-address.
59-
6056
# The example below demonstrates how rates can be set up per user.
6157
# In this case, only the user with key=1234 is allowed access.
6258
# All other requests will generate a HTTP 403 Forbidden error.

pattern/db/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def pd(*args):
9696
"%Y-%m-%d", # 2010-09-21
9797
"%d/%m/%Y", # 21/09/2010
9898
"%d %B %Y", # 21 September 2010
99+
"%d %b %Y", # 21 Sep 2010
99100
"%B %d %Y", # September 21 2010
100101
"%B %d, %Y", # September 21, 2010
101102
]

pattern/server/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1243,15 +1243,16 @@ def run(self, host=LOCALHOST, port=8080, threads=30, queue=20, timeout=10, sessi
12431243
config={"/": {
12441244
"tools.staticdir.on" : self.static is not None,
12451245
"tools.staticdir.dir" : self.static,
1246-
"tools.sessions.on" : sessions
1246+
"tools.sessions.on" : bool(sessions),
1247+
"tools.sessions.timeout" : 60 if sessions is True else int(sessions)
12471248
}})
12481249
# Static content can include favicon.ico
12491250
self.favicon_ico = cp.tools.staticfile.handler(
12501251
os.path.join(self.static, "favicon.ico")
12511252
)
12521253
# Relative root = project path.
12531254
os.chdir(self._path)
1254-
# With mod_wsgi, stdout is restriced.
1255+
# With mod_wsgi, stdout is restricted.
12551256
if embedded:
12561257
sys.stdout = sys.stderr
12571258
else:

pattern/text/en/en-entities.txt

+19
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ Afghanistan LOC
1111
Africa LOC
1212
Al Capone PERS
1313
Al Pacino PERS
14+
Al-Raqqah LOC
15+
Al-Sham LOC
1416
Alaska LOC
17+
Aleppo LOC
1518
Albert Einstein PERS
1619
Albert Hofmann PERS
1720
Albert Schweitzer PERS
@@ -54,12 +57,14 @@ BMW ORG
5457
Babe Ruth PERS
5558
Bacardi ORG
5659
Backstreet Boys
60+
Baghdad LOC
5761
Bangladesh LOC
5862
Barack Obama PERS
5963
Barbra Streisand PERS
6064
Barcelona LOC
6165
Batman PERS
6266
Beethoven PERS
67+
Beijing LOC
6368
Belarus LOC
6469
Belgium LOC
6570
Ben Affleck PERS
@@ -89,12 +94,14 @@ Britney Spears PERS
8994
Bruce Lee PERS
9095
Bruce Willis PERS
9196
Bruno Mars PERS
97+
Brussels LOC
9298
Buddhism
9399
Bulgaria LOC
94100
Burger King
95101
Burma LOC
96102
C.S. Lewis PERS
97103
Cadillac ORG
104+
Calais LOC
98105
California LOC
99106
Cameron Diaz PERS
100107
Cameron Newton PERS
@@ -131,13 +138,16 @@ Cuba LOC
131138
DNA
132139
Daft Punk
133140
Dalai Lama PERS
141+
Damascus LOC
134142
Daniel Radcliffe PERS
143+
Daraa LOC
135144
Darren Aronofsky PERS
136145
Darren Criss PERS
137146
Darth Vader PERS
138147
David Beckham PERS
139148
David Bowie PERS
140149
David Cook PERS
150+
Deir ez-Zor LOC
141151
Demi Lovato PERS
142152
Demi Moore PERS
143153
Denmark LOC
@@ -240,6 +250,7 @@ Henry V PERS
240250
Henry VIII PERS
241251
Hilary Duff PERS
242252
Hillary Clinton PERS
253+
Homs LOC
243254
Honda ORG
244255
Hong Kong LOC
245256
Hotmail
@@ -255,6 +266,7 @@ Indira Gandhi PERS
255266
Indonesia LOC
256267
Internet Explorer
257268
Iran LOC
269+
Iraq LOC
258270
Ireland LOC
259271
Iron Man PERS
260272
Isaac Newton PERS
@@ -413,6 +425,8 @@ Mohammed Ali PERS
413425
Mona Lisa PERS
414426
Montreal LOC
415427
Morocco LOC
428+
Moscow LOC
429+
Mosul LOC
416430
Mother Teresa PERS
417431
Mother's Day
418432
Mozart PERS
@@ -438,6 +452,7 @@ Nicole Scherzinger PERS
438452
Nigeria LOC
439453
Nike ORG
440454
Nivea ORG
455+
Nineveh LOC
441456
North America LOC
442457
North Korea LOC
443458
Norway LOC
@@ -449,6 +464,7 @@ Owen Wilson PERS
449464
Ozzfest
450465
Pablo Picasso PERS
451466
Pakistan LOC
467+
Palmyra LOC
452468
Panasonic ORG
453469
Paris LOC
454470
Paul McCartney PERS
@@ -476,6 +492,7 @@ Queen Victoria PERS
476492
Rachmaninoff PERS
477493
Raiders of the Lost Ark
478494
Raisa Gorbachev PERS
495+
Raqqa LOC
479496
Real Madrid ORG
480497
Red Hot Chili Peppers PERS
481498
Reese Witherspoon PERS
@@ -559,6 +576,7 @@ Superman PERS
559576
Sweden LOC
560577
Switzerland LOC
561578
Sylvester Stallone PERS
579+
Syria LOC
562580
Taiwan LOC
563581
Taj Mahal LOC
564582
Take That
@@ -581,6 +599,7 @@ Theodore Roosevelt PERS
581599
Thomas Jefferson PERS
582600
Thor PERS
583601
Tiger Woods PERS
602+
Tigris LOC
584603
Titanic
585604
Tom Brady PERS
586605
Tom Cruise PERS

pattern/text/en/inflect.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def pluralize(word, pos=NOUN, custom={}, classical=True):
516516
"bison" , "debris" , "headquarters", "pincers" , "trout" ,
517517
"bream" , "diabetes" , "herpes" , "pliers" , "tuna" ,
518518
"breeches" , "djinn" , "high-jinks" , "proceedings", "whiting" ,
519-
"britches" , "eland" , "homework" , "rabies" , "wildebeest"
519+
"britches" , "eland" , "homework" , "rabies" , "wildebeest",
520520
"carp" , "elk" , "innings" , "salmon" ,
521521
"chassis" , "flounder" , "jackanapes" , "scissors" ,
522522
"christmas" , "gallows" , "mackerel" , "series" ,
@@ -528,15 +528,15 @@ def pluralize(word, pos=NOUN, custom={}, classical=True):
528528
singular_uncountable = set((
529529
"advice" , "equipment", "happiness" , "luggage" , "news" , "software" ,
530530
"bread" , "fruit" , "information" , "mathematics", "progress" , "understanding",
531-
"butter" , "furniture", "ketchup" , "mayonnaise" , "research" , "water"
531+
"butter" , "furniture", "ketchup" , "mayonnaise" , "research" , "water" ,
532532
"cheese" , "garbage" , "knowledge" , "meat" , "rice" ,
533533
"electricity", "gravel" , "love" , "mustard" , "sand" ,
534534
))
535535
singular_ie = set((
536536
"alergie" , "cutie" , "hoagie" , "newbie" , "softie" , "veggie" ,
537537
"auntie" , "doggie" , "hottie" , "nightie" , "sortie" , "weenie" ,
538538
"beanie" , "eyrie" , "indie" , "oldie" , "stoolie" , "yuppie" ,
539-
"birdie" , "freebie" , "junkie" , "^pie" , "sweetie" , "zombie"
539+
"birdie" , "freebie" , "junkie" , "^pie" , "sweetie" , "zombie" ,
540540
"bogie" , "goonie" , "laddie" , "pixie" , "techie" ,
541541
"bombie" , "groupie" , "laramie" , "quickie" , "^tie" ,
542542
"collie" , "hankie" , "lingerie" , "reverie" , "toughie" ,
@@ -549,7 +549,6 @@ def pluralize(word, pos=NOUN, custom={}, classical=True):
549549
"beeves": "beef",
550550
"brethren": "brother",
551551
"children": "child",
552-
"children": "child",
553552
"corpora": "corpus",
554553
"corpuses": "corpus",
555554
"ephemerides": "ephemeris",

pattern/text/search.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ def _parents(self, word, pos="NN"):
445445
CHUNKS = dict.fromkeys(["NP", "PP", "VP", "ADVP", "ADJP", "SBAR", "PRT", "INTJ"], True)
446446
ROLES = dict.fromkeys(["SBJ", "OBJ", "PRD", "TMP", "CLR", "LOC", "DIR", "EXT", "PRP"], True)
447447
TAGS = dict.fromkeys(["CC", "CD", "CJ", "DT", "EX", "FW", "IN", "JJ", "JJR", "JJS", "JJ*",
448-
"LS", "MD", "NN", "NNS", "NNP", "NNPS", "NN*", "NO", "PDT", "PR",
448+
"LS", "MD", "NN", "NNS", "NNP", "NNP*", "NNPS", "NN*", "NO", "PDT", "PR",
449449
"PRP", "PRP$", "PR*", "PRP*", "PT", "RB", "RBR", "RBS", "RB*", "RP",
450450
"SYM", "TO", "UH", "VB", "VBZ", "VBP", "VBD", "VBN", "VBG", "VB*",
451451
"WDT", "WP*", "WRB", "X", ".", ",", ":", "(", ")"], True)

pattern/web/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1370,10 +1370,10 @@ def search(self, query, type=SEARCH, start=1, count=10, sort=RELEVANCY, size=Non
13701370
# 3) Restrict language.
13711371
if type in (SEARCH, IMAGE) and self.language is not None:
13721372
url.query["Query"] = url.query["Query"][:-1] + " language: %s'" % self.language
1373-
#if self.language is not None:
1374-
# market = locale.market(self.language)
1375-
# if market:
1376-
# url.query["market"] = market
1373+
if type in (NEWS,) and self.language is not None:
1374+
market = locale.market(self.language)
1375+
if market:
1376+
url.query["Market"] = "'" + market + "'"
13771377
# 4) Parse JSON response.
13781378
kwargs["authentication"] = ("", self.license)
13791379
kwargs.setdefault("unicode", True)

0 commit comments

Comments
 (0)