2017-07-23 05:32:18 +00:00
|
|
|
# word-count
|
|
|
|
|
2018-07-30 20:52:22 +00:00
|
|
|
Demonstrates searching for a file in plain python, with rust singlethreaded and with rust multithreaded.
|
|
|
|
|
2017-07-23 05:32:18 +00:00
|
|
|
## Build
|
|
|
|
|
2018-07-30 20:52:22 +00:00
|
|
|
```shell
|
2017-07-23 05:32:18 +00:00
|
|
|
python setup.py install
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```python
|
2018-07-30 20:52:22 +00:00
|
|
|
from word_count import search_py, WordCounter
|
2017-07-23 05:32:18 +00:00
|
|
|
|
2018-07-30 20:52:22 +00:00
|
|
|
search_py("path/to/file", "word")
|
|
|
|
WordCounter("path/to/file").search("word")
|
|
|
|
WordCounter("path/to/file").search_sequential("word")
|
2017-07-23 05:32:18 +00:00
|
|
|
```
|
2018-07-30 20:52:22 +00:00
|
|
|
|
|
|
|
## Benchmark
|
|
|
|
|
2018-12-28 19:29:12 +00:00
|
|
|
Install the depedencies:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
pip install -r requirements-dev.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2018-07-30 20:52:22 +00:00
|
|
|
There is a benchmark in `tests/test_word_count.py`:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
pytest -v tests
|
2018-10-09 16:21:52 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Testing
|
|
|
|
|
|
|
|
To test python 2.7, 3.5, 3.6 and 3.7, install tox globally and run
|
|
|
|
|
|
|
|
```shell
|
|
|
|
tox
|
2018-12-28 19:29:12 +00:00
|
|
|
```
|