Skip to content

izziiyt/darts-clone-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

darts-clone-python

Darts-clone binding for Python 3.x.
This repository provides Cython-based pip-installable package.

Installation

pip install dartsclone

Usage

darts-clone-python is almost compatible with darts-clone.

import dartsclone

darts = dartsclone.DoubleArray()

# build index
data = [b'apple', b'banana', b'orange']
values = [1, 3, 2]
darts.build(data, values=values)

# exact match search
result = darts.exact_match_search('apple'.encode('utf-8'))
print(result) # [1, 5]

# common prefix search
result = darts.common_prefix_search('apples'.encode('utf-8'), pair_type=False)
print(result) # [1]

# save index
darts.save('sample.dic')

# load index
darts.clear()
darts.open('sample.dic')

# dump array data
array = darts.array()

# load array data
darts.clear()
darts.set_array(array)

About

Darts-clone python binding

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%