{ "cells": [ { "cell_type": "markdown", "id": "9f7cc561-f375-4cd6-953f-65af221bc1ae", "metadata": {}, "source": [ "# Keyword Extraction Analysis\n", "Analyze buzzwords driving sentiment on any given day" ] }, { "cell_type": "code", "execution_count": 461, "id": "59e2493c-10e5-402f-9875-d07d989cd451", "metadata": { "execution": { "iopub.execute_input": "2025-04-30T02:14:47.665748Z", "iopub.status.busy": "2025-04-30T02:14:47.665748Z", "iopub.status.idle": "2025-04-30T02:14:47.674765Z", "shell.execute_reply": "2025-04-30T02:14:47.673749Z", "shell.execute_reply.started": "2025-04-30T02:14:47.665748Z" } }, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "markdown", "id": "d5b34940-8c46-421b-b00b-0badaca194fc", "metadata": {}, "source": [ "### Download data from HF Hub" ] }, { "cell_type": "code", "execution_count": 462, "id": "03be6fde-e68b-4026-8f90-cd6f5d5f21db", "metadata": { "execution": { "iopub.execute_input": "2025-04-30T02:14:49.167723Z", "iopub.status.busy": "2025-04-30T02:14:49.167723Z", "iopub.status.idle": "2025-04-30T02:14:50.725451Z", "shell.execute_reply": "2025-04-30T02:14:50.725451Z", "shell.execute_reply.started": "2025-04-30T02:14:49.167723Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Total records across 16 days: 4520\n" ] } ], "source": [ "from huggingface_hub import HfApi\n", "\n", "api = HfApi()\n", "all_files = api.list_repo_files(\"hblim/top_reddit_posts_daily\", repo_type=\"dataset\")\n", "parquet_files = sorted([f for f in all_files if f.startswith('data_scored') and f.endswith(\".parquet\")])\n", "\n", "df = []\n", "for shard in parquet_files:\n", " local_path = api.hf_hub_download(repo_id=\"hblim/top_reddit_posts_daily\", filename=shard, repo_type=\"dataset\")\n", " file_date = os.path.splitext(os.path.basename(local_path))[0]\n", " df.append(pd.read_parquet(local_path).assign(filedate=file_date))\n", "df = pd.concat(df, ignore_index=True)\n", "print(f\"Total records across {df.filedate.nunique()} days: {len(df)}\")" ] }, { "cell_type": "code", "execution_count": 464, "id": "dbcaf06b-9c29-4913-b3a9-938017eb6ffd", "metadata": { "execution": { "iopub.execute_input": "2025-04-30T02:14:51.655177Z", "iopub.status.busy": "2025-04-30T02:14:51.654664Z", "iopub.status.idle": "2025-04-30T02:14:51.669190Z", "shell.execute_reply": "2025-04-30T02:14:51.669190Z", "shell.execute_reply.started": "2025-04-30T02:14:51.655177Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
subredditcreated_atretrieved_attypetextscorepost_idparent_idsentimentconfidencefiledate
0apple2025-04-14 11:19:50-05:002025-04-14 23:44:27.136181-05:00postiPhone 16e Helps Apple Take Q1 2025 Top Spot in Global Smartphone Market\\n\\n6551jz2xrwNone10.99712025-04-14
1apple2025-04-14 11:00:16-05:002025-04-14 23:44:27.136181-05:00commentI've closed all rings every day starting on June 19 2015. This won't be a problem as long as I don't get run over or die.9mn2wpoit3_1jyzp0510.99652025-04-14
2apple2025-04-14 11:59:56-05:002025-04-14 23:44:27.136181-05:00postSmartphone tariffs are coming back in ‘a month or two,’ says Trump admin\\n\\n1941jz3wsiNone00.98292025-04-14
3apple2025-04-14 11:59:56-05:002025-04-14 23:44:27.136181-05:00commentThis topic has been automatically locked due to being controversial and/or political by nature. However, the submission itself will remain accessible as long as it is related to Apple.\\n\\n\\nThis decision was made by a bot based on specific keywords. If you feel that this was in error, please report it to the moderators so that it can be reviewed.\\n \\n\\n*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/apple) if you have any questions or concerns.*1mn38mact3_1jz3wsi00.99722025-04-14
4apple2025-04-14 18:04:42-05:002025-04-14 23:44:27.136181-05:00postApple to Analyze User Data on Devices to Bolster AI Technology\\n\\n691jzcpwzNone10.99762025-04-14
\n", "
" ], "text/plain": [ " subreddit created_at retrieved_at \\\n", "0 apple 2025-04-14 11:19:50-05:00 2025-04-14 23:44:27.136181-05:00 \n", "1 apple 2025-04-14 11:00:16-05:00 2025-04-14 23:44:27.136181-05:00 \n", "2 apple 2025-04-14 11:59:56-05:00 2025-04-14 23:44:27.136181-05:00 \n", "3 apple 2025-04-14 11:59:56-05:00 2025-04-14 23:44:27.136181-05:00 \n", "4 apple 2025-04-14 18:04:42-05:00 2025-04-14 23:44:27.136181-05:00 \n", "\n", " type \\\n", "0 post \n", "1 comment \n", "2 post \n", "3 comment \n", "4 post \n", "\n", " text \\\n", "0 iPhone 16e Helps Apple Take Q1 2025 Top Spot in Global Smartphone Market\\n\\n \n", "1 I've closed all rings every day starting on June 19 2015. This won't be a problem as long as I don't get run over or die. \n", "2 Smartphone tariffs are coming back in ‘a month or two,’ says Trump admin\\n\\n \n", "3 This topic has been automatically locked due to being controversial and/or political by nature. However, the submission itself will remain accessible as long as it is related to Apple.\\n\\n\\nThis decision was made by a bot based on specific keywords. If you feel that this was in error, please report it to the moderators so that it can be reviewed.\\n \\n\\n*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/apple) if you have any questions or concerns.* \n", "4 Apple to Analyze User Data on Devices to Bolster AI Technology\\n\\n \n", "\n", " score post_id parent_id sentiment confidence filedate \n", "0 655 1jz2xrw None 1 0.9971 2025-04-14 \n", "1 9 mn2wpoi t3_1jyzp05 1 0.9965 2025-04-14 \n", "2 194 1jz3wsi None 0 0.9829 2025-04-14 \n", "3 1 mn38mac t3_1jz3wsi 0 0.9972 2025-04-14 \n", "4 69 1jzcpwz None 1 0.9976 2025-04-14 " ] }, "execution_count": 464, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "markdown", "id": "958f8e47-37c9-4d53-9d20-41a29a0c2714", "metadata": {}, "source": [ "### Look at specific subreddit, date" ] }, { "cell_type": "code", "execution_count": 562, "id": "9f20145f-1ae0-4fa5-ac99-d00d9909cd76", "metadata": { "execution": { "iopub.execute_input": "2025-04-30T02:54:23.431576Z", "iopub.status.busy": "2025-04-30T02:54:23.431576Z", "iopub.status.idle": "2025-04-30T02:54:23.436791Z", "shell.execute_reply": "2025-04-30T02:54:23.436791Z", "shell.execute_reply.started": "2025-04-30T02:54:23.431576Z" } }, "outputs": [], "source": [ "# 1. Filter your dataframe\n", "date = '2025-04-14'\n", "subreddit = 'apple'\n", "day_sub = (df['filedate'] == date) & (df['subreddit'] == subreddit) " ] }, { "cell_type": "code", "execution_count": 589, "id": "2c286057-13db-49f4-a5d0-178a5d004b53", "metadata": { "execution": { "iopub.execute_input": "2025-04-30T03:24:38.658484Z", "iopub.status.busy": "2025-04-30T03:24:38.658484Z", "iopub.status.idle": "2025-04-30T03:24:38.669335Z", "shell.execute_reply": "2025-04-30T03:24:38.669335Z", "shell.execute_reply.started": "2025-04-30T03:24:38.658484Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Daily aggregated sentiment stats\n", "Community Weighted Sentiment = 0.3353147742165998\n", "Average Sentiment = 0.43902439024390244\n" ] } ], "source": [ "dftest = df[day_sub]\n", "print(\"Daily aggregated sentiment stats\")\n", "print(\"Community Weighted Sentiment =\",((2 * dftest['sentiment'] - 1) * np.log1p(dftest['score'].clip(0,None))).mean())\n", "print(\"Average Sentiment =\",dftest['sentiment'].mean())\n", "# dftest.sort_values('score',ascending=False)\n", "# dftest.groupby('parent_id').agg({'sentiment': ['mean','sum','count']})" ] }, { "cell_type": "markdown", "id": "85d4797e-c9dd-45b0-b72f-cb8d279f5ebc", "metadata": {}, "source": [ "### Use KeyBERT and sentiment transformers model to extract keywords" ] }, { "cell_type": "code", "execution_count": 587, "id": "8c0a4f6a-d34a-4397-add9-1d68e670eaf7", "metadata": { "execution": { "iopub.execute_input": "2025-04-30T02:59:03.237586Z", "iopub.status.busy": "2025-04-30T02:59:03.237586Z", "iopub.status.idle": "2025-04-30T02:59:05.388763Z", "shell.execute_reply": "2025-04-30T02:59:05.388763Z", "shell.execute_reply.started": "2025-04-30T02:59:03.237586Z" }, "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[('smartphone market', 0.5024), ('command thanks universal', 0.0662), ('dimensions leak years', 0.0196), ('wwdc non paywall', -0.0052), ('animations new techniques', -0.0178)]\n" ] } ], "source": [ "from keybert import KeyBERT\n", "from sentence_transformers import SentenceTransformer\n", "import spacy\n", "\n", "raw_text = \" \".join(df.loc[day_sub, 'text'].astype(str))\n", "\n", "# 2. Load spaCy with parser enabled for noun_chunks\n", "nlp = spacy.load(\"en_core_web_sm\") # keep the parser on\n", "doc = nlp(raw_text.lower())\n", "\n", "# 3. Build candidate phrases\n", "candidates = \" \".join(\n", " [chunk.text for chunk in doc.noun_chunks]\n", " + [ent.text for ent in doc.ents if ent.label_ in {\"PRODUCT\",\"EVENT\",}]\n", ")\n", "\n", "for exclude in ['google','pixel','android','apple','rationale','advice','blog','topic','locked','author','moderator','error','bot','comments','archive','support','discord']:\n", " candidates = candidates.replace(exclude,' ')\n", "\n", "# 4. Keyword extraction with local embeddings\n", "model = SentenceTransformer(\"all-MiniLM-L6-v2\")\n", "kw_model = KeyBERT(model)\n", "keywords = kw_model.extract_keywords(\n", " candidates,\n", " keyphrase_ngram_range=(1, 3),\n", " stop_words=\"english\",\n", " use_mmr=True,\n", " diversity=0.9,\n", " top_n=5\n", ")\n", "\n", "print(keywords)\n" ] }, { "cell_type": "markdown", "id": "3ea178ad-676c-4362-b817-e66563dce6de", "metadata": {}, "source": [ "### Ensure keywords actually match to posts or comments based on cosine similarity" ] }, { "cell_type": "code", "execution_count": 591, "id": "63e1b61f-cdcb-4c5a-9024-531e26eee495", "metadata": { "execution": { "iopub.execute_input": "2025-04-30T03:27:16.957826Z", "iopub.status.busy": "2025-04-30T03:27:16.957826Z", "iopub.status.idle": "2025-04-30T03:27:17.668631Z", "shell.execute_reply": "2025-04-30T03:27:17.667592Z", "shell.execute_reply.started": "2025-04-30T03:27:16.957826Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
keywordmean_sentimentcommunity_weighted_sentimentn_poststotal_score
0smartphone market-0.0769230.841451132798
1dimensions leak years-1.000000-5.9394232804
2animations new techniques1.0000002.944439118
3wwdc non paywall-1.000000-2.397895110
\n", "
" ], "text/plain": [ " keyword mean_sentiment community_weighted_sentiment \\\n", "0 smartphone market -0.076923 0.841451 \n", "1 dimensions leak years -1.000000 -5.939423 \n", "2 animations new techniques 1.000000 2.944439 \n", "3 wwdc non paywall -1.000000 -2.397895 \n", "\n", " n_posts total_score \n", "0 13 2798 \n", "1 2 804 \n", "2 1 18 \n", "3 1 10 " ] }, "execution_count": 591, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from sklearn.metrics.pairwise import cosine_similarity\n", "\n", "# 1) Precompute embeddings for all texts in your day/subreddit slice\n", "texts = df.loc[day_sub, 'text'].tolist()\n", "text_embs = model.encode(texts, convert_to_tensor=False) # shape: (n_texts, 384)\n", "\n", "results = []\n", "subsets = {}\n", "# if you only want to test on a single kw, iterate keywords_test instead\n", "for kw, _score in keywords: \n", " # kw is now a string\n", " kw_emb = model.encode(kw, convert_to_tensor=False) # shape: (384,)\n", " kw_emb = kw_emb.reshape(1, -1) # shape: (1, 384)\n", " \n", " sims = cosine_similarity(text_embs, kw_emb).flatten() # OK: (n_texts,) vs (1,384)\n", " \n", " # rank or threshold as before\n", " hits = df.loc[day_sub].iloc[sims.argsort()[::-1]]\n", " mask = sims >= 0.3\n", " \n", " subset = df.loc[day_sub].iloc[mask]\n", " if subset.empty:\n", " continue\n", " subsets[kw] = subset\n", " \n", " # compute sentiment stats on subset…\n", " mean_sent = 2 * subset['sentiment'].mean() - 1\n", " weighted = ((2 * subset['sentiment'] - 1) * np.log1p(subset['score'].clip(0,None))).mean()\n", " total_score = subset['score'].sum()\n", " results.append((kw, mean_sent, weighted, len(subset), total_score))\n", "\n", "summary = pd.DataFrame(results, columns=[\n", " 'keyword', 'mean_sentiment', 'community_weighted_sentiment', 'n_posts' , 'total_score'\n", "]).sort_values('total_score', ascending=False).reset_index(drop=True)\n", "\n", "summary" ] }, { "cell_type": "markdown", "id": "fbcbd745-8bbf-49f3-9fac-a4c9a056de6f", "metadata": {}, "source": [ "### Manually inspect posts and comments associated with the keyword" ] }, { "cell_type": "code", "execution_count": 593, "id": "1b2dadf2-c2b3-447a-bcdf-aec627635f49", "metadata": { "execution": { "iopub.execute_input": "2025-04-30T03:27:33.238178Z", "iopub.status.busy": "2025-04-30T03:27:33.237146Z", "iopub.status.idle": "2025-04-30T03:27:33.245143Z", "shell.execute_reply": "2025-04-30T03:27:33.245143Z", "shell.execute_reply.started": "2025-04-30T03:27:33.238178Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
KEYWORD = smartphone market
 subredditcreated_atretrieved_attypetextscorepost_idparent_idsentimentconfidencefiledate
0apple2025-04-14 11:19:50-05:002025-04-14 23:44:27.136181-05:00postiPhone 16e Helps Apple Take Q1 2025 Top Spot in Global Smartphone Market\n", "\n", "6551jz2xrwNone10.9971002025-04-14
2apple2025-04-14 11:59:56-05:002025-04-14 23:44:27.136181-05:00postSmartphone tariffs are coming back in ‘a month or two,’ says Trump admin\n", "\n", "1941jz3wsiNone00.9829002025-04-14
3apple2025-04-14 11:59:56-05:002025-04-14 23:44:27.136181-05:00commentThis topic has been automatically locked due to being controversial and/or political by nature. However, the submission itself will remain accessible as long as it is related to Apple.\n", "\n", "\n", "This decision was made by a bot based on specific keywords. If you feel that this was in error, please report it to the moderators so that it can be reviewed.\n", " \n", "\n", "*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/apple) if you have any questions or concerns.*1mn38mact3_1jz3wsi00.9972002025-04-14
23apple2025-04-14 11:43:39-05:002025-04-14 23:44:27.136181-05:00commentMy boss purchased me a 16e to use for iOS development. It may not make much sense for end users but it is a nearly perfect corporate phone.309mn35a6rt3_1jz2xrw10.9986002025-04-14
24apple2025-04-14 11:24:30-05:002025-04-14 23:44:27.136181-05:00commentDespite what the tech influencers might have said, Apple clearly knows what they’re doing.283mn31i1at3_1jz2xrw10.9996002025-04-14
\n" ], "text/plain": [ "" ] }, "execution_count": 593, "metadata": {}, "output_type": "execute_result" } ], "source": [ "keyword_index = 0\n", "subsets[summary.keyword[keyword_index]].head().style.set_caption(f\"KEYWORD = {summary.keyword[keyword_index]}\")" ] }, { "cell_type": "markdown", "id": "1f8adbfe-3141-417f-bc13-922b7f1098a7", "metadata": {}, "source": [ "### Helper tool: Retrieve post and comments by post_id" ] }, { "cell_type": "code", "execution_count": 534, "id": "ea794d80-bf98-47c7-877d-1b2e6a626b12", "metadata": { "execution": { "iopub.execute_input": "2025-04-30T02:46:15.966447Z", "iopub.status.busy": "2025-04-30T02:46:15.966447Z", "iopub.status.idle": "2025-04-30T02:46:15.979590Z", "shell.execute_reply": "2025-04-30T02:46:15.979590Z", "shell.execute_reply.started": "2025-04-30T02:46:15.966447Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
subredditcreated_atretrieved_attypetextscorepost_idparent_idsentimentconfidencefiledate
2748Android2025-04-23 08:15:55-05:002025-04-23 19:03:18.888116-05:00postThe new feature that gives higher memory priority to background tabs containing user edits, such as fillable forms or drafts (reducing the chance of them being killed and thus not losing your progress) is now available in Chrome Canary for Android.\\n\\n2241k5ywd6None00.97172025-04-23
2749Android2025-04-23 08:43:37-05:002025-04-23 19:03:18.888116-05:00commentAndroid's task refreshing is so bad and random that I've adapted my whole workflow around it by simply never trusting it and constantly copying whatever I input. If I write something and need switch away to another app even for a second, I copy the text before I do it. \\n\\nAndroid still does this even if you have 16GB of RAM!1molv84lt3_1k5ywd600.99962025-04-23
2750Android2025-04-23 08:19:42-05:002025-04-23 19:03:18.888116-05:00commentI love that \"it reduces the chance\" but it doesn't eliminate the chance something I am working on it is killed...1molr08ut3_1k5ywd610.98352025-04-23
2751Android2025-04-23 08:17:05-05:002025-04-23 19:03:18.888116-05:00commentContext: [**Background tabs containing user edits, such as filled forms or drafts, will soon have a higher memory priority in Chrome for Android, this will reduce the likelihood of these tabs been killed prematurely.**](https://old.reddit.com/r/Android/comments/1j3ktpg/background_tabs_containing_user_edits_such_as/)\\n\\n.\\n\\nThe patch responsible for this change [**was merged yesterday.**](https://chromium-review.googlesource.com/c/chromium/src/+/6321765)1molqjutt3_1k5ywd600.99962025-04-23
2752Android2025-04-23 12:13:43-05:002025-04-23 19:03:18.888116-05:00commentWould love it if Android would let me \"pin\" apps by default that I didn't want to come out of memory. Would be amazing for apps that are slow to re-open.1mon1t9vt3_1k5ywd600.99282025-04-23
2753Android2025-04-23 11:59:23-05:002025-04-23 19:03:18.888116-05:00commentSolid upgrade for Android users.1momytb8t3_1k5ywd610.99962025-04-23
\n", "
" ], "text/plain": [ " subreddit created_at retrieved_at \\\n", "2748 Android 2025-04-23 08:15:55-05:00 2025-04-23 19:03:18.888116-05:00 \n", "2749 Android 2025-04-23 08:43:37-05:00 2025-04-23 19:03:18.888116-05:00 \n", "2750 Android 2025-04-23 08:19:42-05:00 2025-04-23 19:03:18.888116-05:00 \n", "2751 Android 2025-04-23 08:17:05-05:00 2025-04-23 19:03:18.888116-05:00 \n", "2752 Android 2025-04-23 12:13:43-05:00 2025-04-23 19:03:18.888116-05:00 \n", "2753 Android 2025-04-23 11:59:23-05:00 2025-04-23 19:03:18.888116-05:00 \n", "\n", " type \\\n", "2748 post \n", "2749 comment \n", "2750 comment \n", "2751 comment \n", "2752 comment \n", "2753 comment \n", "\n", " text \\\n", "2748 The new feature that gives higher memory priority to background tabs containing user edits, such as fillable forms or drafts (reducing the chance of them being killed and thus not losing your progress) is now available in Chrome Canary for Android.\\n\\n \n", "2749 Android's task refreshing is so bad and random that I've adapted my whole workflow around it by simply never trusting it and constantly copying whatever I input. If I write something and need switch away to another app even for a second, I copy the text before I do it. \\n\\nAndroid still does this even if you have 16GB of RAM! \n", "2750 I love that \"it reduces the chance\" but it doesn't eliminate the chance something I am working on it is killed... \n", "2751 Context: [**Background tabs containing user edits, such as filled forms or drafts, will soon have a higher memory priority in Chrome for Android, this will reduce the likelihood of these tabs been killed prematurely.**](https://old.reddit.com/r/Android/comments/1j3ktpg/background_tabs_containing_user_edits_such_as/)\\n\\n.\\n\\nThe patch responsible for this change [**was merged yesterday.**](https://chromium-review.googlesource.com/c/chromium/src/+/6321765) \n", "2752 Would love it if Android would let me \"pin\" apps by default that I didn't want to come out of memory. Would be amazing for apps that are slow to re-open. \n", "2753 Solid upgrade for Android users. \n", "\n", " score post_id parent_id sentiment confidence filedate \n", "2748 224 1k5ywd6 None 0 0.9717 2025-04-23 \n", "2749 1 molv84l t3_1k5ywd6 0 0.9996 2025-04-23 \n", "2750 1 molr08u t3_1k5ywd6 1 0.9835 2025-04-23 \n", "2751 1 molqjut t3_1k5ywd6 0 0.9996 2025-04-23 \n", "2752 1 mon1t9v t3_1k5ywd6 0 0.9928 2025-04-23 \n", "2753 1 momytb8 t3_1k5ywd6 1 0.9996 2025-04-23 " ] }, "execution_count": 534, "metadata": {}, "output_type": "execute_result" } ], "source": [ "postid = '1k5ywd6'\n", "df[lambda x: ((x.post_id == postid) | (x.parent_id == f't3_{postid}'))]" ] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:reddit_streamlit]", "language": "python", "name": "conda-env-reddit_streamlit-py" }, "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.12.10" } }, "nbformat": 4, "nbformat_minor": 5 }