Class: Wikipedia::VandalismDetection::Text
- Inherits:
-
String
- Object
- String
- Wikipedia::VandalismDetection::Text
- Defined in:
- lib/wikipedia/vandalism_detection/text.rb
Instance Method Summary collapse
-
#clean ⇒ Object
Extracts the plaintext from mediawiki markup and removes all line breaks & multiple spaces Return the cleaned plaintext.
-
#initialize(text = "") ⇒ Text
constructor
A new instance of Text.
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
#clean ⇒ Object
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 |