You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Chapter1/list/apply_functions_to_elements.ipynb
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -273,7 +273,7 @@
273
273
"id": "76e8e609",
274
274
"metadata": {},
275
275
"source": [
276
-
"### Use any and List Comprehension for List Condition Checking"
276
+
"### Simplify List Condition Evaluation with any and List Comprehensions"
277
277
]
278
278
},
279
279
{
@@ -282,7 +282,7 @@
282
282
"id": "2376b557",
283
283
"metadata": {},
284
284
"source": [
285
-
"If you want to check whether a statement is `True` for one or more items in a list, using `any` and list comprehension is simpler than using a for-loop and an if-else statement. "
285
+
"When checking if a condition is true for any list element in Python, use any with a list comprehension instead of a forloop and if-else statements for more readable code."
Copy file name to clipboardExpand all lines: Chapter5/natural_language_processing.ipynb
-72Lines changed: 0 additions & 72 deletions
Original file line number
Diff line number
Diff line change
@@ -23880,78 +23880,6 @@
23880
23880
"[Link to inflect](https://github.com/jaraco/inflect)."
23881
23881
]
23882
23882
},
23883
-
{
23884
-
"attachments": {},
23885
-
"cell_type": "markdown",
23886
-
"id": "ccc78b1b",
23887
-
"metadata": {},
23888
-
"source": [
23889
-
"### FlashText: Extract and Replace Keywords in Sentences"
23890
-
]
23891
-
},
23892
-
{
23893
-
"cell_type": "code",
23894
-
"execution_count": null,
23895
-
"id": "d163b267",
23896
-
"metadata": {},
23897
-
"outputs": [],
23898
-
"source": [
23899
-
"!pip install flashtext"
23900
-
]
23901
-
},
23902
-
{
23903
-
"attachments": {},
23904
-
"cell_type": "markdown",
23905
-
"id": "d58089ec",
23906
-
"metadata": {},
23907
-
"source": [
23908
-
"Have you ever wanted to extract similar keywords and turn them into one standard keyword? If so, try FlashText. \n",
23909
-
"\n",
23910
-
"FlashText allows you to extract or replace keywords in sentences. \n",
23911
-
"\n",
23912
-
"In the code below, we use FlashText to extract the keywords `CEO` and `Python programming language` from a sentence that contains only the keywords `ceo` and `Python`."
23913
-
]
23914
-
},
23915
-
{
23916
-
"cell_type": "code",
23917
-
"execution_count": 10,
23918
-
"id": "87541cd0",
23919
-
"metadata": {},
23920
-
"outputs": [
23921
-
{
23922
-
"data": {
23923
-
"text/plain": [
23924
-
"['CEO', 'Python programming language']"
23925
-
]
23926
-
},
23927
-
"execution_count": 10,
23928
-
"metadata": {},
23929
-
"output_type": "execute_result"
23930
-
}
23931
-
],
23932
-
"source": [
23933
-
"from flashtext import KeywordProcessor\n",
23934
-
"\n",
23935
-
"kw_processor = KeywordProcessor()\n",
23936
-
"kw_dict = {\n",
23937
-
" \"CEO\": [\"Chief Executive Officer\", \"ceo\"], # Similar keywords to CEO\n",
Copy file name to clipboardExpand all lines: docs/Chapter1/list/apply_functions_to_elements.html
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -518,7 +518,7 @@ <h2> Contents </h2>
518
518
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#filter-get-the-elements-of-an-iterable-that-a-function-evaluates-true">2.3.5.3. filter: Get the Elements of an Iterable that a Function Evaluates True</a></li>
519
519
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#map-method-apply-a-function-to-each-item-of-an-iterable">2.3.5.4. map method: Apply a Function to Each Item of an Iterable</a></li>
520
520
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#sort-sort-a-list-of-tuples-by-the-first-or-second-item">2.3.5.5. sort: Sort a List of Tuples by the First or Second Item</a></li>
521
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#use-any-and-list-comprehension-for-list-condition-checking">2.3.5.6. Use any and List Comprehension for List Condition Checking</a></li>
521
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#simplify-list-condition-evaluation-with-any-and-list-comprehensions">2.3.5.6. Simplify List Condition Evaluation with any and List Comprehensions</a></li>
522
522
</ul>
523
523
</nav>
524
524
</div>
@@ -641,9 +641,9 @@ <h2><span class="section-number">2.3.5.5. </span>sort: Sort a List of Tuples by
<h2><spanclass="section-number">2.3.5.6. </span>Use any and List Comprehension for List Condition Checking<aclass="headerlink" href="#use-any-and-list-comprehension-for-list-condition-checking" title="Permalink to this heading">#</a></h2>
646
-
<p>If you want to check whether a statement is <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>for one or more items in a list, using <codeclass="docutils literal notranslate"><spanclass="pre">any</span></code> and list comprehension is simpler than using a for-loop and an if-else statement.</p>
<h2><spanclass="section-number">2.3.5.6. </span>Simplify List Condition Evaluation with any and List Comprehensions<aclass="headerlink" href="#simplify-list-condition-evaluation-with-any-and-list-comprehensions" title="Permalink to this heading">#</a></h2>
646
+
<p>When checking if a condition is true for any list element in Python, use any with a list comprehension instead of a forloop and if-else statements for more readable code.</p>
@@ -762,7 +762,7 @@ <h2><span class="section-number">2.3.5.6. </span>Use any and List Comprehension
762
762
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#filter-get-the-elements-of-an-iterable-that-a-function-evaluates-true">2.3.5.3. filter: Get the Elements of an Iterable that a Function Evaluates True</a></li>
763
763
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#map-method-apply-a-function-to-each-item-of-an-iterable">2.3.5.4. map method: Apply a Function to Each Item of an Iterable</a></li>
764
764
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#sort-sort-a-list-of-tuples-by-the-first-or-second-item">2.3.5.5. sort: Sort a List of Tuples by the First or Second Item</a></li>
765
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#use-any-and-list-comprehension-for-list-condition-checking">2.3.5.6. Use any and List Comprehension for List Condition Checking</a></li>
765
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#simplify-list-condition-evaluation-with-any-and-list-comprehensions">2.3.5.6. Simplify List Condition Evaluation with any and List Comprehensions</a></li>
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#flashtext-extract-and-replace-keywords-in-sentences">6.6.19. FlashText: Extract and Replace Keywords in Sentences</a></li>
535
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#ekphrasis-text-processing-tool-for-social-media-text">6.6.20. ekphrasis: Text Processing Tool For Social Media Text</a></li>
536
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#chroma-the-lightning-fast-solution-to-text-embeddings-and-querying">6.6.21. Chroma: The Lightning-Fast Solution to Text Embeddings and Querying</a></li>
537
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#galatic-clean-and-analyze-massive-text-datasets">6.6.22. Galatic: Clean and Analyze Massive Text Datasets</a></li>
538
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#efficient-keyword-extraction-and-replacement-with-flashtext">6.6.23. Efficient Keyword Extraction and Replacement with FlashText</a></li>
534
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#ekphrasis-text-processing-tool-for-social-media-text">6.6.19. ekphrasis: Text Processing Tool For Social Media Text</a></li>
535
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#chroma-the-lightning-fast-solution-to-text-embeddings-and-querying">6.6.20. Chroma: The Lightning-Fast Solution to Text Embeddings and Querying</a></li>
536
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#galatic-clean-and-analyze-massive-text-datasets">6.6.21. Galatic: Clean and Analyze Massive Text Datasets</a></li>
537
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#efficient-keyword-extraction-and-replacement-with-flashtext">6.6.22. Efficient Keyword Extraction and Replacement with FlashText</a></li>
<h2><spanclass="section-number">6.6.19. </span>FlashText: Extract and Replace Keywords in Sentences<aclass="headerlink" href="#flashtext-extract-and-replace-keywords-in-sentences" title="Permalink to this heading">#</a></h2>
<p>Have you ever wanted to extract similar keywords and turn them into one standard keyword? If so, try FlashText.</p>
2097
-
<p>FlashText allows you to extract or replace keywords in sentences.</p>
2098
-
<p>In the code below, we use FlashText to extract the keywords <codeclass="docutils literal notranslate"><spanclass="pre">CEO</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">Python</span><spanclass="pre">programming</span><spanclass="pre">language</span></code> from a sentence that contains only the keywords <codeclass="docutils literal notranslate"><spanclass="pre">ceo</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">Python</span></code>.</p>
<spanclass="s2">"CEO"</span><spanclass="p">:</span><spanclass="p">[</span><spanclass="s2">"Chief Executive Officer"</span><spanclass="p">,</span><spanclass="s2">"ceo"</span><spanclass="p">],</span><spanclass="c1"># Similar keywords to CEO</span>
<h2><spanclass="section-number">6.6.20. </span>ekphrasis: Text Processing Tool For Social Media Text<aclass="headerlink" href="#ekphrasis-text-processing-tool-for-social-media-text" title="Permalink to this heading">#</a></h2>
2087
+
<h2><spanclass="section-number">6.6.19. </span>ekphrasis: Text Processing Tool For Social Media Text<aclass="headerlink" href="#ekphrasis-text-processing-tool-for-social-media-text" title="Permalink to this heading">#</a></h2>
<h2><spanclass="section-number">6.6.21. </span>Chroma: The Lightning-Fast Solution to Text Embeddings and Querying<aclass="headerlink" href="#chroma-the-lightning-fast-solution-to-text-embeddings-and-querying" title="Permalink to this heading">#</a></h2>
2146
+
<h2><spanclass="section-number">6.6.20. </span>Chroma: The Lightning-Fast Solution to Text Embeddings and Querying<aclass="headerlink" href="#chroma-the-lightning-fast-solution-to-text-embeddings-and-querying" title="Permalink to this heading">#</a></h2>
<h2><spanclass="section-number">6.6.22. </span>Galatic: Clean and Analyze Massive Text Datasets<aclass="headerlink" href="#galatic-clean-and-analyze-massive-text-datasets" title="Permalink to this heading">#</a></h2>
2199
+
<h2><spanclass="section-number">6.6.21. </span>Galatic: Clean and Analyze Massive Text Datasets<aclass="headerlink" href="#galatic-clean-and-analyze-massive-text-datasets" title="Permalink to this heading">#</a></h2>
<h2><spanclass="section-number">6.6.23. </span>Efficient Keyword Extraction and Replacement with FlashText<aclass="headerlink" href="#efficient-keyword-extraction-and-replacement-with-flashtext" title="Permalink to this heading">#</a></h2>
2336
+
<h2><spanclass="section-number">6.6.22. </span>Efficient Keyword Extraction and Replacement with FlashText<aclass="headerlink" href="#efficient-keyword-extraction-and-replacement-with-flashtext" title="Permalink to this heading">#</a></h2>
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#flashtext-extract-and-replace-keywords-in-sentences">6.6.19. FlashText: Extract and Replace Keywords in Sentences</a></li>
2496
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#ekphrasis-text-processing-tool-for-social-media-text">6.6.20. ekphrasis: Text Processing Tool For Social Media Text</a></li>
2497
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#chroma-the-lightning-fast-solution-to-text-embeddings-and-querying">6.6.21. Chroma: The Lightning-Fast Solution to Text Embeddings and Querying</a></li>
2498
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#galatic-clean-and-analyze-massive-text-datasets">6.6.22. Galatic: Clean and Analyze Massive Text Datasets</a></li>
2499
-
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#efficient-keyword-extraction-and-replacement-with-flashtext">6.6.23. Efficient Keyword Extraction and Replacement with FlashText</a></li>
2458
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#ekphrasis-text-processing-tool-for-social-media-text">6.6.19. ekphrasis: Text Processing Tool For Social Media Text</a></li>
2459
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#chroma-the-lightning-fast-solution-to-text-embeddings-and-querying">6.6.20. Chroma: The Lightning-Fast Solution to Text Embeddings and Querying</a></li>
2460
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#galatic-clean-and-analyze-massive-text-datasets">6.6.21. Galatic: Clean and Analyze Massive Text Datasets</a></li>
2461
+
<liclass="toc-h2 nav-item toc-entry"><aclass="reference internal nav-link" href="#efficient-keyword-extraction-and-replacement-with-flashtext">6.6.22. Efficient Keyword Extraction and Replacement with FlashText</a></li>
0 commit comments