added code for extracting all sustainability related words
This commit is contained in:
@@ -0,0 +1,918 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 72,
|
||||||
|
"id": "0c875ce0-80ad-42f3-af90-9bb1c1e53858",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"['CO2', 'CSR', 'ESG', 'SDG', 'bio', 'carb', 'challeng', 'chang', 'clean', 'climate', 'eco', 'emissions', 'environment', 'future', 'garbage', 'green', 'methanol', 'mission', 'neutral', 'ocean', 'planet', 'plastic', 'recycling', 'reduc', 'responsib', 'sulphur', 'sustainab', 'zero']\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"# load list of words related to sustainability\n",
|
||||||
|
"path = 'sustainability_words.txt'\n",
|
||||||
|
"word_list = list()\n",
|
||||||
|
"with open(path, 'r') as f:\n",
|
||||||
|
" for line in f.readlines():\n",
|
||||||
|
" word_list.append(line.replace('\\n', ''))\n",
|
||||||
|
"\n",
|
||||||
|
"word_list.sort()\n",
|
||||||
|
"print(word_list)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 73,
|
||||||
|
"id": "99837ffc-0eb7-4e89-87e5-eedbe35219bc",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<div>\n",
|
||||||
|
"<style scoped>\n",
|
||||||
|
" .dataframe tbody tr th:only-of-type {\n",
|
||||||
|
" vertical-align: middle;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe tbody tr th {\n",
|
||||||
|
" vertical-align: top;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe thead th {\n",
|
||||||
|
" text-align: right;\n",
|
||||||
|
" }\n",
|
||||||
|
"</style>\n",
|
||||||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
||||||
|
" <thead>\n",
|
||||||
|
" <tr style=\"text-align: right;\">\n",
|
||||||
|
" <th></th>\n",
|
||||||
|
" <th>word</th>\n",
|
||||||
|
" <th>counts</th>\n",
|
||||||
|
" <th>ratio</th>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </thead>\n",
|
||||||
|
" <tbody>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>0</th>\n",
|
||||||
|
" <td>maersk</td>\n",
|
||||||
|
" <td>3207</td>\n",
|
||||||
|
" <td>0.04001</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>1</th>\n",
|
||||||
|
" <td>is</td>\n",
|
||||||
|
" <td>1025</td>\n",
|
||||||
|
" <td>0.01279</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>2</th>\n",
|
||||||
|
" <td>more</td>\n",
|
||||||
|
" <td>989</td>\n",
|
||||||
|
" <td>0.01234</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>3</th>\n",
|
||||||
|
" <td>here</td>\n",
|
||||||
|
" <td>825</td>\n",
|
||||||
|
" <td>0.01029</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>4</th>\n",
|
||||||
|
" <td>trade</td>\n",
|
||||||
|
" <td>642</td>\n",
|
||||||
|
" <td>0.00801</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>...</th>\n",
|
||||||
|
" <td>...</td>\n",
|
||||||
|
" <td>...</td>\n",
|
||||||
|
" <td>...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>10920</th>\n",
|
||||||
|
" <td>phase</td>\n",
|
||||||
|
" <td>1</td>\n",
|
||||||
|
" <td>0.00001</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>10921</th>\n",
|
||||||
|
" <td>agrichemicals</td>\n",
|
||||||
|
" <td>1</td>\n",
|
||||||
|
" <td>0.00001</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>10922</th>\n",
|
||||||
|
" <td>polluting</td>\n",
|
||||||
|
" <td>1</td>\n",
|
||||||
|
" <td>0.00001</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>10923</th>\n",
|
||||||
|
" <td>adams</td>\n",
|
||||||
|
" <td>1</td>\n",
|
||||||
|
" <td>0.00001</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>10924</th>\n",
|
||||||
|
" <td>maerskcapitalmarketsday</td>\n",
|
||||||
|
" <td>1</td>\n",
|
||||||
|
" <td>0.00001</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </tbody>\n",
|
||||||
|
"</table>\n",
|
||||||
|
"<p>10925 rows × 3 columns</p>\n",
|
||||||
|
"</div>"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
" word counts ratio\n",
|
||||||
|
"0 maersk 3207 0.04001\n",
|
||||||
|
"1 is 1025 0.01279\n",
|
||||||
|
"2 more 989 0.01234\n",
|
||||||
|
"3 here 825 0.01029\n",
|
||||||
|
"4 trade 642 0.00801\n",
|
||||||
|
"... ... ... ...\n",
|
||||||
|
"10920 phase 1 0.00001\n",
|
||||||
|
"10921 agrichemicals 1 0.00001\n",
|
||||||
|
"10922 polluting 1 0.00001\n",
|
||||||
|
"10923 adams 1 0.00001\n",
|
||||||
|
"10924 maerskcapitalmarketsday 1 0.00001\n",
|
||||||
|
"\n",
|
||||||
|
"[10925 rows x 3 columns]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 73,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"# load word counts from tweets\n",
|
||||||
|
"import pandas as pd\n",
|
||||||
|
"\n",
|
||||||
|
"word_df = pd.read_csv('word_count.csv', index_col=0)\n",
|
||||||
|
"\n",
|
||||||
|
"word_df"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 74,
|
||||||
|
"id": "57e749a9-3401-4cb5-98b0-ad68098bf5b4",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"['become', 'becomes', 'becoming', 'blueeconomy', 'changed', 'chinaeconomy', 'deconsolidation', 'decorated', 'decoupling', 'ecommerce', 'ecommercelogistics', 'economia', 'economic', 'economically', 'economicgrowth', 'economictimes', 'economies', 'economist', 'economistimpact', 'economy', 'environments', 'fairfuture4seafarers', 'mclean', 'portrecord', 'recognise', 'recognised', 'recognising', 'recognition', 'recognized', 'record', 'recorded', 'records', 'recovery', 'second', 'secondbusiest', 'secondgeneration', 'secondlargest', 'seconds', 'shetradesglobal', 'socioeconomic', 'telecoms', 'theeconomist', 'transoceanic', 'unchanged', 'worldrecord']\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"# load ignore list\n",
|
||||||
|
"ignore_list = list()\n",
|
||||||
|
"path = 'ignore_words.txt'\n",
|
||||||
|
"with open(path, 'r') as f:\n",
|
||||||
|
" for line in f.readlines():\n",
|
||||||
|
" ignore_list.append(line.replace('\\n', ''))\n",
|
||||||
|
" \n",
|
||||||
|
"ignore_list.sort()\n",
|
||||||
|
"print(ignore_list)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 76,
|
||||||
|
"id": "f2f37c6b-cb1f-4c71-aa24-9601d5bfe7b8",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"CO2\n",
|
||||||
|
"['co2', 'co2emission', 'co2neutral']\n",
|
||||||
|
"3279.0\n",
|
||||||
|
"2165.0\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"import numpy as np\n",
|
||||||
|
"\n",
|
||||||
|
"match_word_list = list()\n",
|
||||||
|
"mean_idx_list = list()\n",
|
||||||
|
"sigma_idx_list = list()\n",
|
||||||
|
"for i, word in enumerate(word_list):\n",
|
||||||
|
" # find index of matching words\n",
|
||||||
|
" contains_word_mask = word_df['word'].str.contains(word.lower())==True\n",
|
||||||
|
" counts_above_limit_mask = word_df['counts'].gt(1)\n",
|
||||||
|
" match_mask = contains_word_mask & counts_above_limit_mask\n",
|
||||||
|
" match_idx_list = word_df[match_mask].index.tolist()\n",
|
||||||
|
" # remove indices of unwanted words\n",
|
||||||
|
" remove_idx_list = list()\n",
|
||||||
|
" for idx in match_idx_list:\n",
|
||||||
|
" match_word = word_df.loc[idx, 'word']\n",
|
||||||
|
" if match_word in ignore_list:\n",
|
||||||
|
" remove_idx_list.append(idx)\n",
|
||||||
|
" for idx in remove_idx_list:\n",
|
||||||
|
" match_idx_list.remove(idx)\n",
|
||||||
|
" # store matched words\n",
|
||||||
|
" match_word_list.append(list())\n",
|
||||||
|
" for idx in match_idx_list:\n",
|
||||||
|
" match_word = word_df.loc[idx, 'word']\n",
|
||||||
|
" match_word_list[i].append(match_word)\n",
|
||||||
|
" # calculate mean and std of word ranking from located indices\n",
|
||||||
|
" mu = np.array(match_idx_list).mean().round()\n",
|
||||||
|
" mean_idx_list.append(mu)\n",
|
||||||
|
" sigma = np.array(match_idx_list).std().round()\n",
|
||||||
|
" sigma_idx_list.append(sigma)\n",
|
||||||
|
"\n",
|
||||||
|
"# show example of results\n",
|
||||||
|
"idx = 0\n",
|
||||||
|
"print(word_list[idx])\n",
|
||||||
|
"print(match_word_list[idx])\n",
|
||||||
|
"print(mean_idx_list[idx])\n",
|
||||||
|
"print(sigma_idx_list[idx])"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 77,
|
||||||
|
"id": "f825653d-6c43-46bc-bc11-f9b8f4de5414",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<div>\n",
|
||||||
|
"<style scoped>\n",
|
||||||
|
" .dataframe tbody tr th:only-of-type {\n",
|
||||||
|
" vertical-align: middle;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe tbody tr th {\n",
|
||||||
|
" vertical-align: top;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe thead th {\n",
|
||||||
|
" text-align: right;\n",
|
||||||
|
" }\n",
|
||||||
|
"</style>\n",
|
||||||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
||||||
|
" <thead>\n",
|
||||||
|
" <tr style=\"text-align: right;\">\n",
|
||||||
|
" <th></th>\n",
|
||||||
|
" <th>root</th>\n",
|
||||||
|
" <th>mean_ranking</th>\n",
|
||||||
|
" <th>std_ranking</th>\n",
|
||||||
|
" <th>word_matches</th>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </thead>\n",
|
||||||
|
" <tbody>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>0</th>\n",
|
||||||
|
" <td>CO2</td>\n",
|
||||||
|
" <td>3279.0</td>\n",
|
||||||
|
" <td>2165.0</td>\n",
|
||||||
|
" <td>[co2, co2emission, co2neutral]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>1</th>\n",
|
||||||
|
" <td>CSR</td>\n",
|
||||||
|
" <td>1345.0</td>\n",
|
||||||
|
" <td>0.0</td>\n",
|
||||||
|
" <td>[csr]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>2</th>\n",
|
||||||
|
" <td>ESG</td>\n",
|
||||||
|
" <td>635.0</td>\n",
|
||||||
|
" <td>0.0</td>\n",
|
||||||
|
" <td>[esg]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>3</th>\n",
|
||||||
|
" <td>SDG</td>\n",
|
||||||
|
" <td>423.0</td>\n",
|
||||||
|
" <td>0.0</td>\n",
|
||||||
|
" <td>[sdgs]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>4</th>\n",
|
||||||
|
" <td>bio</td>\n",
|
||||||
|
" <td>3579.0</td>\n",
|
||||||
|
" <td>1252.0</td>\n",
|
||||||
|
" <td>[biofuel, biofuels, biodiversity, biohuts]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>5</th>\n",
|
||||||
|
" <td>carb</td>\n",
|
||||||
|
" <td>1848.0</td>\n",
|
||||||
|
" <td>1396.0</td>\n",
|
||||||
|
" <td>[decarbonisation, carbon, decarbonization, car...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>6</th>\n",
|
||||||
|
" <td>challeng</td>\n",
|
||||||
|
" <td>406.0</td>\n",
|
||||||
|
" <td>248.0</td>\n",
|
||||||
|
" <td>[challenges, challenge, challenging]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>7</th>\n",
|
||||||
|
" <td>chang</td>\n",
|
||||||
|
" <td>2054.0</td>\n",
|
||||||
|
" <td>1563.0</td>\n",
|
||||||
|
" <td>[change, changing, climatechange, changes, exc...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>8</th>\n",
|
||||||
|
" <td>clean</td>\n",
|
||||||
|
" <td>1709.0</td>\n",
|
||||||
|
" <td>859.0</td>\n",
|
||||||
|
" <td>[theoceancleanup, cleanup, clean, cleanseas, o...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>9</th>\n",
|
||||||
|
" <td>climate</td>\n",
|
||||||
|
" <td>2943.0</td>\n",
|
||||||
|
" <td>1978.0</td>\n",
|
||||||
|
" <td>[climateaction, climate, climatechange, climat...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>10</th>\n",
|
||||||
|
" <td>eco</td>\n",
|
||||||
|
" <td>3128.0</td>\n",
|
||||||
|
" <td>1228.0</td>\n",
|
||||||
|
" <td>[ecosystem, eco, maerskecodelivery, ecofriendl...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>11</th>\n",
|
||||||
|
" <td>emissions</td>\n",
|
||||||
|
" <td>2912.0</td>\n",
|
||||||
|
" <td>2065.0</td>\n",
|
||||||
|
" <td>[emissions, carbonemissions, zeroemissions]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>12</th>\n",
|
||||||
|
" <td>environment</td>\n",
|
||||||
|
" <td>2537.0</td>\n",
|
||||||
|
" <td>1736.0</td>\n",
|
||||||
|
" <td>[environment, environmental, unenvironment, en...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>13</th>\n",
|
||||||
|
" <td>future</td>\n",
|
||||||
|
" <td>1626.0</td>\n",
|
||||||
|
" <td>1540.0</td>\n",
|
||||||
|
" <td>[future, futureproofing]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>14</th>\n",
|
||||||
|
" <td>garbage</td>\n",
|
||||||
|
" <td>1772.0</td>\n",
|
||||||
|
" <td>511.0</td>\n",
|
||||||
|
" <td>[garbage, greatpacificgarbagepatch]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>15</th>\n",
|
||||||
|
" <td>green</td>\n",
|
||||||
|
" <td>2580.0</td>\n",
|
||||||
|
" <td>1376.0</td>\n",
|
||||||
|
" <td>[green, greenfuels, greener, greenfuel, greenl...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>16</th>\n",
|
||||||
|
" <td>methanol</td>\n",
|
||||||
|
" <td>1755.0</td>\n",
|
||||||
|
" <td>1110.0</td>\n",
|
||||||
|
" <td>[methanol, emethanol]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>17</th>\n",
|
||||||
|
" <td>mission</td>\n",
|
||||||
|
" <td>3245.0</td>\n",
|
||||||
|
" <td>1937.0</td>\n",
|
||||||
|
" <td>[emissions, mission, carbonemissions, eucommis...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>18</th>\n",
|
||||||
|
" <td>neutral</td>\n",
|
||||||
|
" <td>2384.0</td>\n",
|
||||||
|
" <td>1886.0</td>\n",
|
||||||
|
" <td>[neutral, carbonneutral, neutrality, co2neutral]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>19</th>\n",
|
||||||
|
" <td>ocean</td>\n",
|
||||||
|
" <td>2217.0</td>\n",
|
||||||
|
" <td>1657.0</td>\n",
|
||||||
|
" <td>[ocean, theoceancleanup, oceans, oceanplastic,...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>20</th>\n",
|
||||||
|
" <td>planet</td>\n",
|
||||||
|
" <td>1390.0</td>\n",
|
||||||
|
" <td>0.0</td>\n",
|
||||||
|
" <td>[planet]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>21</th>\n",
|
||||||
|
" <td>plastic</td>\n",
|
||||||
|
" <td>2354.0</td>\n",
|
||||||
|
" <td>1587.0</td>\n",
|
||||||
|
" <td>[plastic, oceanplastic, plasticwaste, plasticp...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>22</th>\n",
|
||||||
|
" <td>recycling</td>\n",
|
||||||
|
" <td>848.0</td>\n",
|
||||||
|
" <td>171.0</td>\n",
|
||||||
|
" <td>[recycling, shiprecycling]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>23</th>\n",
|
||||||
|
" <td>reduc</td>\n",
|
||||||
|
" <td>1359.0</td>\n",
|
||||||
|
" <td>1199.0</td>\n",
|
||||||
|
" <td>[reduce, reducing, reduced, reduction, reducti...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>24</th>\n",
|
||||||
|
" <td>responsib</td>\n",
|
||||||
|
" <td>1840.0</td>\n",
|
||||||
|
" <td>1093.0</td>\n",
|
||||||
|
" <td>[responsible, responsibility, responsibly, res...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>25</th>\n",
|
||||||
|
" <td>sulphur</td>\n",
|
||||||
|
" <td>2572.0</td>\n",
|
||||||
|
" <td>1524.0</td>\n",
|
||||||
|
" <td>[sulphur, lowsulphur]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>26</th>\n",
|
||||||
|
" <td>sustainab</td>\n",
|
||||||
|
" <td>1516.0</td>\n",
|
||||||
|
" <td>1825.0</td>\n",
|
||||||
|
" <td>[sustainability, sustainable, sustainableshipp...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>27</th>\n",
|
||||||
|
" <td>zero</td>\n",
|
||||||
|
" <td>2972.0</td>\n",
|
||||||
|
" <td>1670.0</td>\n",
|
||||||
|
" <td>[zero, netzero, zerocarbon, zerocarbonship, ze...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </tbody>\n",
|
||||||
|
"</table>\n",
|
||||||
|
"</div>"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
" root mean_ranking std_ranking \\\n",
|
||||||
|
"0 CO2 3279.0 2165.0 \n",
|
||||||
|
"1 CSR 1345.0 0.0 \n",
|
||||||
|
"2 ESG 635.0 0.0 \n",
|
||||||
|
"3 SDG 423.0 0.0 \n",
|
||||||
|
"4 bio 3579.0 1252.0 \n",
|
||||||
|
"5 carb 1848.0 1396.0 \n",
|
||||||
|
"6 challeng 406.0 248.0 \n",
|
||||||
|
"7 chang 2054.0 1563.0 \n",
|
||||||
|
"8 clean 1709.0 859.0 \n",
|
||||||
|
"9 climate 2943.0 1978.0 \n",
|
||||||
|
"10 eco 3128.0 1228.0 \n",
|
||||||
|
"11 emissions 2912.0 2065.0 \n",
|
||||||
|
"12 environment 2537.0 1736.0 \n",
|
||||||
|
"13 future 1626.0 1540.0 \n",
|
||||||
|
"14 garbage 1772.0 511.0 \n",
|
||||||
|
"15 green 2580.0 1376.0 \n",
|
||||||
|
"16 methanol 1755.0 1110.0 \n",
|
||||||
|
"17 mission 3245.0 1937.0 \n",
|
||||||
|
"18 neutral 2384.0 1886.0 \n",
|
||||||
|
"19 ocean 2217.0 1657.0 \n",
|
||||||
|
"20 planet 1390.0 0.0 \n",
|
||||||
|
"21 plastic 2354.0 1587.0 \n",
|
||||||
|
"22 recycling 848.0 171.0 \n",
|
||||||
|
"23 reduc 1359.0 1199.0 \n",
|
||||||
|
"24 responsib 1840.0 1093.0 \n",
|
||||||
|
"25 sulphur 2572.0 1524.0 \n",
|
||||||
|
"26 sustainab 1516.0 1825.0 \n",
|
||||||
|
"27 zero 2972.0 1670.0 \n",
|
||||||
|
"\n",
|
||||||
|
" word_matches \n",
|
||||||
|
"0 [co2, co2emission, co2neutral] \n",
|
||||||
|
"1 [csr] \n",
|
||||||
|
"2 [esg] \n",
|
||||||
|
"3 [sdgs] \n",
|
||||||
|
"4 [biofuel, biofuels, biodiversity, biohuts] \n",
|
||||||
|
"5 [decarbonisation, carbon, decarbonization, car... \n",
|
||||||
|
"6 [challenges, challenge, challenging] \n",
|
||||||
|
"7 [change, changing, climatechange, changes, exc... \n",
|
||||||
|
"8 [theoceancleanup, cleanup, clean, cleanseas, o... \n",
|
||||||
|
"9 [climateaction, climate, climatechange, climat... \n",
|
||||||
|
"10 [ecosystem, eco, maerskecodelivery, ecofriendl... \n",
|
||||||
|
"11 [emissions, carbonemissions, zeroemissions] \n",
|
||||||
|
"12 [environment, environmental, unenvironment, en... \n",
|
||||||
|
"13 [future, futureproofing] \n",
|
||||||
|
"14 [garbage, greatpacificgarbagepatch] \n",
|
||||||
|
"15 [green, greenfuels, greener, greenfuel, greenl... \n",
|
||||||
|
"16 [methanol, emethanol] \n",
|
||||||
|
"17 [emissions, mission, carbonemissions, eucommis... \n",
|
||||||
|
"18 [neutral, carbonneutral, neutrality, co2neutral] \n",
|
||||||
|
"19 [ocean, theoceancleanup, oceans, oceanplastic,... \n",
|
||||||
|
"20 [planet] \n",
|
||||||
|
"21 [plastic, oceanplastic, plasticwaste, plasticp... \n",
|
||||||
|
"22 [recycling, shiprecycling] \n",
|
||||||
|
"23 [reduce, reducing, reduced, reduction, reducti... \n",
|
||||||
|
"24 [responsible, responsibility, responsibly, res... \n",
|
||||||
|
"25 [sulphur, lowsulphur] \n",
|
||||||
|
"26 [sustainability, sustainable, sustainableshipp... \n",
|
||||||
|
"27 [zero, netzero, zerocarbon, zerocarbonship, ze... "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 77,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"df = pd.DataFrame({\n",
|
||||||
|
" 'root': word_list,\n",
|
||||||
|
" 'mean_ranking': mean_idx_list,\n",
|
||||||
|
" 'std_ranking': sigma_idx_list,\n",
|
||||||
|
" 'word_matches': match_word_list\n",
|
||||||
|
"})\n",
|
||||||
|
"\n",
|
||||||
|
"df"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 78,
|
||||||
|
"id": "c4ea948f-66f6-405d-8b35-b390b1b3e4a7",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/html": [
|
||||||
|
"<div>\n",
|
||||||
|
"<style scoped>\n",
|
||||||
|
" .dataframe tbody tr th:only-of-type {\n",
|
||||||
|
" vertical-align: middle;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe tbody tr th {\n",
|
||||||
|
" vertical-align: top;\n",
|
||||||
|
" }\n",
|
||||||
|
"\n",
|
||||||
|
" .dataframe thead th {\n",
|
||||||
|
" text-align: right;\n",
|
||||||
|
" }\n",
|
||||||
|
"</style>\n",
|
||||||
|
"<table border=\"1\" class=\"dataframe\">\n",
|
||||||
|
" <thead>\n",
|
||||||
|
" <tr style=\"text-align: right;\">\n",
|
||||||
|
" <th></th>\n",
|
||||||
|
" <th>root</th>\n",
|
||||||
|
" <th>mean_ranking</th>\n",
|
||||||
|
" <th>std_ranking</th>\n",
|
||||||
|
" <th>word_matches</th>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </thead>\n",
|
||||||
|
" <tbody>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>0</th>\n",
|
||||||
|
" <td>challeng</td>\n",
|
||||||
|
" <td>406.0</td>\n",
|
||||||
|
" <td>248.0</td>\n",
|
||||||
|
" <td>[challenges, challenge, challenging]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>1</th>\n",
|
||||||
|
" <td>SDG</td>\n",
|
||||||
|
" <td>423.0</td>\n",
|
||||||
|
" <td>0.0</td>\n",
|
||||||
|
" <td>[sdgs]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>2</th>\n",
|
||||||
|
" <td>ESG</td>\n",
|
||||||
|
" <td>635.0</td>\n",
|
||||||
|
" <td>0.0</td>\n",
|
||||||
|
" <td>[esg]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>3</th>\n",
|
||||||
|
" <td>recycling</td>\n",
|
||||||
|
" <td>848.0</td>\n",
|
||||||
|
" <td>171.0</td>\n",
|
||||||
|
" <td>[recycling, shiprecycling]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>4</th>\n",
|
||||||
|
" <td>CSR</td>\n",
|
||||||
|
" <td>1345.0</td>\n",
|
||||||
|
" <td>0.0</td>\n",
|
||||||
|
" <td>[csr]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>5</th>\n",
|
||||||
|
" <td>reduc</td>\n",
|
||||||
|
" <td>1359.0</td>\n",
|
||||||
|
" <td>1199.0</td>\n",
|
||||||
|
" <td>[reduce, reducing, reduced, reduction, reducti...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>6</th>\n",
|
||||||
|
" <td>planet</td>\n",
|
||||||
|
" <td>1390.0</td>\n",
|
||||||
|
" <td>0.0</td>\n",
|
||||||
|
" <td>[planet]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>7</th>\n",
|
||||||
|
" <td>sustainab</td>\n",
|
||||||
|
" <td>1516.0</td>\n",
|
||||||
|
" <td>1825.0</td>\n",
|
||||||
|
" <td>[sustainability, sustainable, sustainableshipp...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>8</th>\n",
|
||||||
|
" <td>future</td>\n",
|
||||||
|
" <td>1626.0</td>\n",
|
||||||
|
" <td>1540.0</td>\n",
|
||||||
|
" <td>[future, futureproofing]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>9</th>\n",
|
||||||
|
" <td>clean</td>\n",
|
||||||
|
" <td>1709.0</td>\n",
|
||||||
|
" <td>859.0</td>\n",
|
||||||
|
" <td>[theoceancleanup, cleanup, clean, cleanseas, o...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>10</th>\n",
|
||||||
|
" <td>methanol</td>\n",
|
||||||
|
" <td>1755.0</td>\n",
|
||||||
|
" <td>1110.0</td>\n",
|
||||||
|
" <td>[methanol, emethanol]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>11</th>\n",
|
||||||
|
" <td>garbage</td>\n",
|
||||||
|
" <td>1772.0</td>\n",
|
||||||
|
" <td>511.0</td>\n",
|
||||||
|
" <td>[garbage, greatpacificgarbagepatch]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>12</th>\n",
|
||||||
|
" <td>responsib</td>\n",
|
||||||
|
" <td>1840.0</td>\n",
|
||||||
|
" <td>1093.0</td>\n",
|
||||||
|
" <td>[responsible, responsibility, responsibly, res...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>13</th>\n",
|
||||||
|
" <td>carb</td>\n",
|
||||||
|
" <td>1848.0</td>\n",
|
||||||
|
" <td>1396.0</td>\n",
|
||||||
|
" <td>[decarbonisation, carbon, decarbonization, car...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>14</th>\n",
|
||||||
|
" <td>chang</td>\n",
|
||||||
|
" <td>2054.0</td>\n",
|
||||||
|
" <td>1563.0</td>\n",
|
||||||
|
" <td>[change, changing, climatechange, changes, exc...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>15</th>\n",
|
||||||
|
" <td>ocean</td>\n",
|
||||||
|
" <td>2217.0</td>\n",
|
||||||
|
" <td>1657.0</td>\n",
|
||||||
|
" <td>[ocean, theoceancleanup, oceans, oceanplastic,...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>16</th>\n",
|
||||||
|
" <td>plastic</td>\n",
|
||||||
|
" <td>2354.0</td>\n",
|
||||||
|
" <td>1587.0</td>\n",
|
||||||
|
" <td>[plastic, oceanplastic, plasticwaste, plasticp...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>17</th>\n",
|
||||||
|
" <td>neutral</td>\n",
|
||||||
|
" <td>2384.0</td>\n",
|
||||||
|
" <td>1886.0</td>\n",
|
||||||
|
" <td>[neutral, carbonneutral, neutrality, co2neutral]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>18</th>\n",
|
||||||
|
" <td>environment</td>\n",
|
||||||
|
" <td>2537.0</td>\n",
|
||||||
|
" <td>1736.0</td>\n",
|
||||||
|
" <td>[environment, environmental, unenvironment, en...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>19</th>\n",
|
||||||
|
" <td>sulphur</td>\n",
|
||||||
|
" <td>2572.0</td>\n",
|
||||||
|
" <td>1524.0</td>\n",
|
||||||
|
" <td>[sulphur, lowsulphur]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>20</th>\n",
|
||||||
|
" <td>green</td>\n",
|
||||||
|
" <td>2580.0</td>\n",
|
||||||
|
" <td>1376.0</td>\n",
|
||||||
|
" <td>[green, greenfuels, greener, greenfuel, greenl...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>21</th>\n",
|
||||||
|
" <td>emissions</td>\n",
|
||||||
|
" <td>2912.0</td>\n",
|
||||||
|
" <td>2065.0</td>\n",
|
||||||
|
" <td>[emissions, carbonemissions, zeroemissions]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>22</th>\n",
|
||||||
|
" <td>climate</td>\n",
|
||||||
|
" <td>2943.0</td>\n",
|
||||||
|
" <td>1978.0</td>\n",
|
||||||
|
" <td>[climateaction, climate, climatechange, climat...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>23</th>\n",
|
||||||
|
" <td>zero</td>\n",
|
||||||
|
" <td>2972.0</td>\n",
|
||||||
|
" <td>1670.0</td>\n",
|
||||||
|
" <td>[zero, netzero, zerocarbon, zerocarbonship, ze...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>24</th>\n",
|
||||||
|
" <td>eco</td>\n",
|
||||||
|
" <td>3128.0</td>\n",
|
||||||
|
" <td>1228.0</td>\n",
|
||||||
|
" <td>[ecosystem, eco, maerskecodelivery, ecofriendl...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>25</th>\n",
|
||||||
|
" <td>mission</td>\n",
|
||||||
|
" <td>3245.0</td>\n",
|
||||||
|
" <td>1937.0</td>\n",
|
||||||
|
" <td>[emissions, mission, carbonemissions, eucommis...</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>26</th>\n",
|
||||||
|
" <td>CO2</td>\n",
|
||||||
|
" <td>3279.0</td>\n",
|
||||||
|
" <td>2165.0</td>\n",
|
||||||
|
" <td>[co2, co2emission, co2neutral]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" <tr>\n",
|
||||||
|
" <th>27</th>\n",
|
||||||
|
" <td>bio</td>\n",
|
||||||
|
" <td>3579.0</td>\n",
|
||||||
|
" <td>1252.0</td>\n",
|
||||||
|
" <td>[biofuel, biofuels, biodiversity, biohuts]</td>\n",
|
||||||
|
" </tr>\n",
|
||||||
|
" </tbody>\n",
|
||||||
|
"</table>\n",
|
||||||
|
"</div>"
|
||||||
|
],
|
||||||
|
"text/plain": [
|
||||||
|
" root mean_ranking std_ranking \\\n",
|
||||||
|
"0 challeng 406.0 248.0 \n",
|
||||||
|
"1 SDG 423.0 0.0 \n",
|
||||||
|
"2 ESG 635.0 0.0 \n",
|
||||||
|
"3 recycling 848.0 171.0 \n",
|
||||||
|
"4 CSR 1345.0 0.0 \n",
|
||||||
|
"5 reduc 1359.0 1199.0 \n",
|
||||||
|
"6 planet 1390.0 0.0 \n",
|
||||||
|
"7 sustainab 1516.0 1825.0 \n",
|
||||||
|
"8 future 1626.0 1540.0 \n",
|
||||||
|
"9 clean 1709.0 859.0 \n",
|
||||||
|
"10 methanol 1755.0 1110.0 \n",
|
||||||
|
"11 garbage 1772.0 511.0 \n",
|
||||||
|
"12 responsib 1840.0 1093.0 \n",
|
||||||
|
"13 carb 1848.0 1396.0 \n",
|
||||||
|
"14 chang 2054.0 1563.0 \n",
|
||||||
|
"15 ocean 2217.0 1657.0 \n",
|
||||||
|
"16 plastic 2354.0 1587.0 \n",
|
||||||
|
"17 neutral 2384.0 1886.0 \n",
|
||||||
|
"18 environment 2537.0 1736.0 \n",
|
||||||
|
"19 sulphur 2572.0 1524.0 \n",
|
||||||
|
"20 green 2580.0 1376.0 \n",
|
||||||
|
"21 emissions 2912.0 2065.0 \n",
|
||||||
|
"22 climate 2943.0 1978.0 \n",
|
||||||
|
"23 zero 2972.0 1670.0 \n",
|
||||||
|
"24 eco 3128.0 1228.0 \n",
|
||||||
|
"25 mission 3245.0 1937.0 \n",
|
||||||
|
"26 CO2 3279.0 2165.0 \n",
|
||||||
|
"27 bio 3579.0 1252.0 \n",
|
||||||
|
"\n",
|
||||||
|
" word_matches \n",
|
||||||
|
"0 [challenges, challenge, challenging] \n",
|
||||||
|
"1 [sdgs] \n",
|
||||||
|
"2 [esg] \n",
|
||||||
|
"3 [recycling, shiprecycling] \n",
|
||||||
|
"4 [csr] \n",
|
||||||
|
"5 [reduce, reducing, reduced, reduction, reducti... \n",
|
||||||
|
"6 [planet] \n",
|
||||||
|
"7 [sustainability, sustainable, sustainableshipp... \n",
|
||||||
|
"8 [future, futureproofing] \n",
|
||||||
|
"9 [theoceancleanup, cleanup, clean, cleanseas, o... \n",
|
||||||
|
"10 [methanol, emethanol] \n",
|
||||||
|
"11 [garbage, greatpacificgarbagepatch] \n",
|
||||||
|
"12 [responsible, responsibility, responsibly, res... \n",
|
||||||
|
"13 [decarbonisation, carbon, decarbonization, car... \n",
|
||||||
|
"14 [change, changing, climatechange, changes, exc... \n",
|
||||||
|
"15 [ocean, theoceancleanup, oceans, oceanplastic,... \n",
|
||||||
|
"16 [plastic, oceanplastic, plasticwaste, plasticp... \n",
|
||||||
|
"17 [neutral, carbonneutral, neutrality, co2neutral] \n",
|
||||||
|
"18 [environment, environmental, unenvironment, en... \n",
|
||||||
|
"19 [sulphur, lowsulphur] \n",
|
||||||
|
"20 [green, greenfuels, greener, greenfuel, greenl... \n",
|
||||||
|
"21 [emissions, carbonemissions, zeroemissions] \n",
|
||||||
|
"22 [climateaction, climate, climatechange, climat... \n",
|
||||||
|
"23 [zero, netzero, zerocarbon, zerocarbonship, ze... \n",
|
||||||
|
"24 [ecosystem, eco, maerskecodelivery, ecofriendl... \n",
|
||||||
|
"25 [emissions, mission, carbonemissions, eucommis... \n",
|
||||||
|
"26 [co2, co2emission, co2neutral] \n",
|
||||||
|
"27 [biofuel, biofuels, biodiversity, biohuts] "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 78,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"# sort values by ranking\n",
|
||||||
|
"df = df.sort_values(by='mean_ranking').reset_index(drop=True)\n",
|
||||||
|
"df"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 79,
|
||||||
|
"id": "7b3dbcf3-2d95-4a5e-b795-cea63da2a34a",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# save results\n",
|
||||||
|
"df['mean_ranking'] = df['mean_ranking'].astype(int)\n",
|
||||||
|
"df['std_ranking'] = df['std_ranking'].astype(int)\n",
|
||||||
|
"df.to_csv('word_root_ranking.csv')"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "ef515886-a918-49a0-b9df-7f20bfe4cea4",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "Python 3 (ipykernel)",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.10.9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 5
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user