Overview
Comment: | [server] new route: suggest to get spelling suggestions |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | server |
Files: | files | file ages | folders |
SHA3-256: |
83896785bde48d8e0cd4e8dfa8c4e329 |
User & Date: | olr on 2019-05-29 08:33:29 |
Other Links: | manifest | tags |
Context
2019-05-29
| ||
14:26 | [server] use multiprocessing, + code clarification check-in: 7e1204782d user: olr tags: trunk, server | |
08:33 | [server] new route: suggest to get spelling suggestions check-in: 83896785bd user: olr tags: trunk, server | |
2019-05-28
| ||
17:17 | [fr] faux positifs et ajustements check-in: 5cd46af1a4 user: olr tags: trunk, fr | |
Changes
Modified grammalecte-server.py from [ebda6f5998] to [2f75b0ed3c].
︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | + + + + + + + + | <p>Paramètres :</p> <ul> <li>"options" (text) : une chaîne au format JSON avec le nom des options comme attributs et un booléen comme valeur. Exemple : {"gv": true, "html": true}</li> </ul> <h3>Remise à zéro de ses options</h3> <p>[adresse_serveur]:{SERVER_PORT}/reset_options/fr (POST)</p> <h3>Suggestions orthographiques</h3> <p>[adresse_serveur]:{SERVER_PORT}/suggest/fr/<token> (GET)</p> <p>[adresse_serveur]:{SERVER_PORT}/suggest/fr (POST)</p> <p>Paramètres :</p> <ul> <li>"token" (text) : mot pour lequel vous désirez une suggestion orthographique.</li> </ul> <h2>TEST</h2> <h3>Analyse</h3> <form method="post" action="/gc_text/fr" accept-charset="UTF-8"> <p>Texte à analyser :</p> <textarea name="text" cols="120" rows="20" required></textarea> |
︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | + + + + + + | <p><input type="submit" class="button" value="Envoyer" /></p> </form> <h3>Remise à zéro de ses options</h3> <form method="post" action="/reset_options/fr" accept-charset="UTF-8"> <p><input type="submit" class="button" value="Envoyer" /></p> </form> <h3>Suggestion orthographique</h3> <form method="post" action="/suggest/fr" accept-charset="UTF-8"> <p><label for="token">Suggérer pour</label> <input id="token" type="text" name="token" style="width: 100px" /></p> <p><input type="submit" class="button" value="Envoyer" /></p> </form> </body> </html> """ SADLIFEOFAMACHINE = """ Lost on the Internet? Yeah... what a sad life we have. |
︙ | |||
110 111 112 113 114 115 116 | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | - + + + + + | return SADLIFEOFAMACHINE @app.route("/get_options/fr") def listOptions (): "returns grammar options in a text JSON format" sUserId = request.cookies.user_id dOptions = dUser[sUserId]["gc_options"] if sUserId and sUserId in dUser else dGCOptions |
︙ | |||
157 158 159 160 161 162 163 | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | - + + + + + + + + + + + + + + + + + + + + + + | if request.forms.options: sUserId = request.cookies.user_id if request.cookies.user_id else next(userGenerator) dOptions = dUser[sUserId]["gc_options"] if sUserId in dUser else dict(dGCOptions) try: dOptions.update(json.loads(request.forms.options)) dUser[sUserId] = { "time": int(time.time()), "gc_options": dOptions } response.set_cookie("user_id", sUserId, path="/", max_age=86400) # 24h |
︙ |