MCPcopy
hub / github.com/qeeqbox/social-analyzer / analyze_string

Function analyze_string

modules/string-analysis.js:78–140  ·  view source on GitHub ↗
(req, all_words)

Source from the content-addressed store, hash-verified

76}
77
78async function analyze_string (req, all_words) {
79 helper.log_to_file_queue(req.body.uuid, '[Starting] String analysis')
80 let temp_rr_names = []
81 const string_to_check = req.body.string
82 helper.parsed_json.prefix.forEach(function (item, index) {
83 if (string_to_check.indexOf(item) === 0 && !all_words.prefix.includes(item)) {
84 all_words.prefix.push(item)
85 const temp = remove_word(string_to_check, item)
86 if (temp !== null && temp !== '' && !all_words.unknown.includes(temp) && !all_words.maybe.includes(temp) && temp.length > 1) {
87 all_words.unknown.push(temp)
88 }
89 }
90 })
91 helper.parsed_json.m_names.forEach(function (item, index) {
92 if (string_to_check.indexOf(item) >= 0 && !all_words.name.includes(item)) {
93 all_words.name.push(item)
94 const temp = remove_word(string_to_check, item)
95 if (temp !== null && temp !== '' && !all_words.unknown.includes(temp) && !all_words.maybe.includes(temp) && temp.length > 1) {
96 all_words.unknown.push(temp)
97 }
98 }
99 })
100 helper.parsed_json.f_names.forEach(function (item, index) {
101 if (string_to_check.indexOf(item) >= 0 && !all_words.name.includes(item)) {
102 all_words.name.push(item)
103 const temp = remove_word(string_to_check, item)
104 if (temp !== null && temp !== '' && !all_words.unknown.includes(temp) && !all_words.maybe.includes(temp) && temp.length > 1) {
105 all_words.unknown.push(temp)
106 }
107 }
108 })
109
110 all_words.prefix.forEach(function (h_item, index) {
111 all_words.unknown.forEach(function (r_item, index) {
112 if (r_item.indexOf(h_item) === 0) {
113 const temp = remove_word(r_item, h_item)
114 if (temp !== null && temp !== '' && !temp_rr_names.includes(temp) && !all_words.maybe.includes(temp) && temp.length > 1) {
115 temp_rr_names.push(temp)
116 }
117 }
118 })
119 })
120
121 let temp_r_concat = all_words.unknown.concat(temp_rr_names.filter((item) => all_words.unknown.indexOf(item) < 0))
122
123 all_words.unknown = temp_r_concat
124 temp_rr_names = []
125
126 all_words.number.forEach(function (n_item, index) {
127 all_words.unknown.forEach(function (r_item, index) {
128 if (r_item.indexOf(n_item) >= 0) {
129 const temp = remove_word(r_item, n_item)
130 if (temp !== null && temp !== '' && !temp_rr_names.includes(temp) && !all_words.maybe.includes(temp) && temp.length > 1) {
131 temp_rr_names.push(temp)
132 }
133 }
134 })
135 })

Callers

nothing calls this directly

Calls 1

remove_wordFunction · 0.85

Tested by

no test coverage detected