-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.php
64 lines (54 loc) · 1.6 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* @file
* Demonstration file of using the Lemmatizer library.
*/
require './vendor/autoload.php';
use writecrow\Lemmatizer\Lemmatizer;
$text = 'leaves';
if (isset($_POST['text'])) {
$text = $_POST['text'];
}
$lemma = 'leaf';
if (isset($_POST['lemma'])) {
$lemma = $_POST['lemma'];
}
echo '<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
</head>
<body>';
echo '
<div class="container">
<div class="row">
<div class="six twelve columns">
<span><h3>PHP Lemmatizer</h3>(Non part-of-speech)</span><span class="u-pull-right">Source code: <a href="https://github.com/writecrow/lemmatizer">https://github.com/writecrow/lemmatizer</a></span><hr />
</div>
</div>
<form action="//' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '" method="POST">
<div class="row">
<div class="six columns">
<label for="text">Word to be lemmatized</label>
<input name="text" value="' . $text . '">
<input type="submit" value="Lemmatize" />';
$text = Lemmatizer::getLemma($text);
echo '<div><pre><code>';
echo $text;
echo '</code></pre></div>';
echo '</div>
<div class="six columns">
<label for="lemma">Get words from lemma</label>
<input name="lemma" value="' . $lemma . '">
<input type="submit" value="Get words from Lemma" />';
$words = Lemmatizer::getWordsFromLemma($lemma);
echo '<div><pre><code>';
echo $words;
echo '</code></pre></div>';
echo '
</div>
</div>
</form>
</div>
</body>
</html>';