5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/automated_metareview/text_quantity.rb', line 5
def number_of_unique_tokens(text_array)
pre_string = "" count = 0 instance = WordnetBasedSimilarity.new
text_array.each{
|text|
tp = TextPreprocessing.new
text = tp.contains_punct(text)
all_tokens = text.split(" ")
all_tokens.each{
|token|
if(!instance.is_frequent_word(token.downcase)) if(!pre_string.downcase.include?(token.downcase)) count+=1
end
end
pre_string = pre_string +" " + token.downcase }
}
return count
end
|