Class: Wikipedia::VandalismDetection::Text

Inherits:
String
  • Object
show all
Defined in:
lib/wikipedia/vandalism_detection/text.rb

Instance Method Summary collapse

Constructor Details

#initialize(text = "") ⇒ Text

Returns a new instance of Text.



7
8
9
# File 'lib/wikipedia/vandalism_detection/text.rb', line 7

def initialize(text = "")
  super text.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
end

Instance Method Details

#cleanObject

Extracts the plaintext from mediawiki markup and removes all line breaks & multiple spaces Return the cleaned plaintext.



13
14
15
# File 'lib/wikipedia/vandalism_detection/text.rb', line 13

def clean
  @clean ||= WikitextExtractor.extract_clean self
end