summaryrefslogtreecommitdiff
path: root/megapixels/notebooks/datasets/identity/identity_testing.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'megapixels/notebooks/datasets/identity/identity_testing.ipynb')
-rw-r--r--megapixels/notebooks/datasets/identity/identity_testing.ipynb50
1 files changed, 16 insertions, 34 deletions
diff --git a/megapixels/notebooks/datasets/identity/identity_testing.ipynb b/megapixels/notebooks/datasets/identity/identity_testing.ipynb
index 384cca93..3975d0c6 100644
--- a/megapixels/notebooks/datasets/identity/identity_testing.ipynb
+++ b/megapixels/notebooks/datasets/identity/identity_testing.ipynb
@@ -13,7 +13,7 @@
},
{
"cell_type": "code",
- "execution_count": 155,
+ "execution_count": 186,
"metadata": {},
"outputs": [],
"source": [
@@ -54,23 +54,6 @@
]
},
{
- "cell_type": "code",
- "execution_count": 159,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "/media/adam/ah8tb/work/megapixels_dev/env/google_knowledge_graph_api.env\n"
- ]
- }
- ],
- "source": [
- "print(app_cfg.FP_KNOWLEDGE_GRAPH_ENV)"
- ]
- },
- {
"cell_type": "markdown",
"metadata": {},
"source": [
@@ -79,7 +62,7 @@
},
{
"cell_type": "code",
- "execution_count": 160,
+ "execution_count": 188,
"metadata": {},
"outputs": [
{
@@ -92,7 +75,8 @@
}
],
"source": [
- "names = identity_utils.get_names(types.Dataset.LFW)\n",
+ "names = identity_utils.get_names(types.Dataset.\n",
+ " )\n",
"print(names['names_query'][0:10])\n",
"print(names['names_orig'][0:10])"
]
@@ -108,14 +92,12 @@
},
{
"cell_type": "code",
- "execution_count": 161,
+ "execution_count": 164,
"metadata": {},
"outputs": [],
"source": [
"# read API key\n",
- "\n",
- "api_key = open(app_cfg.FP_KNOWLEDGE_GRAPH_ENV).read()\n",
- "kg_api = api_utils.GoogleKnowledgeGraph(api_key)\n",
+ "kg_api = api_utils.GoogleKnowledgeGraph()\n",
"wp_api = api_utils.WikipediaAPI()"
]
},
@@ -128,25 +110,23 @@
},
{
"cell_type": "code",
- "execution_count": 128,
+ "execution_count": 165,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "wp\n",
+ "wp----\n",
"https://en.wikipedia.org/w/api.php?redirects=&ppprop=displaytitle&prop=pageprops%7Cpageimages%7Cdescription&generator=prefixsearch&action=query&format=json&piprop=thumbnail&pilimit=1&gpssearch=Vicente+Fox&gpsnamespace=0&gpslimit=1\n",
"{'wp_accessed': True,\n",
" 'wp_description': 'President of Mexico',\n",
" 'wp_name': 'Vicente Fox',\n",
" 'wp_page_id': '32836'}\n",
- "kg\n",
+ "kg----\n",
"{'kg_accessed': True,\n",
- " 'kg_bio': 'Vicente Fox Quesada, RSerafO is a Mexican businessman and '\n",
- " 'politician who served as the 55th President of Mexico from 1 '\n",
- " 'December 2000 to 30 November 2006.\\n',\n",
- " 'kg_bio_url': 'https://en.wikipedia.org/wiki/Vicente_Fox',\n",
+ " 'kg_bio': '',\n",
+ " 'kg_bio_url': '',\n",
" 'kg_description': 'Former President of Mexico',\n",
" 'kg_error': '',\n",
" 'kg_id': '/m/081f4',\n",
@@ -174,14 +154,15 @@
},
{
"cell_type": "code",
- "execution_count": 162,
+ "execution_count": 168,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
- "0.7714285714285716\n"
+ "0.7714285714285716\n",
+ "0.7142857142857143\n"
]
}
],
@@ -189,7 +170,8 @@
"#print(identity_utils.names_match('Andréss Iniestas', 'Andres Iniestalossas Jr.', as_float=True))\n",
"#print(identity_utils.names_match('Adoor Gopalakrishnan', 'Adoors Gopalakarishnan', as_float=True))\n",
"#print(identity_utils.names_match('Dave Letterman', 'David Letterman', as_float=True))\n",
- "print(identity_utils.names_match('Charles Dickens', 'Charles Boooker', as_float=True))\n",
+ "print(identity_utils.names_match('Charles Dickens', 'Charles Boooker', as_float=True, compound_score=True))\n",
+ "print(identity_utils.names_match('Charles Dickens', 'Charles Boooker', as_float=True, compound_score=False))\n",
"#print(identity_utils.names_match('Donald Trump', 'Donald J. Trump', as_float=True))\n",
"#print(identity_utils.names_match('Wang Fei', 'Fei Wang III', as_float=True))"
]