Spaces:
Running
Running
Alejandro Cremades
commited on
Commit
•
106cfa9
1
Parent(s):
e73e94c
A function to find the rarer Japanese card names on Wisdom Guild
Browse files- middleschool-cardlist.ipynb +48 -0
middleschool-cardlist.ipynb
CHANGED
@@ -144,6 +144,54 @@
|
|
144 |
"Exclude all cards banned in Middle School\n"
|
145 |
]
|
146 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
{
|
148 |
"cell_type": "code",
|
149 |
"execution_count": 19,
|
|
|
144 |
"Exclude all cards banned in Middle School\n"
|
145 |
]
|
146 |
},
|
147 |
+
{
|
148 |
+
"cell_type": "code",
|
149 |
+
"execution_count": 54,
|
150 |
+
"metadata": {},
|
151 |
+
"outputs": [
|
152 |
+
{
|
153 |
+
"name": "stdout",
|
154 |
+
"output_type": "stream",
|
155 |
+
"text": [
|
156 |
+
"Abbey Matron → None\n",
|
157 |
+
"Zuran Spellcaster → ズアーの投呪士\n",
|
158 |
+
"Sea Eagle → 海の鷲\n",
|
159 |
+
"Yavimaya Ants → ヤヴィマヤの蟻\n"
|
160 |
+
]
|
161 |
+
}
|
162 |
+
],
|
163 |
+
"source": [
|
164 |
+
"import time\n",
|
165 |
+
"from requests_html import HTMLSession\n",
|
166 |
+
"session = HTMLSession()\n",
|
167 |
+
"\n",
|
168 |
+
"\n",
|
169 |
+
"def find_japanese_name(name):\n",
|
170 |
+
" url = 'http://whisper.wisdom-guild.net/search.php?q=' + name\n",
|
171 |
+
" r = session.get(url)\n",
|
172 |
+
" title = r.html.find('title')[0].text\n",
|
173 |
+
" idx = title.find(name)\n",
|
174 |
+
" if idx == 0:\n",
|
175 |
+
" return None\n",
|
176 |
+
" else:\n",
|
177 |
+
" name_ja = title[0:idx - 1]\n",
|
178 |
+
" return name_ja\n",
|
179 |
+
"\n",
|
180 |
+
"\n",
|
181 |
+
"english_only_cards = middleschool_df[middleschool_df['name_ja'].isnull()]\n",
|
182 |
+
"name = english_only_cards.iloc[0]['name']\n",
|
183 |
+
"print(name, '→', find_japanese_name(name))\n",
|
184 |
+
"time.sleep(1)\n",
|
185 |
+
"name = english_only_cards.iloc[-1]['name']\n",
|
186 |
+
"print(name, '→', find_japanese_name(name))\n",
|
187 |
+
"time.sleep(1)\n",
|
188 |
+
"name = \"Sea Eagle\"\n",
|
189 |
+
"print(name, '→', find_japanese_name(name))\n",
|
190 |
+
"time.sleep(1)\n",
|
191 |
+
"name = \"Yavimaya Ants\"\n",
|
192 |
+
"print(name, '→', find_japanese_name(name))\n"
|
193 |
+
]
|
194 |
+
},
|
195 |
{
|
196 |
"cell_type": "code",
|
197 |
"execution_count": 19,
|