View Source Wiki.Ores (mediawiki_client v0.4.8)
This module provides an adapter for the ORES scoring service.
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
# }
# }
# }
# }
# }
# }
# }
Summary
Types
:adapter
- Override the HTTP adapter:debug
- Turn on verbose logging by setting totrue
:endpoint
- Override the base URL to query:user_agent
- Override the user-agent header string
Types
@type client_options() :: [client_option()]
:adapter
- Override the HTTP adapter:debug
- Turn on verbose logging by setting totrue
:endpoint
- Override the base URL to query:user_agent
- Override the user-agent header string
Functions
@spec new(String.t(), client_options()) :: Tesla.Client.t()
Create a new ORES client.
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
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
client
- Client object as returned bynew/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.
@spec request!(Tesla.Client.t(), keyword() | map()) :: map()
Assertive variant of request
.