No project description provided
Project description
Introduce
A Modification of LibShortText and LIBLINEAR.
Uses Wissen Text Analyzer
Feature Selection
API Exported by Skitai App Engine
Win32 support (need MSVC)
Installation
git clone https://gitlab.com/hansroh/haiku
cd haiku
python setup.py build install
Basic Usage
import haiku
model_path = "./golforbed"
analyzer = haiku.StandardAnalyzer (max_term = 200, stem_level = 2, make_lower_case = 1)
trainset = [
('Golf', "cloudy cold calm"),
('Golf', "sunny warm"),
('Bed', "rainy hot"),
('Golf', "sunny hot windy"),
('Bed', "windy cloudy cold"),
('Bed', "rainy cloudy cold"),
]
# training
h = haiku.Haiku (model_path, haiku.CL_L2, analyzer)
# pruning by document frequency and scoring by meth (FS_CF means category frequency)
h.select (data, mindf = 0, maxdf = 0, top = 0, meth = haiku.FS_CF)
# set training options: uni/bigram and feature representation
h.train (haiku.BIGRAM, haiku.FT_BIN)
h.close ()
# guessing
h = haiku.Haiku (model_path, haiku.CL_L2, analyzer)
h.load ()
print (h.guess ("sunny cold windy"))
h.close ()
Exporting API through Skitai App Engine
Place model data into app_root/resources/haikus/golforbed.
import haiku
import skitai
if __name__ == "__main__":
pref = skitai.pref ()
pref.config.resource_dir = skitai.joinpath ('resources')
skitai.mount ("/", haiku, "app", pref)
skitai.run (port = 5005)
Go to http://127.0.0.1:5000/haiku/golforbed/guess?q=sunny%20cold%20windy.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
haiku-lst-0.1.1b1.tar.gz
(135.9 kB
view hashes)
Built Distribution
haiku_lst-0.1.1b1-py3-none-any.whl
(438.8 kB
view hashes)
Close
Hashes for haiku_lst-0.1.1b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9008b60a0244d7c517a3ee7aeb2461dda53b20bde71415939988afa44e59050f |
|
MD5 | 45b922e0e577d5bb14e993c00250d3b8 |
|
BLAKE2b-256 | 01716512fc96116d8f9f326eadc96037f9b7b10da42bfa5ca515cef222721498 |