View Source Wiki.Ores (mediawiki_client v0.3.1)

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

Functions

Create a new ORES client.

Assertive variant of request.

Make an ORES request.

Link to this section Functions

@spec new(String.t()) :: 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.

return-value

Return value

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

Link to this function

request!(client, params)

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

Assertive variant of request.

@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.