View Source Wiki.Ores (mediawiki_client v0.4.2)

This module provides an adapter for the ORES scoring service.

examples

Examples

"enwiki"
|> Wiki.Ores.new()
|> Wiki.Ores.request!(
  models: ["damaging"],
  revids: 456789
)
# %{
#   "enwiki" => %{
#     "models" => %{
#       "damaging" => %{"version" => "0.5.1"}
#     },
#     "scores" => %{
#       "456789" => %{
#         "damaging" => %{
#           "score" => %{
#             "prediction" => false,
#             "probability" => %{
#               "false" => 0.9784615344695441,
#               "true" => 0.021538465530455946
#             }
#           }
#         }
#       }
#     }
#   }
# }

Link to this section Summary

Types

  • :adapter - Override the HTTP adapter
  • :debug - Turn on verbose logging by setting to true
  • :endpoint - Override the base URL to query
  • :user_agent - Override the user-agent header string

Functions

Create a new ORES client.

Make an ORES request.

Assertive variant of request.

Link to this section Types

@type client_option() ::
  {:adapter, module()}
  | {:debug, true}
  | {:endpoint, binary()}
  | {:user_agent, binary()}
@type client_options() :: [client_option()]
  • :adapter - Override the HTTP adapter
  • :debug - Turn on verbose logging by setting to true
  • :endpoint - Override the base URL to query
  • :user_agent - Override the user-agent header string

Link to this section Functions

Link to this function

new(project, opts \\ [])

View Source
@spec new(String.t(), client_options()) :: Tesla.Client.t()

Create a new ORES client.

arguments

Arguments

  • project - Short code for the wiki where your articles appear. For example, "enwiki" for English Wikipedia.
  • opts - Configuration options that can change client behavior

return-value

Return value

Returns an opaque client object, which should be passed to request/2.

@spec request(Tesla.Client.t(), keyword() | map()) :: {:ok, map()} | {:error, any()}

Make an ORES request.

Don't request scores for more than 50 revisions per request.

arguments

Arguments

  • client - Client object as returned by new/1.
  • params - Keyword list of query parameters,
    • :models - Learning models to query. These vary per wiki, see the support matrix for availability and to read about what each model is scoring. Multiple models can be passed as a list, for example, [:damaging, :wp10], or as a single atom, :damaging.
    • :revids - Revision IDs to score, as a single integer or as a list.
Link to this function

request!(client, params)

View Source
@spec request!(Tesla.Client.t(), keyword() | map()) :: map()

Assertive variant of request.