Alshargi commited on
Commit
152ea9d
·
verified ·
1 Parent(s): 63e6e27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +77 -0
app.py CHANGED
@@ -8,6 +8,83 @@ import nltk
8
 
9
  nltk.download('punkt')
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  # Define feature functions
12
  def features(sentence, index):
13
  return {
 
8
 
9
  nltk.download('punkt')
10
 
11
+
12
+
13
+
14
+
15
+
16
+ def nextwords_1(ww, inx):
17
+ try:
18
+ return '' if inx == len(ww) - 1 else ww[inx + 1]
19
+ except:
20
+ pass
21
+
22
+ return ''
23
+
24
+ def nextwords_2(ww, inx):
25
+ try:
26
+ return '' if inx == len(ww) - 2 else ww[inx + 2]
27
+ except:
28
+ pass
29
+
30
+ return ''
31
+
32
+
33
+
34
+ def nextwords_3(ww, inx):
35
+ try:
36
+ return '' if inx == len(ww) - 3 else ww[inx + 3]
37
+ except:
38
+ pass
39
+
40
+ return ''
41
+
42
+ def nextwords_4(ww, inx):
43
+ try:
44
+ return '' if inx == len(ww) - 4 else ww[inx + 4]
45
+ except:
46
+ pass
47
+
48
+ return ''
49
+
50
+
51
+ def prvwords_1(ww, inx):
52
+ try:
53
+ return '' if inx == 0 else ww[inx - 1]
54
+ except:
55
+ pass
56
+
57
+ return ''
58
+
59
+
60
+ def prvwords_2(ww, inx):
61
+ try:
62
+ return '' if inx == 0 else ww[inx - 2]
63
+ except:
64
+ pass
65
+
66
+ return ''
67
+
68
+ def prvwords_3(ww, inx):
69
+ try:
70
+ return '' if inx == 0 else ww[inx - 3]
71
+ except:
72
+ pass
73
+
74
+ return ''
75
+
76
+
77
+ def prvwords_4(ww, inx):
78
+ try:
79
+ return '' if inx == 0 else ww[inx - 4]
80
+ except:
81
+ pass
82
+
83
+ return ''
84
+
85
+
86
+
87
+
88
  # Define feature functions
89
  def features(sentence, index):
90
  return {