class ContactDetective::Utils
Public Class Methods
getnumeric(string)
click to toggle source
# File lib/ContactDetective.rb, line 125 def self.getnumeric(string) string.scan(/[0-9]+/) end
getwords(text)
click to toggle source
# File lib/ContactDetective.rb, line 117 def self.getwords(text) words = text.scan(/ ([a-zA-Z]+) /) filtered = [] words.each {|elem| filtered << elem[0]} end
makeregex(string)
click to toggle source
# File lib/ContactDetective.rb, line 122 def self.makeregex(string) Regexp.new(string) end
onlybrackets(text)
click to toggle source
# File lib/ContactDetective.rb, line 102 def self.onlybrackets(text) text.scan(/<[^<>]+>/) end
removebrackets(text)
click to toggle source
# File lib/ContactDetective.rb, line 99 def self.removebrackets(text) text.split(/<[^<>]+>/) end
replacebrackets(text)
click to toggle source
# File lib/ContactDetective.rb, line 105 def self.replacebrackets(text) text.gsub(/<[^<>]+>/, "") end
sentfragments(text)
click to toggle source
# File lib/ContactDetective.rb, line 108 def self.sentfragments(text) wordfrags = [] text.split(/<[^<>]+>/).each do |elem| if elem =~ /^[a-zA-Z]+ [a-zA-Z]*$/ wordfrags << elem end end return wordfrags end
Public Instance Methods
makeJSON(hashobj)
click to toggle source
# File lib/ContactDetective.rb, line 128 def makeJSON(hashobj) require 'json' hashobj.to_json end