Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
word_cloud_est
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
keeleliin
word_cloud_est
Commits
bfa3a953
Commit
bfa3a953
authored
Mar 18, 2016
by
Andreas Mueller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #139 from amueller/custom_regexp
allow a custom regexp
parents
6831a75a
682c7828
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
wordcloud/wordcloud.py
wordcloud/wordcloud.py
+8
-2
No files found.
wordcloud/wordcloud.py
View file @
bfa3a953
...
...
@@ -176,6 +176,10 @@ class WordCloud(object):
If you want to consider the word frequencies and not only their rank, relative_scaling
around .5 often looks good.
regexp : string or None (optional)
Regular expression to split the input text into tokens in process_text.
If None is specified, ``r"\w[\w']+"`` is used.
Attributes
----------
``words_``: list of tuples (string, float)
...
...
@@ -199,7 +203,7 @@ class WordCloud(object):
ranks_only
=
None
,
prefer_horizontal
=
0.9
,
mask
=
None
,
scale
=
1
,
color_func
=
random_color_func
,
max_words
=
200
,
min_font_size
=
4
,
stopwords
=
None
,
random_state
=
None
,
background_color
=
'black'
,
max_font_size
=
None
,
font_step
=
1
,
mode
=
"RGB"
,
relative_scaling
=
0
):
max_font_size
=
None
,
font_step
=
1
,
mode
=
"RGB"
,
relative_scaling
=
0
,
regexp
=
None
):
if
font_path
is
None
:
font_path
=
FONT_PATH
self
.
font_path
=
font_path
...
...
@@ -214,6 +218,7 @@ class WordCloud(object):
self
.
stopwords
=
stopwords
or
STOPWORDS
self
.
min_font_size
=
min_font_size
self
.
font_step
=
font_step
self
.
regexp
=
regexp
if
isinstance
(
random_state
,
int
):
random_state
=
Random
(
random_state
)
self
.
random_state
=
random_state
...
...
@@ -385,7 +390,8 @@ class WordCloud(object):
d
=
{}
flags
=
(
re
.
UNICODE
if
sys
.
version
<
'3'
and
type
(
text
)
is
unicode
else
0
)
for
word
in
re
.
findall
(
r
"\w[\w']+"
,
text
,
flags
=
flags
):
regexp
=
self
.
regexp
if
self
.
regexp
is
not
None
else
r
"\w[\w']+"
for
word
in
re
.
findall
(
regexp
,
text
,
flags
=
flags
):
if
word
.
isdigit
():
continue
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment