Norming
Interact with the norming endpoint.
norming(name=None, text=None, options=None, delete=False, name_only=False, dotenv=True, key=os.getenv('RECEPTIVITI_KEY', ''), secret=os.getenv('RECEPTIVITI_SECRET', ''), url=os.getenv('RECEPTIVITI_URL', ''), verbose=True, **kwargs)
View or Establish Custom Norming Contexts.
Custom norming contexts can be used to process later texts by specifying the
custom_context
API argument in the receptiviti.request
function (e.g.,
receptiviti.request("text to score", version = "v2", options = {"custom_context": "norm_name"})
,
where norm_name
is the name you set here).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name of a new norming context, to be established from the provided 'text'. Not providing a name will list the previously created contexts. |
None
|
text |
str
|
Text to be processed and used as the custom norming context. Not providing text will return the status of the named norming context. |
None
|
options |
dict
|
Options to set for the norming context (e.g.,
|
None
|
delete |
bool
|
If |
False
|
name_only |
bool
|
If |
False
|
dotenv |
bool | str
|
Path to a .env file to read environment variables from. By default,
will for a file in the current directory or |
True
|
key |
str
|
Your API key. |
getenv('RECEPTIVITI_KEY', '')
|
secret |
str
|
Your API secret. |
getenv('RECEPTIVITI_SECRET', '')
|
url |
str
|
The URL of the API; defaults to |
getenv('RECEPTIVITI_URL', '')
|
verbose |
bool
|
If |
True
|
**kwargs |
Any
|
Additional arguments to specify how tests are read in and processed; see receptiviti.request. |
{}
|
Returns:
Type | Description |
---|---|
Union[None, list[str], DataFrame, Series, dict[str, Union[Series, DataFrame, None]]]
|
Nothing if |
Union[None, list[str], DataFrame, Series, dict[str, Union[Series, DataFrame, None]]]
|
If |
Union[None, list[str], DataFrame, Series, dict[str, Union[Series, DataFrame, None]]]
|
Otherwise, either a
|
Examples:
# list all available contexts:
receptiviti.norming()
# list current custom contexts:
receptiviti.norming()
# create or get the status of a single context:
receptiviti.norming("new_context")
Send tests to establish the context, just like the receptiviti.request function.
## such as directly:
receptiviti.norming("new_context", ["text to send", "another text"])
## or from a file:
receptiviti.norming("new_context", "./path/to/file.csv", text_column = "text")
## delete the new context:
receptiviti.norming("new_context", delete=True)
Source code in src\receptiviti\norming.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
|