Skip to content

Docstring and module updates #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Future Release
* Fixes
* Changes
* Transition to use pyproject.toml and setup.cfg (moving away from setup.py) (:pr:`127`, :pr:`132`)
* ``Elmo`` and ``UniversalSentenceEncoder`` added to the ``nlp_primitives.tensorflow`` module namespace (:pr:`150`)
* Documentation Changes
* Testing Changes
* Fix latest dependency checker to create PR (:pr:`129`)
Expand Down
3 changes: 1 addition & 2 deletions nlp_primitives/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
from .whitespace_count import WhitespaceCount

if find_spec("tensorflow") and find_spec("tensorflow_hub"):
from .tensorflow.elmo import Elmo
from .tensorflow.universal_sentence_encoder import UniversalSentenceEncoder
from .tensorflow import Elmo, UniversalSentenceEncoder


nltk_data_path = pkg_resources.resource_filename("nlp_primitives", "data/nltk-data/")
Expand Down
1 change: 1 addition & 0 deletions nlp_primitives/count_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class CountString(TransformPrimitive):
"""Determines how many times a given string shows up in a text field.

Args:
string (str): The string to determine the count of. Defaults to
the word "the".
Expand Down
4 changes: 2 additions & 2 deletions nlp_primitives/num_unique_separators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class NumUniqueSeparators(TransformPrimitive):
"""Calculates the number of unique separators.
r"""Calculates the number of unique separators.

Description:
Given a string and a list of separators, determine
Expand All @@ -16,7 +16,7 @@ class NumUniqueSeparators(TransformPrimitive):

Args:
separators (list, optional): a list of separator characters to count.
`[`" ", ".", ",", "!", "?", ";", "\n"]` is used by default.
``[" ", ".", ",", "!", "?", ";", "\n"]`` is used by default.

Examples:
>>> x = ["First. Line.", "This. is the second, line!", "notinlist@#$%^%&"]
Expand Down
1 change: 1 addition & 0 deletions nlp_primitives/number_of_common_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

class NumberOfCommonWords(TransformPrimitive):
"""Determines the number of common words in a string.

Description:
Given string, determine the number of words that appear in a supplied word set.
The word set defaults to nlp_primitives.constants.common_words_1000. The string
Expand Down
3 changes: 3 additions & 0 deletions nlp_primitives/tensorflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# flake8: noqa
from .elmo import Elmo
from .universal_sentence_encoder import UniversalSentenceEncoder