forked from gouwsmeister/TextCleanser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb_service.py
More file actions
30 lines (23 loc) · 686 Bytes
/
Copy pathweb_service.py
File metadata and controls
30 lines (23 loc) · 686 Bytes
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
"""
Very simple HTTP-based server wrapper for the text normalisation system.
Author: Stephan Gouws
Contact: stephan@ml.sun.ac.za
Date: Jul 2011
"""
import cherrypy
from cherrypy import expose
from cleanser import TextCleanser
class CleanserWebService():
def __init__(self):
self.tc = TextCleanser()
@expose
def clean(self, text):
cleantext, error, replacements = self.tc.ssk_cleanse(text)
if error=="":
return cleantext
else:
# an error occurred
return error
if __name__ == "__main__":
print "Starting TextCleanser Web Service on localhost"
cherrypy.quickstart(CleanserWebService())