You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gets the "complete thought" from a verb and a noun using Moby Thesaurus
5
+
6
+
7
+
## What does it do?
8
+
- It uses the Moby Thesaurus to get the "complete thought" from a verb and a noun.
9
+
- This is meant for Natural Language Processing (NLP) tasks.
10
+
11
+
How does it work?
12
+
- The code looks for "complete thoughts", see the link to Wikipedia here:
13
+
```
14
+
https://simple.wikipedia.org/wiki/Simple_sentence
15
+
```
16
+
17
+
- First: open the index.php, a form will appear.
18
+
- Second: enter a verb, like "walk", "talk" or "run". It is best to user the base form or lemma. So do not use "running", but use "run". This program can be used to get the lemma for you:
## Can I use a different set of words (=thesaurus)?
64
+
Yes. This script uses the Moby Thesaurus that is based on the English language from 1996. It doesn't have many modern words. You can change the Thesaurus by using an API.
65
+
However, this is not programmed yet. To make it happen, there needs to be an API connection. Also the existing Synonym function needs to be re-written to use this API.
66
+
I want to write a script to use the Urban Dictionary API. This would make it talk "urban". Here is an example on how to connect:
$partThoughtText[] = array('Partial matched text<br />( this matches only part of the thought,<br /> it is not always correct)' => $nounValue, 'Based on thought' => $verbValue);
<li class="list-group-item">Try <b>verb ="work" </b> and <b>noun = "job"</b>. The result will be thoughts that have to do with working on a job, like "achievement", "assignment" and "labor"</li>
137
+
<li class="list-group-item">Try <b>verb ="write"</b> and <b>noun = "document</b>". It will find thoughts like "copy", "draft" and "file" and "print"</li>
138
+
</ul>
139
+
140
+
<h3>How does it work?</h3>
141
+
<ul class="list-group">
142
+
<li class="list-group-item">The code looks for "complete thoughts", see the link to Wikipedia here:<br />
143
+
<a href="https://simple.wikipedia.org/wiki/Simple_sentence">We need at least one verb and one noun together for a complete thought</a></li>
144
+
<li class="list-group-item">First enter a verb, like "walk", "talk", "run". It is best to user the base form or lemma. So do not use "running", but use "run". This program can be used to get the lemma for you:
<li class="list-group-item">Second, enter a noun like "dog", "cat", "house" or "car".</li>
148
+
<li class="list-group-item">Finally, press Submit, wait for the result. The result may take up to 2 seconds.</li>
149
+
</ul>
150
+
<h3>What can I do with the result?</h3>
151
+
<ul class="list-group">
152
+
<li class="list-group-item">First, you can use it in spam killers: if there are related words in a text, the text is probably not fake.</li>
153
+
<li class="list-group-item">Second: you can use this for creating reports and understanding text.</li>
154
+
<li class="list-group-item">Third: this could be used as suggestions in search engines.</li>
155
+
</ul>
156
+
<h3>I would like to use a different set of words (=thesaurus). Can I do that?</h3>
157
+
<ul class="list-group">
158
+
<li class="list-group-item">Yes. This script uses the Moby Thesaurus that is based on the English language from 1996. It doesn't have many modern words. You can change the Thesaurus by using an API.
159
+
However, this is not programmed yet. To make it happen, there needs to be an API connection. Also the existing Synonym function needs to be re-written to use this API.</li>
160
+
<li class="list-group-item">I want to write a script to use the Urban Dictionary API. This would make it talk "urban". Here is an example on how to connect:<br />
161
+
<a href="https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation">Example of the Urban Dictionary API on Github</a></li>
162
+
<li class="list-group-item">Or you could use any other "Thesaurus" API</li>
163
+
</ul>
164
+
<h3>Please be patient when submitting: the script can take a few seconds</h3>
165
+
<ul class="list-group">
166
+
<li class="list-group-item">The code needs to search the whole Moby Thesaurus, this can take a few seconds.
167
+
This class will probably be a lot faster by using SQL instead of files. However, there is no SQL file of the thesaurus available yet.</li>
168
+
</ul>
169
+
<!-- END HELP -->
170
+
171
+
172
+
<?php
173
+
} else {
174
+
?>
175
+
176
+
<table class="table table-bordered">
177
+
<th colspan="3"><h3>
178
+
Verb = "<?phpecho$verb?>",
179
+
noun = "<?phpecho$noun?>"</h3></th>
180
+
<tr>
181
+
<td>
182
+
<?php
183
+
$template = newTemplate();
184
+
if(!empty($thoughtMatches)){
185
+
$template->getTable($thoughtMatches, '');
186
+
} else {
187
+
$template->getTable(array(), '', 'No thought matches found');
188
+
}
189
+
?>
190
+
</td>
191
+
<td>
192
+
<?php
193
+
$template = newTemplate();
194
+
if(!empty($fullThoughtText)){
195
+
$template->getTable($fullThoughtText, '');
196
+
} else {
197
+
$template->getTable(array(), '', 'No thought text was found');
198
+
}
199
+
?>
200
+
</td>
201
+
<td>
202
+
<?php
203
+
$template = newTemplate();
204
+
if(!empty($partThoughtText)){
205
+
$template->getTable($partThoughtText, '');
206
+
} else {
207
+
$template->getTable(array(), '', 'No partial thought text found');
0 commit comments