-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeUsingOneclass.py
More file actions
47 lines (24 loc) · 1.47 KB
/
CodeUsingOneclass.py
File metadata and controls
47 lines (24 loc) · 1.47 KB
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
#Using one class
import web
#Defining urls
urls = (
'/response','TextProcessing',
)
app = web.application(urls, globals())
#if we write - http://localhost:8080/response - TextProcessing (tokenization,stemming,stopwords_removal,spell correction) is performed
#Defining Class for textprocessing
class TextProcessing:
#Defining Function
def GET(self):
#importing another python file which contains all the functions.
import app
#Sentences
raw_dirty_sen = ["here! <><>?//||are$ some# very *simple basic? @sentences.",
"they% wont be# very #complex, i'm #sure.",
"the +point_ of% these) _examples is= *to learn\\ how% basic* (text_ cleaning+ works_ on *very simple* data."]
sent = [" i am working on very simple project but i am learning a lot"]
example_words = ["python","pythoner","pythoning","pythoned","pythonly"]
#calling functions which were there in another python file and returning values
return "TOKENIZATION :-" , app.clean_and_tokenizing(raw_dirty_sen),"STOPWORDS REMOVAL :-" , app.stopwords_removal(sent), "STEMMING :-" , app.stemmingfunc(example_words),"SPELL CORRECTOR :-" , app.correct('hte'),app.correct('heatlh'),app.known(app.edits1('hav')),app.known_edits2('an'),app.Prob('health'),app.Prob('policy')
if __name__ == "__main__":
app.run()