ezii 0.0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/eezee-3-aka-game-x-engine.zip +0 -0
- data/eezee-3-aka-game-x-engine/README.md +5 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/functions/base_command.rb +20 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/functions/mouse_y_axis_to_3d_z_axis.rb +4 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/functions/rotate_camera_axis_using_mouse_drag.rb +37 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/functions/selection_cube.rb +35 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/gam.rb +467 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/gems.locked +77 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/gems.rb +10 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/lib/drb_server.rb +13 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/lib/mittsu_monkeypatches/box_geometry.rb +5 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/runnable.rb +9 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/shapes/cube.rb +33 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/sig/runable.rbi +9 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test.sh +5 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/commands/test_selection_cube.rb +31 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_command_remapping.rb +30 -0
- data/eezee-3-aka-game-x-engine/managables/programs/game_aided_manufacturing/test/test_helper.rb +75 -0
- data/eezee-3-aka-game-x-engine/managables/services/chat-bot-integrations/chat.txt +15 -0
- data/eezee-3-aka-game-x-engine/managables/services/chat-bot-integrations/chatbot.rb +718 -0
- data/eezee-3-aka-game-x-engine/managables/services/chat-bot-integrations/gems.locked +50 -0
- data/eezee-3-aka-game-x-engine/managables/services/chat-bot-integrations/gems.rb +13 -0
- data/eezee-3-aka-game-x-engine/managables/services/chat-bot-integrations/setup-mac-os-x.sh +0 -0
- data/eezee-3-aka-game-x-engine/managables/services/chat-bot-integrations/setup.sh +1 -0
- data/eezee-3-aka-game-x-engine/managables/services/chat-bot-integrations/start.sh +3 -0
- data/eezee-3-aka-game-x-engine/managables/services/error-inspect/simplest-log +1 -0
- data/eezee-3-aka-game-x-engine/managables/services/error-inspect/simplest-log-init +1 -0
- data/eezee-3-aka-game-x-engine/managables/services/livestream-interactive/Twitch.Tv/gems.locked +17 -0
- data/eezee-3-aka-game-x-engine/managables/services/livestream-interactive/Twitch.Tv/gems.rb +5 -0
- data/eezee-3-aka-game-x-engine/managables/services/livestream-interactive/Twitch.Tv/twitch_zircon.rb +112 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/README.md +3 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/functions/__main__.js +58 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/functions/black-out-random-word.js +74 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/functions/random-sentence.js +57 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/functions/random-wikipedia-page.js +25 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/functions/random-words.js +34 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/functions/rare-enough-word.js +41 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/functions/wikipedia-page.js +35 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/package.json +20 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/statistics/count-word.js +12 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/utils/log-to-natural-database.js +10 -0
- data/eezee-3-aka-game-x-engine/managables/services/stdlib-dot-com/koma/qanda-api@dev/word2vec-models/test-text8-vector.bin +0 -0
- data/eezee-3-aka-game-x-engine/managament_interface/gems.locked +13 -0
- data/eezee-3-aka-game-x-engine/managament_interface/gems.rb +3 -0
- data/eezee-3-aka-game-x-engine/managament_interface/management_interface +4 -0
- data/eezee-3-aka-game-x-engine/managament_interface/runnable.rb +30 -0
- data/eezee-3-aka-game-x-engine/start.sh +2 -0
- data/ezii.gemspec +1 -1
- metadata +49 -3
@@ -0,0 +1,50 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
brainz (0.2.0)
|
5
|
+
byebug (11.0.1)
|
6
|
+
colorize (0.8.1)
|
7
|
+
faraday (0.15.4)
|
8
|
+
multipart-post (>= 1.2, < 3)
|
9
|
+
gyazo (3.0.1)
|
10
|
+
faraday
|
11
|
+
mime-types
|
12
|
+
multipart-post
|
13
|
+
mime-types (3.2.2)
|
14
|
+
mime-types-data (~> 3.2015)
|
15
|
+
mime-types-data (3.2019.0331)
|
16
|
+
mini_portile2 (2.4.0)
|
17
|
+
multipart-post (2.1.1)
|
18
|
+
mustermann (1.0.3)
|
19
|
+
nokogiri (1.10.4)
|
20
|
+
mini_portile2 (~> 2.4.0)
|
21
|
+
open4 (1.3.4)
|
22
|
+
rack (2.0.7)
|
23
|
+
rack-protection (2.0.5)
|
24
|
+
rack
|
25
|
+
sinatra (2.0.5)
|
26
|
+
mustermann (~> 1.0)
|
27
|
+
rack (~> 2.0)
|
28
|
+
rack-protection (= 2.0.5)
|
29
|
+
tilt (~> 2.0)
|
30
|
+
tilt (2.0.9)
|
31
|
+
wit (6.0.0)
|
32
|
+
zircon (0.0.8)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
brainz
|
39
|
+
bundler
|
40
|
+
byebug
|
41
|
+
colorize
|
42
|
+
gyazo
|
43
|
+
nokogiri (>= 1.10.4)
|
44
|
+
open4
|
45
|
+
sinatra
|
46
|
+
wit
|
47
|
+
zircon
|
48
|
+
|
49
|
+
BUNDLED WITH
|
50
|
+
2.1.0.pre.1
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
mkdir ~/gam-git-repos
|
@@ -0,0 +1 @@
|
|
1
|
+
tail -f /var/log/gam.stderr
|
@@ -0,0 +1 @@
|
|
1
|
+
sudo touch /var/log/gam.stderr
|
data/eezee-3-aka-game-x-engine/managables/services/livestream-interactive/Twitch.Tv/twitch_zircon.rb
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'zircon'
|
2
|
+
require 'colorize'
|
3
|
+
require 'byebug'
|
4
|
+
|
5
|
+
LOG_FILE = File.open('chat.txt', 'w')
|
6
|
+
COMMANDS_HELP = <<-TWITCH_CHAT_MESSAGE
|
7
|
+
Write "hack" and move the mouse courser to the top left corner of the screen
|
8
|
+
|
9
|
+
move plane
|
10
|
+
|
11
|
+
Move the plane in the 3d gam
|
12
|
+
|
13
|
+
key press (a-z,0-9) i.e. "key press m"
|
14
|
+
|
15
|
+
Press any letter or number key
|
16
|
+
|
17
|
+
open gam
|
18
|
+
|
19
|
+
Open the 3d cad-like gam
|
20
|
+
|
21
|
+
bundle install
|
22
|
+
|
23
|
+
Update ruby gems for the gam
|
24
|
+
TWITCH_CHAT_MESSAGE
|
25
|
+
|
26
|
+
def start
|
27
|
+
client = Zircon.new(
|
28
|
+
server: 'irc.twitch.tv',
|
29
|
+
port: '6667',
|
30
|
+
channel: '#lemonandroid',
|
31
|
+
username: 'lemonandroid',
|
32
|
+
password: ENV["TWITCH_OAUTH_TOKEN"]
|
33
|
+
)
|
34
|
+
|
35
|
+
removed_colors = [:black, :white, :light_black, :light_white]
|
36
|
+
colors = String.colors - removed_colors
|
37
|
+
|
38
|
+
client.on_message do |message|
|
39
|
+
puts ">>> #{message.from}: #{message.body}".colorize(colors.sample)
|
40
|
+
LOG_FILE.write(message.body.to_s + "\n")
|
41
|
+
|
42
|
+
|
43
|
+
if message.body.to_s =~ /!commands/
|
44
|
+
client.privmsg("#lemonandroid", "https://twitter.com/LemonAndroid/status/1128262053880377345")
|
45
|
+
end
|
46
|
+
|
47
|
+
if message.body.to_s =~ /hack/
|
48
|
+
`cliclick m:100,100`
|
49
|
+
end
|
50
|
+
|
51
|
+
if message.body.to_s =~ /open gam/
|
52
|
+
`ruby /Users/lemonandroid/one/game/ruby/runnable.rb &`
|
53
|
+
end
|
54
|
+
|
55
|
+
if message.body.to_s =~ /bundle install/
|
56
|
+
`cd /Users/lemonandroid/one/game/ruby && bundle install &`
|
57
|
+
end
|
58
|
+
|
59
|
+
if message.body.to_s =~ /move plane/
|
60
|
+
`
|
61
|
+
osascript -e 'tell application "System Events" to tell process "ruby"
|
62
|
+
set frontmost to true
|
63
|
+
|
64
|
+
key down "a"
|
65
|
+
delay 1
|
66
|
+
key up "a"
|
67
|
+
end tell'
|
68
|
+
`
|
69
|
+
end
|
70
|
+
|
71
|
+
if message.body.to_s =~ /([a-d])/
|
72
|
+
client.privmsg("#lemonandroid", "Logged #{$1} in")
|
73
|
+
|
74
|
+
`osascript -e 'tell application \"System Events\" to tell process \"Google Chrome\"
|
75
|
+
set frontmost to true
|
76
|
+
keystroke \"#{$1}\"
|
77
|
+
end tell'`
|
78
|
+
end
|
79
|
+
|
80
|
+
if message.body.to_s =~ /key press (\w)(?:\s*(\d+)x)?/
|
81
|
+
if $2
|
82
|
+
`osascript -e 'tell application \"System Events\" to tell process "ruby"
|
83
|
+
set frontmost to true
|
84
|
+
|
85
|
+
repeat #{$2} times
|
86
|
+
keystroke \"#{$1}\"
|
87
|
+
end repeat
|
88
|
+
end tell'`
|
89
|
+
else
|
90
|
+
`osascript -e 'tell application \"System Events\" to tell process "ruby"
|
91
|
+
set frontmost to true
|
92
|
+
|
93
|
+
keystroke \"#{$1}\"
|
94
|
+
end tell'`
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
client.run!
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
def error_catching_restart_loop
|
104
|
+
start()
|
105
|
+
rescue => e
|
106
|
+
error_catching_restart_loop()
|
107
|
+
LOG_FILE.write(e.message)
|
108
|
+
end
|
109
|
+
|
110
|
+
error_catching_restart_loop()
|
111
|
+
|
112
|
+
LOG_FILE.close
|
@@ -0,0 +1,58 @@
|
|
1
|
+
const lib = require('lib');
|
2
|
+
const _ = require('underscore');
|
3
|
+
// const countWord = require('../statistics/count-word.js');
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Qanda question endpoint.
|
7
|
+
* @returns {object}
|
8
|
+
*/
|
9
|
+
module.exports = async (language = "en", source="wikipedia", context) => {
|
10
|
+
let randomSentenceResponse = await randomSentenceErrorProne(language, source, context);
|
11
|
+
|
12
|
+
let blackedOutDict = await lib[`${context.service.identifier}.black-out-random-word`]({sentence: randomSentenceResponse.rs.result});
|
13
|
+
let randomWordsFromArticle = await lib[`${context.service.identifier}.random-words`]({
|
14
|
+
similarTo: blackedOutDict.termNormal
|
15
|
+
});
|
16
|
+
|
17
|
+
let choices = [];
|
18
|
+
|
19
|
+
_.each(randomWordsFromArticle, (randomWord) => {
|
20
|
+
choices.push({correctAnswer: false, word: randomWord.word});
|
21
|
+
});
|
22
|
+
|
23
|
+
choices.push({correctAnswer: true, word: blackedOutDict.blackedOutWord});
|
24
|
+
|
25
|
+
choices = _.shuffle(choices);
|
26
|
+
|
27
|
+
let response = {
|
28
|
+
articleTitle: randomSentenceResponse.p.title,
|
29
|
+
wikipediaId: randomSentenceResponse.p.wikipediaId,
|
30
|
+
sentence: blackedOutDict,
|
31
|
+
choices: choices,
|
32
|
+
surroundingSentences: randomSentenceResponse.rs.surroundingSentences
|
33
|
+
};
|
34
|
+
|
35
|
+
return response;
|
36
|
+
}
|
37
|
+
|
38
|
+
async function randomSentenceErrorProne(language, source, context) {
|
39
|
+
var text;
|
40
|
+
var page;
|
41
|
+
if (source === 'wikipedia') {
|
42
|
+
page = await lib[`${context.service.identifier}.random-wikipedia-page`]({language: language});
|
43
|
+
text = page.text;
|
44
|
+
} else {
|
45
|
+
page = {title: "Random texts from scan functionality (earliest alpha lel)"}
|
46
|
+
const ocrQuery = lib.koma['ocr-query']['@dev'];
|
47
|
+
|
48
|
+
text = await ocrQuery['random-ocr-text']();
|
49
|
+
}
|
50
|
+
|
51
|
+
let randomSentence = await lib[`${context.service.identifier}.random-sentence`]({text: text});
|
52
|
+
|
53
|
+
if(randomSentence.error === true) {
|
54
|
+
return randomSentenceErrorProne(language, source, context);
|
55
|
+
} else {
|
56
|
+
return {p: page, rs: randomSentence};
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
const _ = require('underscore');
|
2
|
+
const nlp = require('compromise');
|
3
|
+
const lib = require('lib');
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Black out a random word in a sentence.
|
7
|
+
* @returns {object}
|
8
|
+
*/
|
9
|
+
module.exports = async (sentence = "", context) => {
|
10
|
+
let sentenceTerms = nlp(sentence).out('terms');
|
11
|
+
|
12
|
+
let sentenceDict = {
|
13
|
+
before: "",
|
14
|
+
blackedOutWord: undefined,
|
15
|
+
after: ""
|
16
|
+
};
|
17
|
+
|
18
|
+
sentenceTerms = _.filter(sentenceTerms, (term) => {
|
19
|
+
return term.normal !== "";
|
20
|
+
});
|
21
|
+
|
22
|
+
|
23
|
+
var nounIndices = [];
|
24
|
+
for(i = 0; i < sentenceTerms.length; i++) {
|
25
|
+
let term = sentenceTerms[i];
|
26
|
+
let isNoun = _.includes(term.tags, 'Noun');
|
27
|
+
let isLongerThan2Chars = term.normal.length > 2;
|
28
|
+
|
29
|
+
if(isNoun && isLongerThan2Chars) {
|
30
|
+
nounIndices.push(i);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
console.log(nounIndices);
|
35
|
+
|
36
|
+
|
37
|
+
let blackedOutIndex = _.sample(nounIndices);
|
38
|
+
|
39
|
+
console.log(blackedOutIndex);
|
40
|
+
|
41
|
+
_.each(sentenceTerms, (term, index)=> {
|
42
|
+
if(index < blackedOutIndex) {
|
43
|
+
sentenceDict.before += term.text;
|
44
|
+
|
45
|
+
if(index !== (blackedOutIndex - 1)) {
|
46
|
+
sentenceDict.before += " ";
|
47
|
+
}
|
48
|
+
} else if(index > blackedOutIndex) {
|
49
|
+
sentenceDict.after += term.text;
|
50
|
+
|
51
|
+
if((sentenceTerms.length - 1) !== index) {
|
52
|
+
sentenceDict.after += " ";
|
53
|
+
}
|
54
|
+
} else if(index === blackedOutIndex) {
|
55
|
+
var termText = term.text;
|
56
|
+
|
57
|
+
let specialCharsCharacterClass = '[,\\.\\?!()\\-\\–\/"\\s;:*]';
|
58
|
+
let nonWordCharsRegex = new RegExp(`^(${specialCharsCharacterClass}*)(.+?)(${specialCharsCharacterClass}*)$`);
|
59
|
+
let matchResult = nonWordCharsRegex.exec(termText);
|
60
|
+
|
61
|
+
sentenceDict.termNormal = term.normal;
|
62
|
+
sentenceDict.tags = term.tags;
|
63
|
+
sentenceDict.before += matchResult[1];
|
64
|
+
sentenceDict.blackedOutWord = matchResult[2];
|
65
|
+
sentenceDict.after += matchResult[3];
|
66
|
+
}
|
67
|
+
});
|
68
|
+
|
69
|
+
return sentenceDict;
|
70
|
+
};
|
71
|
+
|
72
|
+
function getRandomInt(min, max) {
|
73
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
74
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
const nlp = require('compromise');
|
2
|
+
const _ = require('underscore');
|
3
|
+
const lib = require('lib');
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Get a random sentence from provided text.
|
7
|
+
* @returns {object}
|
8
|
+
*/
|
9
|
+
module.exports = async (text = "", wikiPediaPageId=0, context) => {
|
10
|
+
if(wikiPediaPageId !== 0) {
|
11
|
+
page = await lib[`${context.service.identifier}.random-wikipedia-page`]({pageIds: [wikiPediaPageId]});
|
12
|
+
text = page.text;
|
13
|
+
}
|
14
|
+
|
15
|
+
var sentencesDoc = nlp(text, {allowedTags: []}).sentences();
|
16
|
+
|
17
|
+
sentences = sentencesDoc.list.map(ts => {
|
18
|
+
return ts.terms.map(t =>{
|
19
|
+
return t.text
|
20
|
+
});
|
21
|
+
});
|
22
|
+
|
23
|
+
if(sentences.length === 0) {
|
24
|
+
return {error: true, message: 'No sentences found'};
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
function calculateRandomIndex(items) {
|
29
|
+
return Math.floor(Math.random()*items.length)
|
30
|
+
}
|
31
|
+
|
32
|
+
let randomIndex = calculateRandomIndex(sentences);
|
33
|
+
let sentence = sentences[randomIndex]
|
34
|
+
let tries = 0;
|
35
|
+
while(sentence.length < 5 && tries < 5) {
|
36
|
+
randomIndex = calculateRandomIndex(sentences);
|
37
|
+
sentence = sentences[randomIndex]
|
38
|
+
tries++;
|
39
|
+
}
|
40
|
+
|
41
|
+
if(sentence.length < 5) {
|
42
|
+
return {error: true, message: 'No sentence with more than 5 words found'};
|
43
|
+
}
|
44
|
+
|
45
|
+
let sentencesBefore = [sentences[randomIndex-1].join(' ')];
|
46
|
+
let sentencesAfter = [sentences[randomIndex+1].join(' ')];
|
47
|
+
|
48
|
+
joinedSentence = sentence.join(' ');
|
49
|
+
return {
|
50
|
+
error: false,
|
51
|
+
result: joinedSentence,
|
52
|
+
surroundingSentences: {
|
53
|
+
before: sentencesBefore,
|
54
|
+
after: sentencesAfter
|
55
|
+
}
|
56
|
+
};
|
57
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
const axios = require('axios');
|
2
|
+
const _ = require('underscore');
|
3
|
+
const sanitizeHtml = require('sanitize-html');
|
4
|
+
const decodeHtml = require('decode-html');
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Random wikipedia article contents
|
8
|
+
* @returns {object}
|
9
|
+
*/
|
10
|
+
module.exports = async (language = 'en') => {
|
11
|
+
var apiResponse = await axios.get(randomWikipediaArticleApiEndpoint(language));
|
12
|
+
var page = _.values(apiResponse.data['query']['pages'])[0];
|
13
|
+
var response = {};
|
14
|
+
|
15
|
+
response['text'] = decodeHtml(sanitizeHtml(page['extract'], {allowedTags: []}));
|
16
|
+
response['title'] = page['title'];
|
17
|
+
response['wikipediaId'] = page['pageid'];
|
18
|
+
|
19
|
+
return response;
|
20
|
+
};
|
21
|
+
|
22
|
+
function randomWikipediaArticleApiEndpoint(language) {
|
23
|
+
return `https://${language}.wikipedia.org/w/api.php?format=json&action=query&generator=random&grnnamespace=0&prop=extracts&grnlimit=1`;
|
24
|
+
//return `https://en.wikipedia.org/w/api.php?format=json&action=query&titles=World_history&grnnamespace=0&prop=extracts&grnlimit=1`;
|
25
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
const _ = require('underscore');
|
2
|
+
const nlp = require('compromise');
|
3
|
+
const w2v = require("word2vec-pure-js")
|
4
|
+
w2v.load("./word2vec-models/test-text8-vector.bin")
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Get random words form the provided text.
|
8
|
+
* @returns {array}
|
9
|
+
*/
|
10
|
+
module.exports = async (numberOfWords = 3, similarTo = "") => {
|
11
|
+
let relatedTerms = _.shuffle(w2v.getSimilarWords(similarTo, numberOfWords ** 2));
|
12
|
+
|
13
|
+
let terms = nlp(relatedTerms.join(" ")).out("terms");
|
14
|
+
|
15
|
+
terms = _.uniq(terms, 'normal');
|
16
|
+
|
17
|
+
terms = _.filter(terms, function(term) {
|
18
|
+
return _.contains(term.tags, 'Noun');
|
19
|
+
});
|
20
|
+
|
21
|
+
let relatedTermsEnrichedByCompromiseNlp = [];
|
22
|
+
for(i=0;i<numberOfWords;i++) {
|
23
|
+
let randIndex = Math.floor(Math.random()*terms.length);
|
24
|
+
relatedTermsEnrichedByCompromiseNlp.push(terms[randIndex]);
|
25
|
+
terms.splice(randIndex, 1);
|
26
|
+
}
|
27
|
+
|
28
|
+
|
29
|
+
let randomWords = _.map(relatedTermsEnrichedByCompromiseNlp, (term, index)=> {
|
30
|
+
return {word: term.text, termNormal: term.normal};
|
31
|
+
});
|
32
|
+
|
33
|
+
return randomWords;
|
34
|
+
};
|