Module: MediaWiktory::Wikipedia::Modules::Contenttranslationcorpora

Defined in:
lib/mediawiktory/wikipedia/modules/contenttranslationcorpora.rb

Overview

Get the section-aligned parallel text for a given translation. See also list=cxpublishedtranslations. Dumps are provided in different formats for high volume access.

The "submodule" (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for Actions::Query and its submodules):

api.query             # returns Actions::Query
   .prop(:revisions)  # adds prop=revisions to action URL, and includes Modules::Revisions into action
   .limit(10)         # method of Modules::Revisions, adds rvlimit=10 to URL

All submodule's parameters are documented as its public methods, see below.

Instance Method Summary collapse

Instance Method Details

#striphtmlself

Whether to strip all HTML tags to return plaintext.

Returns:

  • (self)


32
33
34
# File 'lib/mediawiktory/wikipedia/modules/contenttranslationcorpora.rb', line 32

def striphtml()
  merge(striphtml: 'true')
end

#translationid(value) ⇒ self

ID of the translation.

Parameters:

  • value (Integer)

Returns:

  • (self)


25
26
27
# File 'lib/mediawiktory/wikipedia/modules/contenttranslationcorpora.rb', line 25

def translationid(value)
  merge(translationid: value.to_s)
end

#types(*values) ⇒ self

By default you will get all three of following if available: source text, machine translation and the postedited translation by the user. This parameter allows you not return some of these types.

Parameters:

  • values (Array<String>)

    Allowed values: "source", "mt", "user".

Returns:

  • (self)


40
41
42
# File 'lib/mediawiktory/wikipedia/modules/contenttranslationcorpora.rb', line 40

def types(*values)
  values.inject(self) { |res, val| res._types(val) or fail ArgumentError, "Unknown value for types: #{val}" }
end