RubyGems Navigation menu

koko_keywords 0.0.1

Koko Keyword Python Client ============ A ruby client for the [Koko Keywords API](https://r.kokocares.org/koko_keywords/docs). The client handles caching to ensure very low latency. ## Install ``` gem install koko_keywords ``` ## Usage Set the `KOKO_KEYWORDS_AUTH` environment to the authentication string provided by Koko (contact us at api@kokocares.org if you would like one). ``` export KOKO_KEYWORDS_AUTH=username:password ``` Require the gem or add it to you Bundle ```py require 'koko_keywords' ``` Then use the `match` function to check whether a query prompt matches a risky keyword ```py KokoKeywords.match("sewerslide") ``` There are two optional params, `filter` and `version`. ### Filter Filter the keyword based on the taxonomy using a colon delimited list of “dimension=value” filters. Omitting a dimension does not filter by that dimension e.g. ```py KokoKeywords.match("sewerslide", filter: "category=eating,parenting:confidence=1,2") ``` This matches "sewerslide" against eating eating and parenting, with a confidence of 1 and 2 and any intensity (as intensity was omitted). ### Version Use this to pin to a specific version of the regex otherwise the endpoint returns the latest. e.g. ```py KokoKeywords.match("sewerslide", version: "20220206") ``` ## Performance The underlying library is written in Rust and cross-compiled to the four major CPU targets. Regexes are cached based on the cache expiration headers (currently set to an hour). This ensures very low latency and overhead (< 1μs/req). ## Error Handling A RuntimeError will be raised with hints on how to resolve the issue. No exception handling should be necessary. ## Logging Minimal log messages are logged to STDERR ## License ``` WWWWWW||WWWWWW W W W||W W W || ( OO )__________ / | \ /o o| MIT \ \___/||_||__||_|| * || || || || _||_|| _||_|| (__|__|(__|__| ``` (The MIT License) Copyright (c) 2017 Koko AI Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Gemfile:
=

安装:
=

版本列表:

  1. 0.3.2 March 10, 2023 (7.8 MB)
  2. 0.3.1 November 01, 2022 (7.8 MB)
  3. 0.3.0 November 01, 2022 (7.9 MB)
  4. 0.2.0 April 21, 2022 (10.0 MB)
  5. 0.1.0 March 22, 2022 (12.4 MB)
  6. 0.0.1 March 18, 2022 (12.4 MB)
显示所有版本 (共 7 个)

Runtime 依赖 (1):

ffi ~> 1.15

Development 依赖 (3):

bundler < 2.4
rake < 13.1
rspec < 3.12

业主:

推送:

作者:

  • Kareem Kouddous

SHA 256 校验和:

=

下载总量 5,225

这个版本 853

版本发布:

许可:

MIT

需要的 Ruby 版本: >= 0

链接: