Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/preparing_queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Some filter parameters accept a combination of modifiers to create complex queri
```python
from impresso import AND

impresso.search.find(term=AND("Titanic", "ship"))
client.search.find(term=AND("Titanic", "ship"))
```

We can refine this condition and search for all content items that mention `Titanic` and `ship` together **OR** mention `Titanic` and `iceberg` together **AND** do not mention `Di Caprio`.
Expand All @@ -14,7 +14,7 @@ We can refine this condition and search for all content items that mention `Tita
```python
from impresso import AND, OR

impresso.search.find(
client.search.find(
term=(
AND("Titanic", "ship") |
AND("Titanic", "iceberg")
Expand Down
10 changes: 5 additions & 5 deletions docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Search content items in the Impresso corpus.

```python
impresso.search.find(term='Titanic', limit=10)
client.search.find(term='Titanic', limit=10)
```

::: impresso.resources.search.SearchResource
Expand All @@ -18,7 +18,7 @@ impresso.search.find(term='Titanic', limit=10)
Search entities in the Impresso corpus.

```python
impresso.entities.find(term="Douglas Adams")
client.entities.find(term="Douglas Adams")
```

::: impresso.resources.entities.EntitiesResource
Expand All @@ -31,7 +31,7 @@ impresso.entities.find(term="Douglas Adams")
Search media sources available in the Impresso corpus.

```python
impresso.media_sources.find(
client.media_sources.find(
term="wort",
order_by="lastIssue",
)
Expand All @@ -47,7 +47,7 @@ impresso.media_sources.find(
Get a single content item by ID.

```python
impresso.content_items.get("NZZ-1794-08-09-a-i0002")
client.content_items.get("NZZ-1794-08-09-a-i0002")
```

## Collections
Expand Down Expand Up @@ -86,7 +86,7 @@ When a `find` or `facet` method is called, the response object contains data for
For example, if you want to get all the content items that mention "Titanic" with 20 items per page, you can use the following code:

```python
result = impresso.search.find(
result = client.search.find(
term="titanic",
limit=20,
)
Expand Down
18 changes: 9 additions & 9 deletions examples/notebooks/basic.ipynb

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions examples/notebooks/collections.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"🎉 You are now connected to the Impresso API! 🎉\n",
"🔗 Using API: https://dev.impresso-project.ch/public-api/v1\n"
"\ud83c\udf89 You are now connected to the Impresso API! \ud83c\udf89\n",
"\ud83d\udd17 Using API: https://dev.impresso-project.ch/public-api/v1\n"
]
}
],
"source": [
"from impresso import connect\n",
"\n",
"impresso = connect()"
"client = connect()"
]
},
{
Expand All @@ -35,7 +35,7 @@
"metadata": {},
"outputs": [],
"source": [
"result = impresso.collections.find()\n",
"result = client.collections.find()\n",
"result"
]
},
Expand All @@ -52,7 +52,7 @@
"metadata": {},
"outputs": [],
"source": [
"result = impresso.collections.find(\n",
"result = client.collections.find(\n",
" limit=5,\n",
")\n",
"\n",
Expand All @@ -79,7 +79,7 @@
"metadata": {},
"outputs": [],
"source": [
"result = impresso.collections.get(\"local-roka-tOrwrOG3\")\n",
"result = client.collections.get(\"local-roka-tOrwrOG3\")\n",
"result"
]
},
Expand All @@ -99,7 +99,7 @@
"outputs": [],
"source": [
"colection_id = result.raw[\"uid\"]\n",
"items = impresso.collections.items(colection_id)\n",
"items = client.collections.items(colection_id)\n",
"items"
]
},
Expand All @@ -126,7 +126,7 @@
"metadata": {},
"outputs": [],
"source": [
"impresso.collections.remove_items(colection_id, [item_id])"
"client.collections.remove_items(colection_id, [item_id])"
]
},
{
Expand All @@ -142,7 +142,7 @@
"metadata": {},
"outputs": [],
"source": [
"impresso.collections.add_items(colection_id, [item_id])"
"client.collections.add_items(colection_id, [item_id])"
]
}
],
Expand All @@ -167,4 +167,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
68 changes: 34 additions & 34 deletions examples/notebooks/entities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"name": "stdout",
"output_type": "stream",
"text": [
"🎉 You are now connected to the Impresso API! 🎉\n",
"🔗 Using API: https://dev.impresso-project.ch/public-api/v1\n"
"\ud83c\udf89 You are now connected to the Impresso API! \ud83c\udf89\n",
"\ud83d\udd17 Using API: https://dev.impresso-project.ch/public-api/v1\n"
]
}
],
"source": [
"from impresso import connect\n",
"\n",
"impresso = connect()"
"client = connect()"
]
},
{
Expand Down Expand Up @@ -81,7 +81,7 @@
}
],
"source": [
"impresso.entities.find(term=\"Douglas Adams\")"
"client.entities.find(term=\"Douglas Adams\")"
]
},
{
Expand Down Expand Up @@ -142,24 +142,24 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2-54-San_José</th>\n",
" <td>San José</td>\n",
" <th>2-54-San_Jos\u00e9</th>\n",
" <td>San Jos\u00e9</td>\n",
" <td>location</td>\n",
" <td>Q173718</td>\n",
" <td>163</td>\n",
" <td>114</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2-54-Provinz_San_José</th>\n",
" <td>Provinz San José</td>\n",
" <th>2-54-Provinz_San_Jos\u00e9</th>\n",
" <td>Provinz San Jos\u00e9</td>\n",
" <td>location</td>\n",
" <td>Q647808</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2-54-San_José_$28$Costa_Rica$29$</th>\n",
" <td>San José (Costa Rica)</td>\n",
" <th>2-54-San_Jos\u00e9_$28$Costa_Rica$29$</th>\n",
" <td>San Jos\u00e9 (Costa Rica)</td>\n",
" <td>location</td>\n",
" <td>NaN</td>\n",
" <td>2</td>\n",
Expand All @@ -179,7 +179,7 @@
}
],
"source": [
"impresso.entities.find(term=\"san jose\", entity_type=\"location\")"
"client.entities.find(term=\"san jose\", entity_type=\"location\")"
]
},
{
Expand Down Expand Up @@ -233,16 +233,16 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2-50-San_José</th>\n",
" <td>San José</td>\n",
" <th>2-50-San_Jos\u00e9</th>\n",
" <td>San Jos\u00e9</td>\n",
" <td>person</td>\n",
" <td>Q173718</td>\n",
" <td>20</td>\n",
" <td>20</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2-50-José_de_San_Martín</th>\n",
" <td>José de San Martín</td>\n",
" <th>2-50-Jos\u00e9_de_San_Mart\u00edn</th>\n",
" <td>Jos\u00e9 de San Mart\u00edn</td>\n",
" <td>person</td>\n",
" <td>Q134160</td>\n",
" <td>8</td>\n",
Expand All @@ -262,7 +262,7 @@
}
],
"source": [
"impresso.entities.find(term=\"san jose\", entity_type=\"person\", order_by=\"-relevance\")"
"client.entities.find(term=\"san jose\", entity_type=\"person\", order_by=\"-relevance\")"
]
},
{
Expand All @@ -283,15 +283,15 @@
"text": [
"Total items in the result set: 87\n",
"Got page 0 - 20 of 87. The first title is Angers\n",
"Got page 20 - 40 of 87. The first title is Château Saint-Ange\n",
"Got page 20 - 40 of 87. The first title is Ch\u00e2teau Saint-Ange\n",
"Got page 40 - 60 of 87. The first title is Sainte-Marie-des-Anges\n",
"Got page 60 - 80 of 87. The first title is Museum für angewandte Kunst\n",
"Got page 60 - 80 of 87. The first title is Museum f\u00fcr angewandte Kunst\n",
"Got page 80 - 87 of 87. The first title is Angelo\n"
]
}
],
"source": [
"result = impresso.entities.find(\n",
"result = client.entities.find(\n",
" term=\"ange\",\n",
" entity_type=\"location\",\n",
" limit=20,\n",
Expand Down Expand Up @@ -402,7 +402,7 @@
" <td>Parigi</td>\n",
" <td>capitale de la France</td>\n",
" <td>capitale della Francia</td>\n",
" <td>Hauptstadt und bevölkerungsreichste Stadt Fran...</td>\n",
" <td>Hauptstadt und bev\u00f6lkerungsreichste Stadt Fran...</td>\n",
" <td>capital city of France</td>\n",
" <td>48.856667</td>\n",
" <td>2.352222</td>\n",
Expand All @@ -421,7 +421,7 @@
}
],
"source": [
"impresso.entities.get(\"2-54-Paris\")"
"client.entities.get(\"2-54-Paris\")"
]
},
{
Expand Down Expand Up @@ -483,16 +483,16 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>2-54-San_José</th>\n",
" <td>San José</td>\n",
" <th>2-54-San_Jos\u00e9</th>\n",
" <td>San Jos\u00e9</td>\n",
" <td>location</td>\n",
" <td>Q173718</td>\n",
" <td>163</td>\n",
" <td>114</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2-54-San_José_$28$Costa_Rica$29$</th>\n",
" <td>San José (Costa Rica)</td>\n",
" <th>2-54-San_Jos\u00e9_$28$Costa_Rica$29$</th>\n",
" <td>San Jos\u00e9 (Costa Rica)</td>\n",
" <td>location</td>\n",
" <td>NaN</td>\n",
" <td>2</td>\n",
Expand All @@ -513,10 +513,10 @@
],
"source": [
"from impresso import OR\n",
"impresso.entities.find(\n",
"client.entities.find(\n",
" entity_id=OR(\n",
" \"2-54-San_José\",\n",
" \"2-54-San_José_$28$Costa_Rica$29$\",\n",
" \"2-54-San_Jos\u00e9\",\n",
" \"2-54-San_Jos\u00e9_$28$Costa_Rica$29$\",\n",
" ),\n",
")"
]
Expand Down Expand Up @@ -617,7 +617,7 @@
],
"source": [
"from impresso import AND\n",
"impresso.entities.find(wikidata_id=AND(\"Q2\", \"Q4\", \"Q42\"))"
"client.entities.find(wikidata_id=AND(\"Q2\", \"Q4\", \"Q42\"))"
]
},
{
Expand Down Expand Up @@ -717,7 +717,7 @@
" <td>Parigi</td>\n",
" <td>capitale de la France</td>\n",
" <td>capitale della Francia</td>\n",
" <td>Hauptstadt und bevölkerungsreichste Stadt Fran...</td>\n",
" <td>Hauptstadt und bev\u00f6lkerungsreichste Stadt Fran...</td>\n",
" <td>capital city of France</td>\n",
" <td>48.856667</td>\n",
" <td>2.352222</td>\n",
Expand All @@ -737,7 +737,7 @@
" <td>Parigi</td>\n",
" <td>capitale de la France</td>\n",
" <td>capitale della Francia</td>\n",
" <td>Hauptstadt und bevölkerungsreichste Stadt Fran...</td>\n",
" <td>Hauptstadt und bev\u00f6lkerungsreichste Stadt Fran...</td>\n",
" <td>capital city of France</td>\n",
" <td>48.856667</td>\n",
" <td>2.352222</td>\n",
Expand All @@ -757,7 +757,7 @@
" <td>Parigi</td>\n",
" <td>capitale de la France</td>\n",
" <td>capitale della Francia</td>\n",
" <td>Hauptstadt und bevölkerungsreichste Stadt Fran...</td>\n",
" <td>Hauptstadt und bev\u00f6lkerungsreichste Stadt Fran...</td>\n",
" <td>capital city of France</td>\n",
" <td>48.856667</td>\n",
" <td>2.352222</td>\n",
Expand All @@ -776,7 +776,7 @@
}
],
"source": [
"impresso.entities.find(term=\"Paris\", resolve=True)"
"client.entities.find(term=\"Paris\", resolve=True)"
]
}
],
Expand All @@ -801,4 +801,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
Loading