A policy: what the source is judged against, declared once in a module.
defmodule MyApp.Riddles do
use Cite.Policy
concern :riddle do
detect do
question "Does {passage} pose a riddle?"
yes "A question asked to be puzzled over."
no "A plain question, a statement, or a remark."
end
end
end
Declarations: filter, concern (with category, detect, confirm,
role, check), factor, score, choice. Every mistake is a compile
error. Writing policies explains the language;
the reference below, generated from the DSL, lists every declaration's
arguments, options, and defaults (required ones starred).
policy
What the source is judged against.
Nested DSLs
policy.filter
filter name
A yes/no question every evidence passage must pass.
Nested DSLs
Arguments
| Name | Type | Default | Docs |
|---|
name | atom | | The name. |
Options
| Name | Type | Default | Docs |
|---|
question | String.t | | The question, naming what it reads by placeholder. |
focus | String.t | | One line on what to attend to. |
policy.filter.yes
yes what \\ nil
What makes the answer yes: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.filter.no
no what \\ nil
What makes the answer no: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.concern
concern name
One kind of thing you want found: screened directly, or built from factors.
Nested DSLs
Arguments
| Name | Type | Default | Docs |
|---|
name | atom | | The name. |
Options
| Name | Type | Default | Docs |
|---|
category | atom | | What the finding is reported as. |
policy.concern.detect
The concern's round-1 question, asked of every passage.
Nested DSLs
Options
| Name | Type | Default | Docs |
|---|
question | String.t | | The question, naming what it reads by placeholder. |
focus | String.t | | One line on what to attend to. |
policy.concern.detect.yes
yes what \\ nil
What makes the answer yes: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.concern.detect.no
no what \\ nil
What makes the answer no: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.concern.confirm
The concern's round-2 question, deciding which matched passages are cited.
Nested DSLs
Options
| Name | Type | Default | Docs |
|---|
question | String.t | | The question, naming what it reads by placeholder. |
focus | String.t | | One line on what to attend to. |
policy.concern.confirm.yes
yes what \\ nil
What makes the answer yes: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.concern.confirm.no
no what \\ nil
What makes the answer no: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.concern.role
role name
A role in a concern built from factors, filled by a factor's strongest match.
Arguments
| Name | Type | Default | Docs |
|---|
name | atom | | The name. |
Options
| Name | Type | Default | Docs |
|---|
factor | atom | | The factor that fills the role. |
optional | boolean | false | The finding may stand without it. |
distinct | boolean | false | It must be a passage no other role holds. |
policy.concern.check
check name
A yes/no question across a concern's roles that decides whether it holds.
Nested DSLs
Arguments
| Name | Type | Default | Docs |
|---|
name | atom | | The name. |
Options
| Name | Type | Default | Docs |
|---|
question | String.t | | The question, naming what it reads by placeholder. |
focus | String.t | | One line on what to attend to. |
distinct | boolean | false | Ask only when the named roles are different passages. |
policy.concern.check.yes
yes what \\ nil
What makes the answer yes: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.concern.check.no
no what \\ nil
What makes the answer no: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.factor
factor name
A yes/no question that fills a role in a concern built from factors.
Nested DSLs
Arguments
| Name | Type | Default | Docs |
|---|
name | atom | | The name. |
Options
| Name | Type | Default | Docs |
|---|
question | String.t | | The question, naming what it reads by placeholder. |
focus | String.t | | One line on what to attend to. |
policy.factor.yes
yes what \\ nil
What makes the answer yes: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.factor.no
no what \\ nil
What makes the answer no: a string, or a block with what, not_for, examples.
Arguments
| Name | Type | Default | Docs |
|---|
what | String.t | | What qualifies for this side. |
Options
| Name | Type | Default | Docs |
|---|
not_for | String.t | | What a reading of what might wrongly include. |
examples | list(String.t) | | Short phrasings that qualify. |
policy.score
score name
A descriptor that places each finding on ordered levels.
Arguments
| Name | Type | Default | Docs |
|---|
name | atom | | The name. |
Options
| Name | Type | Default | Docs |
|---|
question | String.t | | The question, naming what it reads by placeholder. |
levels | list(String.t) | | The levels, lowest first. |
focus | String.t | | One line on what to attend to. |
policy.choice
choice name
A descriptor that picks one option for each finding.
Nested DSLs
Arguments
| Name | Type | Default | Docs |
|---|
name | atom | | The name. |
Options
| Name | Type | Default | Docs |
|---|
question | String.t | | The question, naming what it reads by placeholder. |
focus | String.t | | One line on what to attend to. |
policy.choice.option
option key, description
One option of a Choice.
Arguments
| Name | Type | Default | Docs |
|---|
key | atom | | The option's key. |
description | String.t | | What the option means. |
Options
:extensions (list of module that adopts Spark.Dsl.Extension) - A list of DSL extensions to add to the Spark.Dsl
:otp_app (atom/0) - The otp_app to use for any application configurable options
:fragments (list of module/0) - Fragments to include in the Spark.Dsl. See the fragments guide for more.