Skip to main content

## DoubleArrayTrie

DoubleArrayTrie(DAT) support prefix search & exact search & multiple pattern match for python implemented by c++

### What’s different

Now greedy search is supported: function search only returns the longest subsequence(greedy search) function maximum_search returns all subsequences

word: she sher shers he to_search: shers

search: {‘entities’: [{‘begin’: 0, ‘end’: 5, ‘entity’: ‘shers’}]}

maximum_search: {‘entities’: [{‘begin’: 0, ‘end’: 3, ‘entity’: ‘she’}, {‘begin’: 0, ‘end’: 4, ‘entity’: ‘sher’}, {‘begin’: 0, ‘end’: 5, ‘entity’: ‘shers’}, {‘begin’: 1, ‘end’: 3, ‘entity’: ‘he’}]}

### C++

#include “double_array_trie.h”

DoubleArrayTrie dat; // load from file dat.load_file(“test.txt”) // or add word dat.add_word(“he”) dat.add_word(“she”) // make base & check dat.make() // greedy_search vector<string> index_s = dat.search(“ushers”) // maximum_search vector<string> index_s = dat.maximum_search(“ushers”)

### Python

# install pip install pydat

# use dat = pydat.Dat() dat.load_file(“test.txt”) dat.add_word(“he”) dat.make() # search dat.search(“ushers”) # greedy_search dat.maximum_search(“ushers”)

### About DAT ![](https://linux.thai.net/~thep/datrie/double.gif)

Definition check[base[s] + c] = s base[s] + c = t

Reference: [An implementation of Double-Array Trie](https://linux.thai.net/~thep/datrie/datrie.html#Double)

### Update Log

#### 2018.09.19 - optimize the algorithm

#### 2018.08.29 - support greedy_search

#### 2018.08.08 - support python3

Metadata

Release files for pydat 0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydat 0.7
File Size Uploaded
pydat-0.7.tar.gz 11.8 MB Details

Release files / pydat-0.7.tar.gz

Download URL pydat-0.7.tar.gz
Size 11.8 MB
Tags Source
SHA-256 checksum
How to use checksums
0cbd2e287ca690bc9d94aaf7e6e4c2dac3d81c5a497b2967c7ba2d85064b3261
BLAKE2b-256 checksum
How to use checksums
a7a8b37b67091d33c83541fa32b2521797f0d6f7ed13bf18fb595ea1671729e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15rc1

Release history Release notifications | RSS feed

This release

0.7 This release

1 release file

0.6.4

1 release file

0.6.3

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6

1 release file

0.5.2

1 release file

0.5.0

1 release file

0.4.9

1 release file

0.4.8

1 release file

0.4.7

1 release file

0.4.6

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4

1 release file

0.3.9

1 release file

0.3.8

1 release file

0.3.7

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.2.9

1 release file

0.2.8

1 release file

0.2.7

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page