Repository: alteryx/woodwork
Pull request #1610 (2023-01-06 19:50:00)

Add `IsNaturalLanguage` property to `ColumnSchema`
This property could potentially be used in a featuretools utility

codecov[bot]: # [Codecov](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx) Report
> Merging [#1610](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx) (6cbb08b) into [main](https://codecov.io/gh/alteryx/woodwork/commit/35c87c69625c30e49950ebc7f5b3af2198e816c9?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx) (35c87c6) will **decrease** coverage by `81.18%`.
> The diff coverage is `66.66%`.

> :exclamation: Current head 6cbb08b differs from pull request most recent head 7d3045e. Consider uploading reports for the commit 7d3045e to get more accurate results

```diff
@@             Coverage Diff             @@
##             main    #1610       +/-   ##
===========================================
- Coverage   98.77%   17.58%   -81.19%     
===========================================
  Files          98       98               
  Lines       11573    11576        +3     
===========================================
- Hits        11431     2036     -9395     
- Misses        142     9540     +9398     
```


| [Impacted Files](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx) | Coverage Δ | |
|---|---|---|
| [woodwork/column\_schema.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvY29sdW1uX3NjaGVtYS5weQ==) | `61.94% <66.66%> (-38.06%)` | :arrow_down: |
| [woodwork/tests/test\_config.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvdGVzdHMvdGVzdF9jb25maWcucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [woodwork/tests/test\_version.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvdGVzdHMvdGVzdF92ZXJzaW9uLnB5) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [woodwork/tests/utils/test\_utils.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvdGVzdHMvdXRpbHMvdGVzdF91dGlscy5weQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [woodwork/tests/utils/test\_concat.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvdGVzdHMvdXRpbHMvdGVzdF9jb25jYXQucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [woodwork/tests/type\_system/conftest.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvdGVzdHMvdHlwZV9zeXN0ZW0vY29uZnRlc3QucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [woodwork/tests/utils/test\_read\_file.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvdGVzdHMvdXRpbHMvdGVzdF9yZWFkX2ZpbGUucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [woodwork/tests/accessor/test\_indexers.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvdGVzdHMvYWNjZXNzb3IvdGVzdF9pbmRleGVycy5weQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [woodwork/tests/demo\_tests/test\_retail.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvdGVzdHMvZGVtb190ZXN0cy90ZXN0X3JldGFpbC5weQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [woodwork/tests/fixtures/datetime\_freq.py](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx#diff-d29vZHdvcmsvdGVzdHMvZml4dHVyZXMvZGF0ZXRpbWVfZnJlcS5weQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [60 more](https://codecov.io/gh/alteryx/woodwork/pull/1610?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alteryx)


Patch:
diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst
index a076ddb..80f2c63 100644
--- a/docs/source/release_notes.rst
+++ b/docs/source/release_notes.rst
@@ -9,12 +9,13 @@ Future Release
     * Fixes
     * Changes
         * Bump scipy and scikit-learn min versions for compatibility with numpy 1.24.0 (:pr:`1606`)
+        * Add ``is_natural_language`` method to ``ColumnSchema`` object (:pr:`1610`)
         * Changed the ``transform`` function for the ``Boolean`` logical type to improve runtime (:pr:`1612`)
     * Documentation Changes
     * Testing Changes
 
     Thanks to the following people for contributing to this release:
-    :user:`thehomebrewnerd`
+    :user:`ParthivNaresh`, :user:`sbadithe`, :user:`thehomebrewnerd`
 
 
 v0.21.1 December 16, 2022
diff --git a/woodwork/column_schema.py b/woodwork/column_schema.py
index 2e5603d..b41d2b4 100644
--- a/woodwork/column_schema.py
+++ b/woodwork/column_schema.py
@@ -8,6 +8,7 @@ from woodwork.logical_types import (
     BooleanNullable,
     Datetime,
     LatLong,
+    NaturalLanguage,
     Ordinal,
     Unknown,
 )
@@ -161,6 +162,11 @@ class ColumnSchema(object):
         ltype_class = type(self.logical_type)
         return ltype_class == Boolean or ltype_class == BooleanNullable
 
+    @property
+    def is_natural_language(self):
+        """Whether the ColumnSchema is a Natural Language column"""
+        return type(self.logical_type) == NaturalLanguage
+
     @property
     def is_unknown(self):
         """Whether the ColumnSchema is a Unknown column"""


Test patch:
diff --git a/woodwork/tests/schema/test_column_schema.py b/woodwork/tests/schema/test_column_schema.py
index d22b6ea..4556b0e 100644
--- a/woodwork/tests/schema/test_column_schema.py
+++ b/woodwork/tests/schema/test_column_schema.py
@@ -223,6 +223,23 @@ def test_is_boolean():
     assert not empty_column.is_boolean
 
 
+def test_is_natural_language():
+    nl_column = ColumnSchema(logical_type=NaturalLanguage)
+    assert nl_column.is_natural_language
+
+    instantiated_column = ColumnSchema(logical_type=NaturalLanguage())
+    assert instantiated_column.is_natural_language
+
+    ordinal_column = ColumnSchema(logical_type=Ordinal(order=["a", "b'"]))
+    assert not ordinal_column.is_natural_language
+
+    datetime_col = ColumnSchema(logical_type=Datetime)
+    assert not datetime_col.is_natural_language
+
+    empty_column = ColumnSchema()
+    assert not empty_column.is_natural_language
+
+
 def test_is_datetime():
     datetime_column = ColumnSchema(logical_type=Datetime)
     assert datetime_column.is_datetime