-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.js
More file actions
72 lines (65 loc) · 1.48 KB
/
interface.js
File metadata and controls
72 lines (65 loc) · 1.48 KB
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
65
66
67
68
69
70
71
var exports = module.exports = {};
var core = require('./core');
exports.getSynonyms = function(word, callback) {
core.getWordRelation(word,'synonym', function(err, response){
if (err) {
console.log(' Synonyms : Error occured');
return;
}
if (response && response[0]) {
var list = response[0].words
for(i in list){
console.log(' Synonym : ' + list[i]);
}
} else {
console.log(' Synonyms : Nothing found');
}
});
}
exports.getAntonyms = function(word) {
core.getWordRelation(word,'antonym', function(err, response){
if (err) {
console.log(' Antonyms : Error occured');
return;
}
if (response && response[0]) {
var list = response[0].words
for(i in list){
console.log(' Antonym : ' + list[i]);
}
} else {
console.log('Antonyms : Nothing found');
}
});
}
exports.getDefinition = function (word) {
core.getWordDef(word, function(err, response) {
if (err) {
console.log(' Meaning : Error occured');
return;
}
if (response) {
for (i in response){
console.log(' Meaning : ' + response[i].text);
}
} else {
console.log('Meaning : Nothing found');
}
});
}
exports.getExamples = function(word) {
core.getWordExample(word, function(err, response) {
if (err) {
console.log(' Examples : Error occured');
return;
}
if (response) {
var list = response.examples
for (i in list) {
console.log(' Examples : ' + list[i].text);
}
} else {
console.log(' Examples : Nothing found');
}
});
}