Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
4da9d343
Commit
4da9d343
authored
6 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
Added the Resultpage for associations
parent
03a7f340
Branches
Branches containing commit
No related tags found
1 merge request
!1308
Resolve "Redesign the Assoziator"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Http/Controllers/Assoziator.php
+19
-4
19 additions, 4 deletions
app/Http/Controllers/Assoziator.php
resources/views/assoziator/asso.blade.php
+29
-2
29 additions, 2 deletions
resources/views/assoziator/asso.blade.php
routes/web.php
+3
-2
3 additions, 2 deletions
routes/web.php
with
51 additions
and
8 deletions
app/Http/Controllers/Assoziator.php
+
19
−
4
View file @
4da9d343
...
...
@@ -13,7 +13,6 @@ class Assoziator extends Controller
return
redirect
(
LaravelLocalization
::
getLocalizedURL
(
LaravelLocalization
::
getCurrentLocale
(),
'/asso'
));
}
/*
$url
=
"https://metager.de/meta/meta.ger3?eingabe="
.
urlencode
(
$eingabe
)
.
"&out=atom10"
;
$ch
=
curl_init
();
...
...
@@ -41,12 +40,9 @@ class Assoziator extends Controller
if
(
$responseCode
!==
200
)
abort
(
500
,
"Server currently not available"
);
*/
$response
=
file_get_contents
(
storage_path
(
"app/public/results.xml"
));
$response
=
preg_replace
(
"/^<\?.*\?>/s"
,
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>"
,
$response
);
#die(var_dump($response));
$content
=
simplexml_load_string
(
$response
);
$words
=
[];
...
...
@@ -85,6 +81,8 @@ class Assoziator extends Controller
unset
(
$words
[
ucfirst
(
$eingabe
)]);
unset
(
$words
[
"de"
]);
unset
(
$words
[
"com"
]);
unset
(
$words
[
"wiki"
]);
unset
(
$words
[
"Wiki"
]);
// Remove Stopwords
$stopWords
=
file
(
storage_path
(
'app/public/stopwords.txt'
));
...
...
@@ -96,6 +94,23 @@ class Assoziator extends Controller
unset
(
$words
[
ucfirst
(
$stopWord
)]);
}
$wordCount
=
0
;
$i
=
1
;
$max
=
60
;
foreach
(
$words
as
$key
=>
$value
){
if
(
$i
>
$max
)
unset
(
$words
[
$key
]);
$wordCount
+=
$value
;
$i
++
;
}
return
view
(
'assoziator.asso'
)
->
with
(
'title'
,
trans
(
'titles.asso'
))
->
with
(
'navbarFocus'
,
'dienste'
)
->
with
(
'words'
,
$words
)
->
with
(
'keywords'
,
$eingabe
)
->
with
(
'wordCount'
,
$wordCount
);
die
(
var_dump
(
$words
));
}
...
...
This diff is collapsed.
Click to expand it.
resources/views/assoziator/asso.blade.php
+
29
−
2
View file @
4da9d343
...
...
@@ -12,11 +12,38 @@
<
div
class
=
"card-heavy"
>
<
p
>
{{
trans
(
'asso.1.1'
)
}}
<
a
href
=
"{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), '/') }}"
target
=
"_blank"
>
{{
trans
(
'asso.1.2'
)
}}
</
a
>.</
p
>
<
form
>
<
form
method
=
"post"
>
<
div
class
=
"input-group"
>
<
input
type
=
"text"
class
=
"form-control"
placeholder
=
"Zu assoziierender Begriff"
name
=
"q"
required
autofocus
/>
<
input
type
=
"text"
class
=
"form-control"
placeholder
=
"Zu assoziierender Begriff"
@
if
(
isset
(
$keywords
))
value
=
"
{
{$keywords}
}
"
@
endif
name
=
"q"
required
autofocus
/>
<
div
class
=
"input-group-addon"
><
button
type
=
"submit"
><
i
class
=
"fa fa-search"
aria
-
hidden
=
"true"
></
i
></
button
></
div
>
</
div
>
</
form
>
</
div
>
@
if
(
isset
(
$words
))
<
div
class
=
"card-heavy"
>
<
div
class
=
"table-responsive"
>
<
table
class
=
"table"
>
<
caption
>
Assoziationen
für
"{{
$keywords
}}"
</
caption
>
<
thead
>
<
tr
>
<
th
>
#</th>
<
th
>
Assoziation
</
th
>
<
th
>
Relevanz
</
th
>
</
tr
>
</
thead
>
<
tbody
>
@
php
$i
=
1
;
@
endphp
@
foreach
(
$words
as
$key
=>
$value
)
<
tr
>
<
td
>
{{
$i
}}
</
td
>
<
td
>
{{
$key
}}
</
td
>
<
td
>
{{
round
((
$value
/
$wordCount
)
*
100
,
2
)
}}
%</
td
>
@
php
$i
++
;
@
endphp
</
tr
>
@
endforeach
</
tbody
>
</
table
>
</
div
>
</
div
>
@
endif
@
endsection
This diff is collapsed.
Click to expand it.
routes/web.php
+
3
−
2
View file @
4da9d343
...
...
@@ -20,11 +20,12 @@ Route::group(
Route
::
get
(
'/'
,
'StartpageController@loadStartPage'
);
Route
::
get
(
'asso'
,
'Assoziator@asso'
/*
function(){
Route
::
get
(
'asso'
,
function
(){
return
view
(
'assoziator.asso'
)
->
with
(
'title'
,
trans
(
'titles.asso'
))
->
with
(
'navbarFocus'
,
'dienste'
);
}*/
);
});
Route
::
post
(
'asso'
,
'Assoziator@asso'
);
Route
::
get
(
'img/piwik.png'
,
'ImageController@generateImage'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment