suggest-keywords 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a0f08b406f266c0a6e1129d794bd3d792263f54b01089e1862185e494019a0e8
4
+ data.tar.gz: 6ad8ab027a4fadeaf4f9f6165906101a2484eb73c2725432e03ad215571e6064
5
+ SHA512:
6
+ metadata.gz: 8d61382d28d58c7b8c011edb5815c913982eaaf370353ffeca8b0a6127abb186d58d363bc41e08cc61db3d9cd4446744d8884ff1a6b00e6bf001c2768599311b
7
+ data.tar.gz: 2c63ff15280ecf23c036be391fbf74c4c20dc726e0fd6dd2ef9d571c92dde992893b93f4bf060146b9787f032e96a5dff7d46593190e7bcbc69496347d3bf581
data/README ADDED
File without changes
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ require 'suggest-keywords'
3
+
4
+ if ARGV[0].is_a?(String) && ARGV[1].nil?
5
+ puts SuggestKeywords.scan(ARGV[0])
6
+ else
7
+ if !ARGV[1].nil?
8
+ #abort "Please enter just one parameter (put the text between commas)."
9
+ raise "Please enter just one parameter (put the text between commas)."
10
+ exit 1
11
+ elsif
12
+ !ARGV[0].is_a?(String)
13
+ #abort "Please enter a string paramter (put the text between commas)."
14
+ raise "Please enter a string parameter (put the text between commas)."
15
+ exit 1
16
+ end
17
+ end
18
+
19
+
@@ -0,0 +1,127 @@
1
+ class SuggestKeywords
2
+
3
+ KEYWORDS = [
4
+ ['acceptance', @group4, /accept\w{0,4}|regret\w{0,4}/i],
5
+ ['addiction', @group1, /(alcoholism|alcoholic)|drinks?\s(every|all)\s(day|night|afternoon)|\burge\b|addict\w{0,3}/i, @group1],
6
+ ['aging', @group1, /accept\s(aging|(my|his|her)\s(new\s)?age)|get\w{0,4}\sold|turning\s\d\d\b/i],
7
+ ['alienation',@group3, /alienation/i],
8
+ ['amnesia', @group1, /amnesia|los\w{1,3}\s(my|her|his|of)\smemor\w{1,3}|memory\sloss/i],
9
+ ['anxiety', @group1, /anxi\w{3}|overthink\w{0,3}|panic(\s|-)attacks?/i],
10
+ ['apathy', @group3, /\bapath\w{1,5}|love\sme\sanymore|no\sfeelings/i],
11
+ ['approval', @group2, /accept(ing)?|(they|she|he)\s(will|can)\slike\sme|approval|bless\w{0,3}/i],
12
+ ['assault', @group3, /beat\w{0,3}|assault\w{0,3}|slam\w{0,3}|kick\w{0,3}|punch\w{0,3}|chok\w{0,3}/i],
13
+ ['assertion', @group2, /(be\s)?assert\w{0,3}|that\si\s(don't|do\snot)\swan(t|na)|how\sto\s(say|speak|tell|comunicate|approach)/i],
14
+ ['attraction', @group2, /(talk\w{0,3}\s(with|to)\s|approach\w{0,3}\s)(a\s)?(girl|boy|(wo)?man|chick)|ask\w{0,3}\s(me|her|him)\sout|ha(s|ve)\sa\scrush|flirt\w{0,3}|attract\w{0,3}/i],
15
+ ['blackmail', @group3, /threat\w{0,6}|(forc\w{1,3}|\bmak\w{1,3})\sme|black(\s|-)mail\w{0,3}/i],
16
+ ['breakup', @group2, /\bdump\w{0,3}\s(me|her|him)|(break\w{0,3}\-?|broke)\s?up/i],
17
+ ['business', @group5, /^(?!mind)(my|our|his|her|their)\s(business|company|startup)/i],
18
+ ['career', @group5, /career|aptitude|directions?|major\w{0,3}|course/i],
19
+ ['cheating', @group3, /cheat\w{0,3}|unfaithful|secret\w{0,2}\smessag\w{1,3}|messages\sin\ssecret|sexting|adultery/i],
20
+ ['children', @group2, /children|\bson\b|daughter|bab(y|ies)/i],
21
+ ['college', @group5, /college|university|student\sloans?|(my|get\sa)\smajor\w{0,3}(?!\scrush|\sdebt)|sophomore|drop\w{0,3}\sout|freshmen|academic\sadvisers?|professor/i],
22
+ ['conflict', @group3, /\bargu\w{1,4}|fight\s{0,3}|conflict\w{0,3}|friction|disagreement/i],
23
+ ['dating', @group2, /\bdat\w{1,3}|dating|older\sthan\s(me|i)|go\w{0,3}\sout\swith|out\sof\smy\sleague/i],
24
+ ['depression', @group4, /depress\w{2,3}|do(\snot|n't)\sfeel\spassionate|(i\s(am\s(worthless|garbage))|(wish\si\swas\sdead)|(might\saswell\sbe\sdead)|(look\w{0,3}\s(un)?happy)|(feel\sexhaust\w{2,3})|(suck\sat\severything))|(motivation|reason)\sto\s(keep)?\s?liv\w{1,3}|joy\sanymore|los\w{1,3}\smotivation|no\sresilience|not\seating|have\sno\sfriends|liv\w{1,3}\slike\sthis|lost\sin\slife|end\s(my|his|her)\slife|(motivation|reason)\sto\sget\sout\sof\sbed|i\s(just\s)?hate\smyself/i],
25
+ ['disappearance', @group3, /disappear\w{0,5}|(gone|is)\smissing|find\s(him|her)|nowhere\sto\sbe\sfound/i],
26
+ ['dismissal', @group5, /fire(d|\sme)|resign\w{0,5}|dismiss\w{0,3}|demission|expel\w{0,4}/i],
27
+ ['drop out', @group5, /drop\w{0,4}\sout|quit(ting)?\s(college|school)|giv(e|ing)\sup\son\s(my\scourse|college)/i],
28
+ ['drugs', @group1, /drugs?|alcohol|marijuana|\bpot\b|weed\b|hashish|cannabis|heroin|opium|cocaine|amphetamine|\bmeth(amphetamine)?|ecstasy|mdma|lsd|acid|steroids?/i],
29
+ ['elder abuse', @group3, /a^/],
30
+ ['estranged', @group2, /estranged?|no\slonger\s(likes?|loves?)\sme|(likes?|loves?)\sme\sanymore/i],
31
+ ['eviction', @group3, /evict\w{0,3}|kicked(-|\s)out|expulsion|expel\w{0,3}/i],
32
+ ['exercise', @group1, /work\w{0,3}-?out|exercis\w{1,3}|fitness/i],
33
+ ['financial abuse', @group3, /abus\w{1,3}|leech\w{0,3}|parasit\w{1,3}|rip\w{0,3}-off|exploit\w{0,6}/i],
34
+ ['fixation', @group2, /fixat\w{2,3}|obsess\w{2,3}|cling\w{1,3}|attached|\bsmother\w{0,3}/i],
35
+ ['focus', @group5, /(can't|los\w{1,3})\sfocus|concentrat\w{1,3}|attention/i],
36
+ ['ghosting', @group2, /ghosting|ignoring\sme|no(t)?\s(respon\w{0,4}|answer\w{0,3})|\bavoid(ing)?|(won't|didn't|not)\sreply\w{0,3}|stopped\s(talking|speaking)/i],
37
+ ['grades',@group5, /grades?|\bGPA\b|fail\w{0,3}\sclass/i],
38
+ ['grief', @group4, /(deal\w{0,3}|handl\w{1,3}\s|process\w{0,3}\s)?(with\s)?(the\s)?(loss|death)(\sof\smy)|(mo(ther|m)|dad|(girl|boy)?friend|father|he|her)\s((just\s)?died|is\sdead)|lost\s(his|her|my|our)\s(mo(m|ther)|dad|father|brother|sister|grand(pa|ma|mother|father)|uncle|aunt|pet|dog|cat|(girl|boy)?friend)|is\sdying|pass\w{0,3}\saway|grie(f|ving)/i],
39
+ ['harassment', @group3, /(get\w{0,3}|got)?\s?(physical\w{1,2}|emocional\w{1,2})?\s?(abus\w{1,3}|threat\w{0,6}|accus\w{1,4}|bull(y\w{0,3}|ied)|harass\w{0,3})|knows\smy\sadress|forc\w{1,3}|uncomfortabl(e|y)|scar(ed|y)|curs\w{1,3}/i],
40
+ ['homeschooling', @group5, /homeschool\w{0,3}/i],
41
+ ['hygiene', @group1, /odour|smells?|stinks?|breath\b/i],
42
+ ['illegal', @group3, /illegal|\bcrimes?\b|agaisnt\sthe\slaw/i],
43
+ ['illness', @group1, /\bill\w{0,4}\b|vac(cines?|cination|cinated|\b)|diseases?|tumor|cancer|chemio\w{0,7}|constantly\ssick|(heart|kidneys?|liver|lungs?)\sproblem|\bill\w{0,4}|skin\sspots?|\bitchy?\b|\b(head)?ach(e|ing)|fever/i],
44
+ ['injury', @group1, /injur\w{1,3}|bleed\w{0,3}|wound\w{0,2}|bruises?|\bcut(ting)?\b|spine|\bnose\b|elbow|shoulder|wrist|knee/i],
45
+ ['inheritance', @group3, /inheritance|heritage|bequest|birthright/i],
46
+ ['insalubrity', @group5, /chemicals?|radiation|radioactive|hazard\w{0,3}|safety|carcinogenic|toxic|syringes?|fumes|smoke/i],
47
+ ['insurance', @group3, /insurance|\bcover\w{0,3}|protection|security/i],
48
+ ['intoxication', @group1, /intoxicat\w{2,3}|poison\w{0,3}|nausea|vomit\w{0,3}|throw\w{0,3}\sup|diarrhea/i],
49
+ ['jail', @group3, /jail|prison|sentenced|arrested/i],
50
+ ['job-hunt', @group5, /interview\w{0,2}|(get\w{0,4}\sa\s|look\w{0,3}\sfor\sa\s|offer\w{2,3}\sa\s|land\w{0,3}\s(my\sfirst\s|a\s)|dream\s|new\s)job|job\soffers?/i],
51
+ ['landlord', @group2, /land(\s|-)(lord|holder|ownder)|laird|proprietor|slumlord/i],
52
+ ['loan', @group3, /loan\w{0,3}|(borrow\w{0,3}|lend\w{0,3}|owes\sme)\s(money|cash)|my\smoney|funding/i],
53
+ ['loneliness', @group4, /isolated|so\salone|((no|\bany)|mak\w{1,3})\sfriends|(feel\s)?lonel(y|iness)/i],
54
+ ['love', @group2, /love(\swith?)\s(him|her)|(s?he)(\sis\s|'\s)the\sone|in\slove|hav\w{1,3}\sfeelings|friendzoned?|i\slike\s(him|her)|crush\b/i],
55
+ ['low cash', @group3, /short\son\s|\bbills|\brent\b|(no|without|zero)\s(cash|money)|broke(?!\sup)|ends\smeet/i],
56
+ ['marriage', @group2, /marr\w{1,4}/i],
57
+ ['mental disorders', @group1, /\bmental\w{0,2}\b|schizophreni(c|a)|asperger|autis\w{1,3}|attention\sdeficit\s(hyperactivity\s)?(disorder)?|adhd|agoraphobia|dementia|I('m|\sam)\slosing\s(it|my\s(mind|head))/i],
58
+ ['missing out', @group2, /miss\w{0,3}\sout/i],
59
+ ['motivation', @group4, /motivat\w{0,3}/i],
60
+ ['moving out', @group3, /mov\w{1,3}\s(back|out|(in)?to)|(liv\w{1,3}|leav\w{0,3})\s(with\s(me|us)|(in\s)?(my|our)\s(house|apartment|country))/i],
61
+ ['narcissism', @group2, /narcissis\w{1,3}|ego\w{0,7}|complain\w{0,3}/i],
62
+ ['neglect', @group3, /ne@group3, gl\w{0,5}|disregard\w{0,3}|omiss\w{0,3}/i],
63
+ ['neighborhood', @group2, /neighbor\w{0,4}|i'?m?\sliv\w{1,3}\snext/i],
64
+ ['nostalgia', @group4, /nostalg\w{1,2}|(wan((t\sto)|na)\sgo\sback\sto\sthe|miss\sthe)\s(past|old\sdays)/i],
65
+ ['outfit', @group2, /out-?fit|(what\sto|how\sshould\si)\sdress|what\s(should\si|to)\swear/i],
66
+ ['overweight', @group1, /over(\s|-)weight|fat\b|obes\w{1,3}|chubby/i],
67
+ ['parents-in-law', @group2, /(mother|father|parents|sister|brother)(-|\s)in(-|\s)law|(girl|boy)friend's\s((father|dad)|(mo(m|ther)|(sister)|(brother)))/i],
68
+ ['pet', @group2, /(our|my)\s(new\s)?(cat|dog|fish)|animal/i],
69
+ ['pregnancy', @group1, /pregnan\w{1,2}|in\slabor|having\s(a\s)?(bab\w{1,3}|twins)|first\s(baby|child|son|daughter)/i],
70
+ ['productivity', @group5, /productiv\w{1,3}/i],
71
+ ['racism', @group3, /racis\w{1,3}|race|skin\s(color|tone)|(color|tone)\sof\s(my|her|his)\sskin/i],
72
+ ['remote-relationship', @group2, /(long\sdistance|remote)\srelationship/i],
73
+ ['reputation', @group2, /reputation|status|(see\w{0,3}\s|think\w{0,3}\s(of\s)?)me\sas|\btag\w{0,4}|\bembarrass\w{2,4}|\ba?sham\w{1,3}/i],
74
+ ['resignation', @group5, /resign\w{0,5}|quit\w{0,4}\s(the|my)\sjob|ren(ounces?|unciation)/i],
75
+ ['scam', @group3, /scam\w{0,3}/i],
76
+ ['school', @group5, /(3, high)?(middle)?(home)?\s?-?school(work)?/i],
77
+ ['self-discovery', @group4, /i\sdon't\sknow\swho\si\sam|belong\w{0,3}\s(some|any)where|(((lack|ausence|absence)\sof\s)|(no)\s)personality|empty\s(shell|inside)/i],
78
+ ['self-esteem', @group4, /self(\s|-)esteem|worthless/i],
79
+ ['sensitive', @group4, /sensitive/i],
80
+ ['sex', @group2, /(genitalia|dick|penis|cock|pussy|vagina|clitoris|hymen)\s?(hygiene|smells)?|smells\sdownstairs|(anal)?\s?sex(ual)?\s?(addict\w{0,3})?|mak{1,3}\sout|touch\w{0,3}\s(him|her|my)self|turn\w{0,3}\s(me\s|him\s|her\s)?on|dominant\w{0,3}\spartner/i],
81
+ ['sexual assault', @group3, /\brap(ed?|ist|ing)|(un-?)?consensual\s(pic\w{0,5}|photos?)|soaked\spanties|sexual\sassault\w{0,3}|\bmolest\w{0,3}/i],
82
+ ['sexual orientation', @group2, /(stuck\sin|com\w{1,3}\sout\of)\sthe\scloset|gay|(homo|bi)sexual|(my|his|her)\ssexuality/i],
83
+ ['slander', @group3, /defamation|\bslander\b|\blibel\b|\bli(es?|ying)|gossip\{0,3}|false\w{0,2}\s\baccus\w{2,6}/i],
84
+ ['sleep', @group1, /(can't|cannot|trouble)\ssleep\w{0,3}(-?(walk\w{1,3})?)|insomnia|^(?!his|hers?|theirs?)dream\w{0,3}|^(?!worse\s)nightmares?/i],
85
+ ['social anxiety', @group2, /awkward\ssilence|((add\s(on\s)?to\s(the\s))|((hold\w{0,3}\s(a\s)?)|(maintain\w{0,3}\s(\sa\s)?)))(talk|conversation)|i\sjust\s(sit|stay)\sthere\s(quietly|in\ssilence)|don't\stalk\smuch\sat|\btalk\w{0,3}\s(normally|like\s(a\s)?normal\s(people|person))|((scared|terrified)\sof|thought\sof\smeeting(\swith)?)\s(other\s)?people|talk\w{0,3}\sto\speople|sociable|social(\s|-)anxiety|introvert/i],
86
+ ['stalking', @group3, /stalk\w{0,3}|follow\w{0,3}\sme/i],
87
+ ['stealing', @group3, /steal\w{0,3}|sto(len|rmed)|(robb|mugg)ed|br[e|o]a?k\w{1,3}\sinto|ransack\w{0,3}/i],
88
+ ['stress', @group4, /^(?!di)stress\w{0,3}(?!\srelief)/i],
89
+ ['street fight', @group3, /street\s(fight\w{0,3}|brawl\w{0,3})|fight\w{0,3}\son\s(the\s)?streets?/i],
90
+ ['student debt', @group5, /students?\sdebts?|\btuitions?\b|pay\w{0,3}\s(for\s)?college/i],
91
+ ['studies', @group5, /stud(y|ies)|math(ematics)?|chemistry|\balgebra\b|geo(metry|graphy)|physics|biology|\blearn\w{0,3}/i],
92
+ ['suicide', @group4, /(commit\w{0,3}|attempt\w{0,3}|fee?l\w{0,3})?\s?suicid\w{0,3}(\sattempt)?|(kill\w{0,3}|shoo?t\w{0,3}|h[ua]ng\w{0,3})\s\w{2,3}self|((end\s(this|my))|((took|tak\w{1,3})\s(his|her)\s(own)?))\slife/i],
93
+ ['surgery', @group1, /surger\w{1,3}|implants|nosejob|rhinoplasty|liposuction|facelift|transplant/i],
94
+ ['time off', @group5, /(time|lay|day)(-|\s)off|vacation/i],
95
+ ['tiredness', @group1, /tired|lazy|(no|lack\sof)\senergy/i],
96
+ ['traffic accident', @group3, /^(?!life\s)insurance|(car|motorcycle)\s(accident|crash)|bumpers?|brakes|head(light|lamp)s?|grille/i],
97
+ ['trust', @group2, /trust\w{0,3}/i],
98
+ ['underweight', @group1, /under(\s|-)weight|anorex\w{0,3}|\bthin\b|skinny/i],
99
+ ['unkissed', @group2, /unkissed/i],
100
+ ['virginity', @group2, /virgin\w{0,3}/i],
101
+ ['wedding', @group2, /wedding/i],
102
+ ['work environment', @group5, /(co)?-?\s?workers?|work(-|\s)?(friend)|friend\sat\swork|manager|boss\b|shift\b|(\bhr\b)?human\s?-?resources|employe(e|r)|intern(ship)?\b/i],
103
+ ]
104
+
105
+ def self.scan()
106
+ #text = text.gsub(/[()]/, "")
107
+ text = "Oh my god my cousin literally just killed himself. Idk what to do I'm cryin so much rn, he didn't look sad recently no one would say that he was suicidal. Idk how to deal with this loss."
108
+ key_words = []
109
+ string_matches = []
110
+ KEYWORDS.each do |key|
111
+ if key[2].match?(text)
112
+ key_words << key[0]
113
+ string_matches << key[2].match(text)
114
+ end
115
+
116
+ end
117
+
118
+ print "suggest keywords = #{key_words} \n\n"
119
+ print "parts of the text matched for each keyword, in order: \n \n"
120
+ string_matches.each do |key|
121
+ puts key
122
+ end
123
+ print "\n"
124
+ end
125
+ end
126
+
127
+ SuggestKeywords.scan
File without changes
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: suggest-keywords
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Hiago Serpa
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-06-10 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Suggest Keywords - Gives possible keywords/tags from a text input.
14
+ email: hiago_s93@hotmail.com
15
+ executables:
16
+ - suggest-keywords
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - README
21
+ - bin/suggest-keywords
22
+ - lib/suggest-keywords.rb
23
+ - spec/suggest-keywords_spec.rb
24
+ homepage: https://rubygems.org/gems/suggest-keywords
25
+ licenses:
26
+ - MIT
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubygems_version: 3.0.3
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Suggest Keywords - Gives possible keywords/tags from a text input.
47
+ test_files: []