rug-compling / alpinocorpus-python Goto Github PK
View Code? Open in Web Editor NEWPython bindings for alpinocorpus
Python bindings for alpinocorpus
server.py kan niet omgaan met unicode-tekens in een query. Hier is een patch:
--- ../alpinocorpus-python/examples/server.py 2012-02-02 18:19:46.000000000 +0100
+++ server.py 2012-02-02 20:05:05.000000000 +0100
@@ -63,7 +63,7 @@
params = web.input()
contents = False
if params.has_key('query'):
- gen = c.query(params['query'])
+ gen = c.query(params['query'].encode('utf-8'))
if params.has_key('contents') and params.get('contents') == '1':
contents = True
else:
@@ -92,7 +92,7 @@
# Do we want to highlight something?
if params.has_key('markerQuery') and params.has_key('markerAttr') and params.has_key('markerValue'):
- markerQueries = [alpinocorpus.MarkerQuery(params['markerQuery'],
+ markerQueries = [alpinocorpus.MarkerQuery(params['markerQuery'].encode('utf-8'),
params['markerAttr'], params['markerValue'])]
else:
markerQueries = []
@@ -101,7 +101,7 @@
# Was a query provided?
if params.has_key('query'):
- gen = c.queryWithStylesheet(params['query'], web.data(), markerQueries)
+ gen = c.queryWithStylesheet(params['query'].encode('utf-8'), web.data(), markerQueries)
else:
gen = c.entriesWithStylesheet(web.data(), markerQueries)
@@ -125,7 +125,7 @@
# Was there a request to mark entries?
if params.has_key('markerQuery') and params.has_key('markerAttr') and params.has_key('markerValue'):
- queries = [alpinocorpus.MarkerQuery(params['markerQuery'],
+ queries = [alpinocorpus.MarkerQuery(params['markerQuery'].encode('utf-8'),
params['markerAttr'], params['markerValue'])]
data = c.readMarkQueries(entry, queries)
else:
@@ -149,7 +149,7 @@
# Was there a request to mark entries?
if params.has_key('query'):
- query = params.get('query')
+ query = params.get('query').encode('utf-8')
if c.validQuery(query):
return '1'
else:
The size reported by server.py (server_config.py) for a corpus that consists of a directory with multiple corpora is bogus.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.