Module: CodeModels::Ruby::InfoExtraction
- Defined in:
- lib/codemodels/ruby/info_extraction.rb
Defined Under Namespace
Classes: RubySpecificInfoExtractionLogic
Class Method Summary
collapse
Class Method Details
.id_to_words(id) ⇒ Object
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
|
# File 'lib/codemodels/ruby/info_extraction.rb', line 12
def self.id_to_words(id)
return [''] if id==''
while id.start_with?'_' id = id[1..-1]
end
number_index = id.index /[0-9]/
if number_index
if number_index==0
words_before = []
else
id_before = id[0..number_index-1]
words_before = id_to_words(id_before)
end
id_from = id[number_index..-1]
has_other_after = id_from.index /[^0-9]/
if has_other_after
number_word = id_from[0..has_other_after-1]
id_after = id_from[has_other_after..-1]
words_after = id_to_words(id_after)
else
number_word = id_from
words_after = []
end
words = words_before
words = words + id.split(/[_!?=]/)
words = words + words_after
words
else
id.split /[_!?=]/
end
end
|
.is_id_str(s) ⇒ Object
8
9
10
|
# File 'lib/codemodels/ruby/info_extraction.rb', line 8
def self.is_id_str(s)
(not s.index /[^A-Za-z0-9_!?=]/) && (s.index /[A-Za-z]/)
end
|
.terms_map(model_node, context = nil) ⇒ Object
81
82
83
|
# File 'lib/codemodels/ruby/info_extraction.rb', line 81
def self.terms_map(model_node,context=nil)
CodeModels::InfoExtraction.terms_map(RubySpecificInfoExtractionLogic.new,model_node,context)
end
|