Commit 86241a0d authored by hatiers's avatar hatiers Committed by Arnaud Bey
Browse files

Fix #93

parent 9ca21916
......@@ -40,7 +40,7 @@
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=",
"requires": {
"sprintf-js": "~1.0.2"
}
......@@ -151,7 +151,7 @@
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"integrity": "sha1-PH/L9SnYcibz0vUrlm/1Jx60Qd0=",
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -264,7 +264,7 @@
"concat-stream": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"integrity": "sha1-kEvfGUzTEi/Gdcd/xKw9T/D9GjQ=",
"requires": {
"buffer-from": "^1.0.0",
"inherits": "^2.0.3",
......@@ -366,7 +366,7 @@
"errno": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
"integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
"integrity": "sha1-RoTXF3mtOa8Xfj8AeZb3xnyFJhg=",
"optional": true,
"requires": {
"prr": "~1.0.1"
......@@ -506,7 +506,7 @@
"function-bind": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
"integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0="
},
"gaze": {
"version": "1.1.3",
......@@ -835,7 +835,7 @@
"iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"integrity": "sha1-KXhx9jvlB63Pv8pxXQzQ7thOmmM=",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
......@@ -876,7 +876,7 @@
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
"integrity": "sha1-76ouqdqg16suoTqXsritUf776L4="
},
"is-builtin-module": {
"version": "1.0.0",
......@@ -1114,7 +1114,7 @@
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=",
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -1297,7 +1297,7 @@
"process-nextick-args": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
"integrity": "sha1-o31zL0JxtKsa0HDTVQjoKQeI/6o="
},
"promise": {
"version": "7.3.1",
......@@ -1462,7 +1462,7 @@
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
"integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0="
},
"safe-json-parse": {
"version": "1.0.1",
......@@ -1473,7 +1473,7 @@
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
"integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo="
},
"screenfull": {
"version": "3.3.2",
......@@ -1521,7 +1521,7 @@
"spdx-expression-parse": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
"integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
"integrity": "sha1-meEZt6XaAOBUkcn6M4t5BII7QdA=",
"requires": {
"spdx-exceptions": "^2.1.0",
"spdx-license-ids": "^3.0.0"
......@@ -1736,7 +1736,7 @@
"websocket-extensions": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz",
"integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==",
"integrity": "sha1-XS/yKXcAPsaHpLhwc9+7rBRszyk=",
"dev": true
},
"which": {
......
......@@ -7,6 +7,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class LetterController extends Controller
{
......@@ -14,9 +15,22 @@ class LetterController extends Controller
* @Route("/get-letters/{id}", name="get_letters", options={"expose"=true})
* @Method("POST")
*/
public function getLettersAction(Language $language)
public function getLettersAction(Language $language, Request $request)
{
$letters = $this->get('mw_manager.grid')->lottery($language, 4);
$squares = $request->request->get('squares');
$grid = [];
$x = 0;
for ($i=0; $i < 4; $i++) {
for ($j=0; $j < 4; $j++) {
$grid[$i][$j] = (($squares[$x] != " ") && ($squares[$x] != "-") && ($squares[$x] != "_") && ($squares[$x] != ""))
? $squares[$x]
: null;
$x++;
}
}
$letters = $this->get('mw_manager.grid')->lottery($language, 4, null, null, $grid);
return new JsonResponse($letters);
}
......
......@@ -382,7 +382,7 @@ class GridManager
return;
}
public function lottery(Language $language, $side, $debug = false, $minBigram = null)
public function lottery(Language $language, $side, $debug = false, $minBigram = null, $grid = null)
{
$minBigram = ($minBigram == null) ? $language->getMinBigram() : $minBigram;
// On crée un tableau de bigrammes
......@@ -429,10 +429,12 @@ class GridManager
$countsBigram = array_count_values($bigrams);
// // On initialise une grille vide.
$grid = [];
for ($i=0; $i < $side; $i++) {
for ($j=0; $j < $side; $j++) {
$grid[$i][$j] = null;
if (!$grid) {
$grid = [];
for ($i=0; $i < $side; $i++) {
for ($j=0; $j < $side; $j++) {
$grid[$i][$j] = null;
}
}
}
......
......@@ -6,19 +6,19 @@ var gridHandler = {
autofill: function(){
wait.start("Remplissage automatique de la grille");
var language = $('#languageId').val();
var data = $("#grid").serializeArray();
var url = Routing.generate('get_letters', {
id: language
});
$.ajax({
type: 'POST',
url: url,
data: data
})
.done(function(data) {
var data = data;
$("input[name='squares[]']").each(function( index ) {
if ($(this).val() == "" || $(this).val() == "-" || $(this).val() == "_") {
$(this).val(data[index]);
}
$(this).val(data[index]);
});
wait.stop();
});
......
......@@ -8,25 +8,37 @@ Nom de la relation (activant le combo) -> mot1 et mot2 ont en commun un lemme|ra
Règles de réécriture (ordonnées)
```
RW:é,è,ê,ë=e
RW:à,â,ä,á=a
RW:û,ü,ù,ú=u
RW:ô,ö,ó=o
RW:ï,î,í=i
RW:ç=c
RW:-,',@,&, ,°,º,.,µ,\,/,:,·=
RW:ñ=n
RW:é,è,ê,ë,E,É=e
RW:à,â,ä,á,A,ã,Å,å=a
RW:û,ü,ù,U=u
RW:ô,ö,ó,O,õ=o
RW:ï,î,í,I=i
RW:C,ç=c
RW:B=b
RW:D=d
RW:F=f
RW:G=g
RW:H=h
RW:J=j
RW:K=k
RW:L=l
RW:M=m
RW:P=p
RW:Q=q
RW:R=r
RW:S=s
RW:T=t
RW:V=v
RW:W=w
RW:X=x
RW:Y=y
RW:Z=z
RW:-,',@,&, ,°,º,.,µ,\,/,:,`,+,~,;,^,"=
RW:ñ,N=n
RW:œ=oe
RW:æ=ae
```
Description des traits et de leurs valeurs (si pas défini, valeur présente dans le csv du lexique utilisée par défaut)
```
DESCR:label:cat=catégorie
DESCR:value(cat):A=adjectif
DESCR:value(case):A=accusative
DESCR:value(case):D=dative
DESCR:value(case):N=nominative
DESCR:value(case):O=oblique
```
Poids sur les lettres après réécriture
- si lettre absente ici alors value =1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment