Skip to content

Commit

Permalink
Merge pull request #8 from naqi324/master
Browse files Browse the repository at this point in the history
Added collocations parameter
  • Loading branch information
minimaxir authored Nov 9, 2019
2 parents bf3e921 + d793d46 commit ebeef0a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions stylecloud/stylecloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def gen_stylecloud(text=None,
gradient=None,
font_path=os.path.join(STATIC_PATH,
'Staatliches-Regular.ttf'),
random_state=None):
random_state=None,
collocations=True):
"""Generates a stylecloud!
:param text: Input text. Best used if calling the function directly.
:param file_path: File path of the input text/CSV. Best used on the CLI.
Expand All @@ -143,6 +144,7 @@ def gen_stylecloud(text=None,
:param gradient: Direction of gradient. (if not None, will use gradient)
:param font_path: Path to .ttf file for font to use in stylecloud.
:param random_state: Controls random state of words and colors.
:param collocations: Whether to include collocations (bigrams) of two words.
"""

assert any([text, file_path]
Expand Down Expand Up @@ -175,7 +177,8 @@ def colors(word, font_size, position,
font_path=font_path,
max_words=max_words, mask=mask_array,
stopwords=custom_stopwords if stopwords else None,
max_font_size=max_font_size, random_state=random_state)
max_font_size=max_font_size, random_state=random_state,
collocations=collocations)

# generate word cloud
if isinstance(text, str):
Expand Down

0 comments on commit ebeef0a

Please sign in to comment.