Improvce language visualization. Generalize language node selection, change language query parameters, add resolution of node name (corpus-) to lexvo controler
--- a/cms/app-client/app/components/visu-langues.js Thu Oct 13 13:01:12 2016 +0200
+++ b/cms/app-client/app/components/visu-langues.js Fri Oct 14 01:02:10 2016 +0200
@@ -76,6 +76,8 @@
d._children = d.children;
if(d.children) {
d.value = d.children.reduce(function(p, v) { return p + accumulate(v); }, 0);
+ } else if (d.values) {
+ d.value = d.values.reduce(function(p, v) { return p + (languages[v] ? languages[v] : 0); }, 0);
} else {
d.value = languages[d.id] ? languages[d.id] : 0;
}
@@ -89,10 +91,14 @@
function getCount(node, count = 0) {
var c = languages[node.id];
if(typeof c === 'undefined') {
- node._children.forEach(function(child) {
- count = getCount(child, count);
- });
- return count;
+ if(node._children) {
+ node._children.forEach(function(child) {
+ count = getCount(child, count);
+ });
+ } else if(node.values) {
+ count = node.values.reduce(function(p, v) { return p + (languages[v] ? languages[v] : 0); }, count);
+ }
+ return count;
} else {
return count + c;
}
--- a/cms/app-client/app/controllers/application.js Thu Oct 13 13:01:12 2016 +0200
+++ b/cms/app-client/app/controllers/application.js Fri Oct 14 01:02:10 2016 +0200
@@ -9,9 +9,9 @@
}),
queryParams: ['location', 'date', 'notice', {
- language: 'langue',
- discourse: 'discours',
- theme: 'thematique'
+ language: 'language',
+ discourse: 'discourse',
+ theme: 'theme'
}],
date: [],
--- a/cms/app-client/app/services/constants.js Thu Oct 13 13:01:12 2016 +0200
+++ b/cms/app-client/app/services/constants.js Fri Oct 14 01:02:10 2016 +0200
@@ -78,8 +78,9 @@
};
const LANGUAGES_TREEMAP = {
- "name": "Global",
- "children": [
+ "id": "corpus-global",
+ "name": "Global",
+ "children": [
{
"id": "http://lexvo.org/id/iso639-3/fra",
"name": "Français",
@@ -102,15 +103,17 @@
},
{
"id": "http://lexvo.org/id/iso639-3/und",
- "name": "Undetermined",
+ "name": "Indéterminée",
},
{
+ "id": "corpus-regionals",
"name": "Langues régionales",
// (franccomtois,wallon, champenois, picard, normand, gallo,poitevin-saintongeais [dans ses deux variétés : poitevinet saintongeais], lorrain, bourguignon-morvandiau)
"children": [
{
- "id": "http://lexvo.org/id/iso639-3/pcd",
+ "id": "corpus-oil",
"name": "Langues d'oïl",
+ "values": ["http://lexvo.org/id/iso639-3/pcd",]
},
{
"id": "http://lexvo.org/id/iso639-3/frp",
@@ -121,21 +124,23 @@
"name": "Corse",
},
{
- "name": "Les Creoles",
+ "id": "corpus-creoles",
+ "name": "Les Créoles",
"children": [
{
"id": "http://lexvo.org/id/iso639-3/rcf",
- "name": "Creole de la Réunion",
+ "name": "Créole de la Réunion",
},
{
"id": "http://lexvo.org/id/iso639-3/gcf",
- "name": "Creole de la Guadeloupe",
+ "name": "Créole de la Guadeloupe",
}
]
}
]
},
{
+ "id": "corpus-non-territorials",
"name": "Langues non territoriales",
"children": [
{
@@ -173,6 +178,7 @@
]
},
{
+ "id": "corpus-guyane",
"name": "Guyane",
"children": [
{
@@ -202,6 +208,7 @@
]
},
{
+ "id": "corpus-mayotte",
"name": "Mayotte",
"children": [
{
@@ -215,6 +222,7 @@
]
},
{
+ "id": "corpus-polynesia",
"name": "Polynésie française",
"children": [
{
@@ -224,6 +232,7 @@
]
},
{
+ "id": "corpus-wallis-futuna",
"name": "Wallis et Futuna",
"children": [
{
@@ -237,6 +246,7 @@
]
},
{
+ "id": "corpus-new-caledonia",
"name": "Nouvelle-Calédonie",
"children": [
{
--- a/cms/app-client/mirage/config.js Thu Oct 13 13:01:12 2016 +0200
+++ b/cms/app-client/mirage/config.js Fri Oct 14 01:02:10 2016 +0200
@@ -44,7 +44,7 @@
var langIds = decodeURIComponent(request.params.ids);
var resMap = _.reduce(langIds.split(','), function(res, id) {
var fullId = id;
- if(!_.startsWith(fullId, constants.LEXVO_BASE_URL)) {
+ if(!_.startsWith(fullId, constants.LEXVO_BASE_URL) && !_.startsWith(fullId, constants.LANGUAGES_NODE_PREFIX)) {
fullId = constants.LEXVO_BASE_URL + id;
}
var lexvoRes = lexvos.find(fullId);
--- a/cms/app-client/mirage/fixtures/lexvos.js Thu Oct 13 13:01:12 2016 +0200
+++ b/cms/app-client/mirage/fixtures/lexvos.js Fri Oct 14 01:02:10 2016 +0200
@@ -39,5 +39,15 @@
{ 'id': "http://lexvo.org/id/iso639-3/aji", 'name': "ajië" },
{ 'id': "http://lexvo.org/id/iso639-3/ita", 'name': "italien" },
{ 'id': "http://lexvo.org/id/iso639-3/kdk", 'name': "numee" },
- { 'id': "http://lexvo.org/id/iso639-3/nua", 'name': "yuaga" }
+ { 'id': "http://lexvo.org/id/iso639-3/nua", 'name': "yuaga" },
+ { 'id': "corpus-global", 'name': "global" },
+ { 'id': "corpus-regionals", 'name': "langues régionales" },
+ { 'id': "corpus-oil", 'name': "langues d'oïl" },
+ { 'id': "corpus-creoles", 'name': "les créoles" },
+ { 'id': "corpus-non-territorials", 'name': "langues non territoriales" },
+ { 'id': "corpus-guyane", 'name': "Guyane" },
+ { 'id': "corpus-mayotte", 'name': "Mayotte" },
+ { 'id': "corpus-polynesia", 'name': "Polynésie française" },
+ { 'id': "corpus-wallis-futuna", 'name': "Wallis et Futuna" },
+ { 'id': "corpus-new-caledonia", 'name': "Nouvelle-Calédonie" },
];
--- a/common/corpus-common-addon/addon/utils/constants.js Thu Oct 13 13:01:12 2016 +0200
+++ b/common/corpus-common-addon/addon/utils/constants.js Fri Oct 14 01:02:10 2016 +0200
@@ -1,6 +1,8 @@
export const LEXVO_BASE_URL = 'http://lexvo.org/id/iso639-3/';
+export const LANGUAGES_NODE_PREFIX = 'corpus-';
+
export const VIAF_BASE_URL = 'http://viaf.org/viaf/';
export const BNF_BASE_URL = 'http://data.bnf.fr/';
--- a/server/bo_client/server/fixtures/lexvo.js Thu Oct 13 13:01:12 2016 +0200
+++ b/server/bo_client/server/fixtures/lexvo.js Fri Oct 14 01:02:10 2016 +0200
@@ -3,5 +3,15 @@
module.exports = {
'fra': 'français',
'gsw': 'alémanique',
- 'oci': 'occitan'
+ 'oci': 'occitan',
+ 'corpus-global': 'global',
+ 'corpus-regionals': 'langues régionales',
+ 'corpus-oil': 'langues d\'oïl',
+ 'corpus-creoles': 'les créoles',
+ 'corpus-non-territorials': 'langues non territoriales',
+ 'corpus-guyane': 'Guyane',
+ 'corpus-mayotte': 'Mayotte',
+ 'corpus-polynesia': 'Polynésie française',
+ 'corpus-wallis-futuna': 'Wallis et Futuna',
+ 'corpus-new-caledonia': 'Nouvelle-Calédonie'
};
--- a/server/src/app/Http/Controllers/Api/DocumentController.php Thu Oct 13 13:01:12 2016 +0200
+++ b/server/src/app/Http/Controllers/Api/DocumentController.php Fri Oct 14 01:02:10 2016 +0200
@@ -9,6 +9,7 @@
use CorpusParole\Http\Controllers\Controller;
use CorpusParole\Repositories\DocumentRepository;
use CorpusParole\Services\TranscriptManager;
+use CorpusParole\Libraries\Filters\CorpusFilterManager;
class DocumentController extends Controller
{
@@ -32,7 +33,7 @@
$filters = [];
$languages = $request->input('language', []);
if(!empty($languages)) {
- $filters['language'] = $languages;
+ $filters['language'] = CorpusFilterManager::prepareLanguages($languages);
}
$sort = $request->input('sort', null);
--- a/server/src/app/Http/Controllers/Api/LexvoController.php Thu Oct 13 13:01:12 2016 +0200
+++ b/server/src/app/Http/Controllers/Api/LexvoController.php Fri Oct 14 01:02:10 2016 +0200
@@ -8,6 +8,9 @@
use CorpusParole\Services\LexvoResolverInterface;
use CorpusParole\Services\LexvoResolverException;
+use CorpusParole\Libraries\Filters\CorpusFilterManager;
+use CorpusParole\Libraries\Utils;
+
class LexvoController extends Controller
{
public function __construct(LexvoResolverInterface $lexvoResolver) {
@@ -23,7 +26,26 @@
public function show($id)
{
try {
- return response()->json(['lexvoids' => $this->lexvoResolver->getNames(explode(",", $id))]);
+ $ids = [];
+ $corpusIds = [];
+ foreach(explode(",", $id) as $idStr) {
+ if(Utils::startsWith($idStr, config('corpusparole.language_corpus_node_prefix'))) {
+ $corpusIds[] = $idStr;
+ } else {
+ $ids[] = $idStr;
+ }
+ }
+ $lexvosNames = $this->lexvoResolver->getNames($ids);
+ $corpusNames = array_reduce($corpusIds, function($res,$cid) {
+ $cNode = CorpusFilterManager::getLanguageNode($cid);
+ if(is_null($cNode)) {
+ $res[$cid] = null;
+ } else {
+ $res[$cid] = $cNode['name'];
+ }
+ return $res;
+ }, []);
+ return response()->json(['lexvoids' => array_merge($lexvosNames, $corpusNames)]);
} catch (LexvoResolverException $e) {
abort(500, $e->getMessage());
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/app/Libraries/Filters/CorpusFilterManager.php Fri Oct 14 01:02:10 2016 +0200
@@ -0,0 +1,74 @@
+<?php
+namespace CorpusParole\Libraries\Filters;
+
+use Config;
+use CorpusParole\Libraries\Utils;
+
+class CorpusFilterManager {
+
+ public static function getLanguageNode($nodeId) {
+ $node = null;
+ $currentNodes = [config('corpusparole.languages_treemap'),];
+ while(is_null($node) || !empty($currentNodes)) {
+ $currentNode = array_pop($currentNodes);
+ foreach($currentNode['children'] as $n) {
+ if($n['id'] === $nodeId) {
+ $node = $n;
+ break;
+ } elseif (array_key_exists('children', $n)) {
+ array_push($currentNodes, $n);
+ }
+ }
+ }
+ return $node;
+ }
+
+ private static function getLanguageNodeChildren($nodeId) {
+ $node = self::getLanguageNode($nodeId);
+ if(is_null($node)) {
+ return [];
+ } elseif (array_key_exists('values', $node)) {
+ return $node['values'];
+ } elseif (array_key_exists('children', $node)) {
+ return array_map(function($c) {
+ return $c['id'];
+ }, $node['children']);
+ } else {
+ return [];
+ }
+ }
+
+ public static function prepareLanguages($languages) {
+
+ $resLanguage = [];
+ if(is_string($languages)) {
+ $languages = [ $languages, ];
+ }
+ foreach($languages as $lang) {
+ if($lang == config('corpusparole.language_corpus_node_global')) {
+ // ignore global
+ continue;
+ }
+ else if(Utils::startsWith($lang, config('corpusparole.lexvo_base_url'))) {
+ array_push($resLanguage, $lang);
+ } elseif(Utils::startsWith($lang, config('corpusparole.language_corpus_node_prefix'))) {
+ $resLanguage = array_merge($resLanguage, self::prepareLanguages(self::getLanguageNodeChildren($lang)));
+ } else {
+ array_push($resLanguage, config('corpusparole.lexvo_base_url').$lang);
+ }
+ }
+
+ return array_unique($resLanguage);
+ }
+
+ public static function getLanguagesFilterPart($languages) {
+ return [
+ 'bool' => [
+ 'should' => [
+ [ 'terms' => [ 'language' => $languages ]]
+ ]
+ ]
+ ];
+ }
+
+}
--- a/server/src/app/Libraries/Utils.php Thu Oct 13 13:01:12 2016 +0200
+++ b/server/src/app/Libraries/Utils.php Fri Oct 14 01:02:10 2016 +0200
@@ -134,4 +134,26 @@
return new Graph($graph1->getUri(), $merged, 'php');
}
+ /**
+ * From http://stackoverflow.com/a/834355
+ */
+ public static function startsWith($haystack, $needle)
+ {
+ $length = strlen($needle);
+ return (substr($haystack, 0, $length) === $needle);
+ }
+
+ /**
+ * From http://stackoverflow.com/a/834355
+ */
+ public static function endsWith($haystack, $needle)
+ {
+ $length = strlen($needle);
+ if ($length == 0) {
+ return true;
+ }
+
+ return (substr($haystack, -$length) === $needle);
+ }
+
}
--- a/server/src/app/Repositories/RdfDocumentRepository.php Thu Oct 13 13:01:12 2016 +0200
+++ b/server/src/app/Repositories/RdfDocumentRepository.php Fri Oct 14 01:02:10 2016 +0200
@@ -9,6 +9,7 @@
use CorpusParole\Libraries\CorpusParoleException;
use CorpusParole\Libraries\Utils;
use CorpusParole\Libraries\Sparql\SparqlClient;
+use CorpusParole\Libraries\Filters\CorpusFilterManager;
use CorpusParole\Services\LexvoResolverInterface;
@@ -151,13 +152,7 @@
if(is_string($languages)) {
$languages = [ $languages, ];
}
- $qFilterParts[] = [
- 'bool' => [
- 'should' => [
- [ 'terms' => [ 'language' => $languages ]]
- ]
- ]
- ];
+ $qFilterParts[] = CorpusFilterManager::getLanguagesFilterPart($languages);
}
$query = [
--- a/server/src/config/corpusparole.php Thu Oct 13 13:01:12 2016 +0200
+++ b/server/src/config/corpusparole.php Fri Oct 14 01:02:10 2016 +0200
@@ -197,6 +197,186 @@
'transcrit_decoder_mapping' => [
"http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_archive" => 'CorpusParole\Libraries\Transcript\LacitoTranscriptConverter',
"http://purl.org/poi/crdo.vjf.cnrs.fr/crdo-dtd_transcriber" => 'CorpusParole\Libraries\Transcript\TranscriberTranscriptConverter'
+ ],
+
+ "language_corpus_node_prefix" => 'corpus-',
+ "language_corpus_node_global" => 'corpus-global',
+
+ "languages_treemap" => [
+ 'id' => 'corpus-global',
+ 'name' => 'Global',
+ 'children' => [ [
+ 'id' => 'http://lexvo.org/id/iso639-3/fra',
+ 'name' => 'Français'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/gsw',
+ 'name' => 'Alsacien'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/bre',
+ 'name' => 'Breton'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/oci',
+ 'name' => 'Occitan',
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/lad',
+ 'name' => 'Judéo-espagnol'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/und',
+ 'name' => 'Indéterminée',
+ ], [
+ 'id' => 'corpus-regionals',
+ 'name' => 'Langues régionales',
+ 'children' => [ [
+ 'id' => 'corpus-oil',
+ 'name' => 'Langues d\'oïl',
+ 'values' => [ 'http://lexvo.org/id/iso639-3/pcd' ]
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/frp',
+ 'name' => 'Francoprovençal'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/cos',
+ 'name' => 'Corse'
+ ], [
+ 'id' => 'corpus-creoles',
+ 'name' => 'Les Créoles',
+ 'children' => [ [
+ 'id' => 'http://lexvo.org/id/iso639-3/rcf',
+ 'name' => 'Créole de la Réunion'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/gcf',
+ 'name' => 'Créole de la Guadeloupe'
+ ]
+ ]
+ ]
+ ]
+ ], [
+ 'id' => 'corpus-non-territorials',
+ 'name' => 'Langues non territoriales',
+ 'children' => [ [
+ 'id' => 'http://lexvo.org/id/iso639-3/fsl',
+ 'name' => 'Langue des signes française (LSF)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/kab',
+ 'name' => 'Berbère'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/ell',
+ 'name' => 'Grec moderne'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/spa',
+ 'name' => 'Espagnol'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/eng',
+ 'name' => 'Anglais'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/ita',
+ 'name' => 'Italien'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/deu',
+ 'name' => 'Allemand'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/tur',
+ 'name' => 'Turque'
+ ]
+ ]
+ ], [
+ 'id' => 'corpus-guyane',
+ 'name' => 'Guyane',
+ 'children' => [ [
+ 'id' => 'http://lexvo.org/id/iso639-3/gcf',
+ 'name' => 'Ndyuka-Trio Pidgin (njt)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/plu',
+ 'name' => 'Palikúr (plu)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/gcr',
+ 'name' => 'Guianese Creole French (gcr)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/gcr',
+ 'name' => 'Guianese Creole French (gcr)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/srn',
+ 'name' => 'Sranan Tongo (srn)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/car',
+ 'name' => 'kali\'na (car)'
+ ]
+ ]
+ ], [
+ 'id' => 'corpus-mayotte',
+ 'name' => 'Mayotte',
+ 'children' => [ [
+ 'id' => 'http://lexvo.org/id/iso639-3/swb',
+ 'name' => 'Maore Comorian (swb)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/lsy',
+ 'name' => 'Mauritian Sign Language (lsy)'
+ ]
+ ]
+ ], [
+ 'id' => 'corpus-polynesia',
+ 'name' => 'Polynésie française',
+ 'children' => [ [
+ 'id' => 'http://lexvo.org/id/iso639-3/uve',
+ 'name' => 'West Uvean (uve)'
+ ]
+ ]
+ ], [
+ 'id' => 'corpus-wallis-futuna',
+ 'name' => 'Wallis et Futuna',
+ 'children' => [ [
+ 'id' => 'http://lexvo.org/id/iso639-3/fud',
+ 'name' => 'LanEast Futuna (fud)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/wls',
+ 'name' => 'Wallisian (wls)'
+ ]
+ ]
+ ], [
+ 'id' => 'corpus-new-caledonia',
+ 'name' => 'Nouvelle-Calédonie',
+ 'children' => [ [
+ 'id' => 'http://lexvo.org/id/iso639-3/wls',
+ 'name' => 'Wallisian (wls)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/ane',
+ 'name' => 'Xârâcùù (ane)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/cam',
+ 'name' => 'Cemuhî (cam)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/axx',
+ 'name' => 'Xaragure (axx)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/iai',
+ 'name' => 'Iaai (iai)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/nee',
+ 'name' => 'Nêlêmwa-Nixumwak (nee)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/dhv',
+ 'name' => 'Dehu (dhv)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/nen',
+ 'name' => 'Nengone (nen)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/aji',
+ 'name' => 'Ajië (aji)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/kdk',
+ 'name' => 'Numee (kdk)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/nem',
+ 'name' => 'Nemi'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/nua',
+ 'name' => 'Yuaga (nua)'
+ ], [
+ 'id' => 'http://lexvo.org/id/iso639-3/bwa',
+ 'name' => 'Bwatoo (bwa)'
+ ]
+ ]
+ ]
+ ]
]
];
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/tests/Libraries/Filters/CorpusFilterManagerTest.php Fri Oct 14 01:02:10 2016 +0200
@@ -0,0 +1,73 @@
+<?php
+
+use CorpusParole\Libraries\Filters\CorpusFilterManager;
+
+class CorpusFilterManagerTest extends TestCase
+{
+ /**
+ * test prepare languages noop
+ *
+ * @return void
+ */
+ public function testPrepareLanguagesNoOp()
+ {
+ $languagesInput = ['http://lexvo.org/id/iso639-3/fra', 'http://lexvo.org/id/iso639-3/gsw', 'http://lexvo.org/id/iso639-3/bre', 'http://lexvo.org/id/iso639-3/oci'];
+ $languagesOutput = CorpusFilterManager::prepareLanguages($languagesInput);
+ $this->assertEquals($languagesOutput, $languagesInput);
+ }
+
+ /**
+ * test prepare languages addPrefix
+ *
+ * @return void
+ */
+ public function testPrepareLanguagesAddPrefix()
+ {
+ $languagesInput = ['fra', 'gsw', 'bre', 'oci'];
+ $languagesOutput = CorpusFilterManager::prepareLanguages($languagesInput);
+ $this->assertEquals($languagesOutput, ['http://lexvo.org/id/iso639-3/fra', 'http://lexvo.org/id/iso639-3/gsw', 'http://lexvo.org/id/iso639-3/bre', 'http://lexvo.org/id/iso639-3/oci']);
+ }
+
+ /**
+ * test prepare languages mix
+ *
+ * @return void
+ */
+ public function testPrepareLanguagesMix()
+ {
+ $languagesInput = ['fra', 'http://lexvo.org/id/iso639-3/gsw', 'bre', 'http://lexvo.org/id/iso639-3/oci'];
+ $languagesOutput = CorpusFilterManager::prepareLanguages($languagesInput);
+ $this->assertEquals($languagesOutput, ['http://lexvo.org/id/iso639-3/fra', 'http://lexvo.org/id/iso639-3/gsw', 'http://lexvo.org/id/iso639-3/bre', 'http://lexvo.org/id/iso639-3/oci']);
+ }
+
+ /**
+ * test prepare languages recursion simple
+ *
+ * @return void
+ */
+ public function testPrepareLanguagesRecusionSimple()
+ {
+ $languagesInput = ['http://lexvo.org/id/iso639-3/fra', 'http://lexvo.org/id/iso639-3/gsw', 'http://lexvo.org/id/iso639-3/bre', 'corpus-oil'];
+ $languagesOutput = CorpusFilterManager::prepareLanguages($languagesInput);
+ $this->assertEquals($languagesOutput, ['http://lexvo.org/id/iso639-3/fra', 'http://lexvo.org/id/iso639-3/gsw', 'http://lexvo.org/id/iso639-3/bre', 'http://lexvo.org/id/iso639-3/pcd']);
+ }
+
+ /**
+ * test prepare languages recursion simple
+ *
+ * @return void
+ */
+ public function testPrepareLanguagesRecusionComplex()
+ {
+ $languagesInput = ['fra', 'http://lexvo.org/id/iso639-3/gsw', 'corpus-oil', 'corpus-regional'];
+ $languagesOutput = CorpusFilterManager::prepareLanguages($languagesInput);
+ sort($languagesOutput);
+ $languagesExpected = ['http://lexvo.org/id/iso639-3/fra', 'http://lexvo.org/id/iso639-3/gsw', 'http://lexvo.org/id/iso639-3/pcd',
+ 'http://lexvo.org/id/iso639-3/frp', 'http://lexvo.org/id/iso639-3/cos', 'http://lexvo.org/id/iso639-3/rcf',
+ 'http://lexvo.org/id/iso639-3/gcf'];
+ sort($languagesExpected);
+ $this->assertEquals($languagesOutput, $languagesExpected);
+ }
+
+
+}