@@ -33,6 +33,7 @@ def get_dash_app(
3333 exclude_pages : Optional [Set [PageName ]] = None ,
3434 document_names : Optional [List [str ]] = None ,
3535 group_labels : Optional [List [str ]] = None ,
36+ wordcloud_font_path : Optional [str ] = None ,
3637) -> Dash :
3738 """Returns topicwizard Dash application.
3839
@@ -50,6 +51,9 @@ def get_dash_app(
5051 You can pass it along if you have genre labels for example.
5152 In this case an additional page will get created with information
5253 about how these groups relate to topics and words in the corpus.
54+ wordcloud_font_path: str, default None
55+ Font to use for generating wordclouds.
56+ Open Sans is used by default.
5357
5458 Returns
5559 -------
@@ -64,6 +68,7 @@ def get_dash_app(
6468 or [f"Document { i } " for i , _ in enumerate (topic_data ["corpus" ])],
6569 group_labels = group_labels ,
6670 exclude_pages = exclude_pages ,
71+ wordcloud_font_path = wordcloud_font_path ,
6772 )
6873 app = Dash (
6974 __name__ ,
@@ -82,7 +87,9 @@ def get_dash_app(
8287 return app
8388
8489
85- def load_app (filename : str , exclude_pages : Optional [Iterable [PageName ]] = None ) -> Dash :
90+ def load_app (
91+ filename : str , exclude_pages : Optional [Iterable [PageName ]] = None , ** kwargs
92+ ) -> Dash :
8693 """Loads and prepares saved app from disk.
8794
8895 Parameters
@@ -100,7 +107,7 @@ def load_app(filename: str, exclude_pages: Optional[Iterable[PageName]] = None)
100107 exclude_pages = set ()
101108 else :
102109 exclude_pages = set (exclude_pages )
103- return get_dash_app (** data , exclude_pages = exclude_pages )
110+ return get_dash_app (** data , exclude_pages = exclude_pages , ** kwargs )
104111
105112
106113def open_url (url : str ) -> None :
@@ -156,6 +163,7 @@ def load(
156163 filename : str ,
157164 exclude_pages : Optional [Iterable [PageName ]] = None ,
158165 port : int = 8050 ,
166+ ** kwargs ,
159167) -> Optional [threading .Thread ]:
160168 """Visualizes topic model data loaded from disk.
161169
@@ -179,7 +187,7 @@ def load(
179187 """
180188 print ("Preparing data" )
181189 exclude_pages = set () if exclude_pages is None else set (exclude_pages )
182- app = load_app (filename , exclude_pages = exclude_pages )
190+ app = load_app (filename , exclude_pages = exclude_pages , ** kwargs )
183191 return run_app (app , port = port )
184192
185193
@@ -211,6 +219,7 @@ def visualize(
211219 exclude_pages : Optional [Iterable [PageName ]] = None ,
212220 group_labels : Optional [List [str ]] = None ,
213221 port : int = 8050 ,
222+ wordcloud_font_path : Optional [str ] = None ,
214223 ** kwargs ,
215224) -> Optional [threading .Thread ]:
216225 """Visualizes your topic model with topicwizard.
@@ -238,7 +247,9 @@ def visualize(
238247 You can pass it along if you have genre labels for example.
239248 In this case an additional page will get created with information
240249 about how these groups relate to topics and words in the corpus.
241-
250+ wordcloud_font_path: str, default None
251+ Font to use for generating wordclouds.
252+ Open Sans is used by default.
242253
243254 Returns
244255 -------
@@ -278,5 +289,6 @@ def visualize(
278289 document_names = document_names ,
279290 exclude_pages = exclude_pages ,
280291 group_labels = group_labels ,
292+ wordcloud_font_path = wordcloud_font_path ,
281293 )
282294 return run_app (app , port = port )
0 commit comments