Skip to main content

Python bindings for Kusai

Project description

Kusai

Building

git clone https://codeberg.org/kasefuchs/kusai.git
mkdir cmake-build && cd cmake-build
cmake ..
cmake --build .

Install to systyem with

cmake --build . --target install

Using

CMake

find_package(kusai REQUIRED)
target_link_libraries(<your-target> kusai::textchain)

Or FetchContent version

include(FetchContent)
FetchContent_Declare(kusai
    GIT_REPOSITORY https://codeberg.org/kasefuchs/kusai.git
    GIT_TAG <tag>
)
FetchContent_MakeAvailable(kusai)
target_link_libraries(<your-target> kusai::textchain)

Hello World

#include <kusai/graph/MemoryGraph.hpp>
#include <kusai/markov/SimpleMarkov.hpp>
#include <kusai/tokenizer/SimpleTokenizer.hpp>
#include <kusai/textchain/TextChain.hpp>

int main() {
  const auto graph = std::make_shared<kusai::MemoryGraph>();
  const auto markov = std::make_shared<kusai::SimpleMarkov>(graph);
  const auto tokenizer = std::make_shared<kusai::SimpleTokenizer>();
  const auto chain = std::make_shared<kusai::TextChain>(markov, tokenizer);

  chain->train({
    "wur a fox",
    "fox the chorni"
  });

  std::cout << chain->generateText("wur") << std::endl;

  chain->serializeToOstream(std::cout);

  return 0;
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kusai-0.12.2.tar.gz (15.8 kB view details)

Uploaded Source

File details

Details for the file kusai-0.12.2.tar.gz.

File metadata

  • Download URL: kusai-0.12.2.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.10 {"installer":{"name":"uv","version":"0.11.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.4","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kusai-0.12.2.tar.gz
Algorithm Hash digest
SHA256 54af65b4178637c943c92e1521fb97529ca35bf6a83f7e991dc1f5c0686a1717
MD5 fd85370d78481d31f545d14fb526237f
BLAKE2b-256 65145e6bd4a6801560aa9e3d87ecbd8c431a50dc2d33bebcff1aed06796e6dcd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page