Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed Feb 5, 2021
1 parent 6f68b20 commit 3c80347
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ with Flow().add() as f:

Flow supports CRUD operations: `index`, `search`, `update`, `delete`. Besides, it also provides sugary syntax on `ndarray`, `csv`, `ndjson` and arbitrary files.


<table>
<tr>
<td>
Expand All @@ -232,16 +233,18 @@ Explain
<code>numpy.ndarray</code>
</td>
<td>
<sup>

```python
with f:
f.index_ndarray(numpy.random.random([4,2]))
f.index_ndarray(numpy.random.random([4,2]))
```

</sup>
</td>
<td>

Input four `Document`, where each `document.blob` is a `ndarray([2])`
Input four `Document`, each `document.blob` is a `ndarray([2])`

</td>
</tr>
Expand All @@ -250,16 +253,19 @@ Input four `Document`, where each `document.blob` is a `ndarray([2])`
CSV
</td>
<td>
<sup>

```python
with f, open('index.csv') as fp:
f.index_csv(fp1, field_resolver={'pic_url': 'uri'})
f.index_csv(fp1, field_resolver={'pic_url': 'uri'})
```

</sup>
</td>

<td>

Each line in the `index.csv` is constructed as `Document`, where CSV's field `pic_url` is mapped to `document.uri`.
Each line in the `index.csv` is constructed as `Document`, CSV's field `pic_url` is mapped to `document.uri`.

</td>
</tr>
Expand All @@ -269,15 +275,18 @@ Each line in the `index.csv` is constructed as `Document`, where CSV's field `pi
JSON Lines/<code>ndjson</code>/LDJSON
</td>
<td>

<sup>

```python
with f, open('index.ndjson') as fp:
f.index_ndjson(fp1, field_resolver={'question_id': 'id'})
f.index_ndjson(fp1, field_resolver={'question_id': 'id'})
```

</sup>
</td>
<td>

Each line in `index.ndjson` is constructed as `Document`, where JSON's field `question_id` is mapped to `document.id`.
Each line in `index.ndjson` is constructed as `Document`, JSON's field `question_id` is mapped to `document.id`.

</td>
</tr>
Expand All @@ -286,15 +295,18 @@ Each line in `index.ndjson` is constructed as `Document`, where JSON's field `qu
Files with wildcard
</td>
<td>
<sup>

```python
with f:
f.index_files(['/tmp/*.mp4', '/tmp/*.pdf'])
f.index_files(['/tmp/*.mp4', '/tmp/*.pdf'])
```

</sup>
</td>
<td>

Each file captured the wildcard is constructed as a `Document`, where Document's content (`text`, `blob`, `buffer`) is auto-guessed.
Each file captured is constructed as a `Document`, whose content (`text`, `blob`, `buffer`) is auto-guessed & filled.

</td>
</tr>
Expand Down

0 comments on commit 3c80347

Please sign in to comment.