Word Clouds¤
Static Word Clouds¤
WordCloud
pydantic-model
¤
Bases: BaseModel
A Pydantic model for WordCloud options.
Config:
arbitrary_types_allowed:Truejson_schema_extra:DocJSONSchema.model_json_schema()
Fields:
-
data(single_doc_types | multi_doc_types | DataFrame) -
docs(Optional[int | str | list[int] | list[str]]) -
limit(Optional[int]) -
title(Optional[str]) -
height(int) -
width(int) -
opts(dict[str, Any]) -
figure_opts(dict[str, Any]) -
round(Optional[int]) -
counts(dict[str, int]) -
cloud(WordCloud | None) -
fig(Optional[Figure])
Source code in lexos/visualization/cloud.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
data: single_doc_types | multi_doc_types | pd.DataFrame
pydantic-field
¤
The data to generate the word cloud from. Accepts data from a string, list of lists or tuples, a dict with terms as keys and counts/frequencies as values, or a dataframe.
docs: Optional[int | str | list[int] | list[str]] = None
pydantic-field
¤
A list of documents to be selected from the DTM.
fig: Optional[plt.Figure] = None
pydantic-field
¤
The matplotlib figure object for the word cloud.
figure_opts: dict[str, Any]
pydantic-field
¤
A dict of matplotlib figure options.
height: int = 200
pydantic-field
¤
The height of the word cloud in pixels.
limit: Optional[int] = None
pydantic-field
¤
The maximum number of terms to plot.
opts: dict[str, Any]
pydantic-field
¤
The WordCloud() options.
round: Optional[int] = 0
pydantic-field
¤
An integer to apply a mask that rounds the word cloud. It is best to use 100 or higher for a circular mask, but it will depend on the height and width of the word cloud.
title: Optional[str] = None
pydantic-field
¤
The title of the plot.
width: int = 200
pydantic-field
¤
The width of the word cloud in pixels.
__init__(**data: Any) -> None
¤
Initialize the WordCloud model.
Source code in lexos/visualization/cloud.py
save(path: Path | str, **kwargs: Any) -> None
¤
Save the WordCloud to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
The file path to save the WordCloud image. |
required |
**kwargs
|
Any
|
Additional keyword arguments for |
{}
|
Source code in lexos/visualization/cloud.py
show() -> None
¤
Show the figure if it is hidden.
This is a helper method. It will generally display in a Jupyter notebook.
Source code in lexos/visualization/cloud.py
data: single_doc_types | multi_doc_types | pd.DataFrame
pydantic-field
¤
The data to generate the word cloud from. Accepts data from a string, list of lists or tuples, a dict with terms as keys and counts/frequencies as values, or a dataframe.
docs: Optional[int | str | list[int] | list[str]] = None
pydantic-field
¤
A list of documents to be selected from the DTM.
limit: Optional[int] = None
pydantic-field
¤
The maximum number of terms to plot.
title: Optional[str] = None
pydantic-field
¤
The title of the plot.
height: int = 200
pydantic-field
¤
The height of the word cloud in pixels.
width: int = 200
pydantic-field
¤
The width of the word cloud in pixels.
opts: dict[str, Any]
pydantic-field
¤
The WordCloud() options.
figure_opts: dict[str, Any]
pydantic-field
¤
A dict of matplotlib figure options.
round: Optional[int] = 0
pydantic-field
¤
An integer to apply a mask that rounds the word cloud. It is best to use 100 or higher for a circular mask, but it will depend on the height and width of the word cloud.
counts: dict[str, int]
pydantic-field
¤
cloud: PythonWordCloud | None
pydantic-field
¤
fig: Optional[plt.Figure] = None
pydantic-field
¤
The matplotlib figure object for the word cloud.
model_config = ConfigDict(arbitrary_types_allowed=True, json_schema_extra=(DocJSONSchema.model_json_schema()))
class-attribute
instance-attribute
¤
__init__(**data: Any) -> None
¤
Initialize the WordCloud model.
Source code in lexos/visualization/cloud.py
save(path: Path | str, **kwargs: Any) -> None
¤
Save the WordCloud to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
The file path to save the WordCloud image. |
required |
**kwargs
|
Any
|
Additional keyword arguments for |
{}
|
Source code in lexos/visualization/cloud.py
show() -> None
¤
Show the figure if it is hidden.
This is a helper method. It will generally display in a Jupyter notebook.
Source code in lexos/visualization/cloud.py
MultiCloud
pydantic-model
¤
Bases: BaseModel
A Pydantic model for creating multiple WordClouds arranged in a grid using the topic_clouds approach.
Config:
arbitrary_types_allowed:Truejson_schema_extra:DocJSONSchema.model_json_schema()
Fields:
-
data(list[str] | list[list[str]] | list[Doc] | list[Span] | DTM | DataFrame) -
docs(Optional[int | str | list[int] | list[str]]) -
limit(Optional[int]) -
figsize(tuple[int, int]) -
layout(Optional[str | tuple[int, int]]) -
opts(dict[str, Any]) -
round(Optional[int]) -
title(Optional[str]) -
labels(Optional[list[str]]) -
doc_data(Optional[list[dict[str, int | float]]]) -
fig(Optional[Figure]) -
wordcloud(Optional[WordCloud])
Source code in lexos/visualization/cloud.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
data: list[str] | list[list[str]] | list[Doc] | list[Span] | DTM | pd.DataFrame
pydantic-field
¤
The data to generate word clouds from. Accepts list of documents, DTM, or DataFrame.
docs: Optional[int | str | list[int] | list[str]] = None
pydantic-field
¤
A list of documents to be selected from the DTM/DataFrame.
fig: Optional[plt.Figure] = None
pydantic-field
¤
The matplotlib figure object for the multi-cloud plot.
figsize: tuple[int, int] = (10, 10)
pydantic-field
¤
The size of the overall figure.
labels: Optional[list[str]] = None
pydantic-field
¤
Labels for each subplot/word cloud.
layout: Optional[str | tuple[int, int]] = 'auto'
pydantic-field
¤
The number of rows and columns in the figure. Default is 'auto'.
limit: Optional[int] = None
pydantic-field
¤
The maximum number of terms to plot per cloud.
opts: dict[str, Any]
pydantic-field
¤
The WordCloud() options applied to each word cloud.
round: Optional[int] = 0
pydantic-field
¤
An integer to apply a mask that rounds each word cloud. It is best to use 100 or higher for a circular mask.
title: Optional[str] = None
pydantic-field
¤
Overall title for the figure.
__init__(**data: Any) -> None
¤
Initialize the MultiCloud model.
Source code in lexos/visualization/cloud.py
save(path: Path | str, **kwargs: Any) -> None
¤
Save the MultiCloud figure to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
The file path to save the MultiCloud image. |
required |
**kwargs
|
Any
|
Additional keyword arguments for |
{}
|
Source code in lexos/visualization/cloud.py
show() -> None
¤
Display the multi-cloud figure.
Source code in lexos/visualization/cloud.py
data: list[str] | list[list[str]] | list[Doc] | list[Span] | DTM | pd.DataFrame
pydantic-field
¤
The data to generate word clouds from. Accepts list of documents, DTM, or DataFrame.
docs: Optional[int | str | list[int] | list[str]] = None
pydantic-field
¤
A list of documents to be selected from the DTM/DataFrame.
limit: Optional[int] = None
pydantic-field
¤
The maximum number of terms to plot per cloud.
figsize: tuple[int, int] = (10, 10)
pydantic-field
¤
The size of the overall figure.
layout: Optional[str | tuple[int, int]] = 'auto'
pydantic-field
¤
The number of rows and columns in the figure. Default is 'auto'.
opts: dict[str, Any]
pydantic-field
¤
The WordCloud() options applied to each word cloud.
round: Optional[int] = 0
pydantic-field
¤
An integer to apply a mask that rounds each word cloud. It is best to use 100 or higher for a circular mask.
title: Optional[str] = None
pydantic-field
¤
Overall title for the figure.
labels: Optional[list[str]] = None
pydantic-field
¤
Labels for each subplot/word cloud.
doc_data: Optional[list[dict[str, int | float]]]
pydantic-field
¤
fig: Optional[plt.Figure] = None
pydantic-field
¤
The matplotlib figure object for the multi-cloud plot.
wordcloud: Optional[PythonWordCloud]
pydantic-field
¤
model_config = ConfigDict(arbitrary_types_allowed=True, json_schema_extra=(DocJSONSchema.model_json_schema()))
class-attribute
instance-attribute
¤
__init__(**data: Any) -> None
¤
Initialize the MultiCloud model.
Source code in lexos/visualization/cloud.py
_process_data() -> list[dict[str, int | float]]
¤
Process the input data into individual document dictionaries.
Source code in lexos/visualization/cloud.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
_setup_wordcloud() -> PythonWordCloud
¤
Configure a single WordCloud object to be reused.
Source code in lexos/visualization/cloud.py
MultiCloudOld
pydantic-model
¤
Bases: BaseModel
A Pydantic model for creating multiple WordClouds arranged in a grid.
NOTE: This Class is deprecated.¤
Config:
arbitrary_types_allowed:Truejson_schema_extra:DocJSONSchema.model_json_schema()
Fields:
-
data(list[str] | list[list[str]] | list[Doc] | list[Span] | DTM | DataFrame) -
docs(Optional[int | str | list[int] | list[str]]) -
limit(Optional[int]) -
ncols(int) -
height(int) -
width(int) -
opts(Optional[dict[str, Any]]) -
figure_opts(Optional[dict[str, Any]]) -
round(Optional[int]) -
title(Optional[str]) -
labels(Optional[list[str]]) -
padding(float) -
clouds(list[WordCloud]) -
fig(Optional[Figure])
Source code in lexos/visualization/cloud.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | |
data: list[str] | list[list[str]] | list[Doc] | list[Span] | DTM | pd.DataFrame
pydantic-field
¤
The data to generate word clouds from. Accepts list of documents, DTM, or DataFrame.
docs: Optional[int | str | list[int] | list[str]] = None
pydantic-field
¤
A list of documents to be selected from the DTM/DataFrame.
fig: Optional[plt.Figure] = None
pydantic-field
¤
The matplotlib figure object for the multi-cloud plot.
figure_opts: Optional[dict[str, Any]] = {}
pydantic-field
¤
A dict of matplotlib figure options.
height: int = 200
pydantic-field
¤
The height of each word cloud in pixels.
labels: Optional[list[str]] = None
pydantic-field
¤
Labels for each subplot/word cloud.
limit: Optional[int] = None
pydantic-field
¤
The maximum number of terms to plot.
ncols: int = 3
pydantic-field
¤
Number of columns in the grid layout.
opts: Optional[dict[str, Any]] = {'background_color': 'white', 'max_words': 2000, 'contour_width': 0, 'contour_color': 'steelblue'}
pydantic-field
¤
The WordCloud() options applied to each word cloud.
padding: float = 0.3
pydantic-field
¤
Amount of padding between subplots (0.0 to 1.0).
round: Optional[int] = 0
pydantic-field
¤
An integer to apply a mask that rounds each word cloud. It is best to use 100 or higher for a circular mask.
title: Optional[str] = None
pydantic-field
¤
Overall title for the figure.
width: int = 200
pydantic-field
¤
The width of each word cloud in pixels.
__init__(**data: Any) -> None
¤
Initialize the MultiCloud model.
Source code in lexos/visualization/cloud.py
get_clouds() -> list[WordCloud]
¤
save(path: Path | str, **kwargs: Any) -> None
¤
Save the MultiCloud figure to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
The file path to save the MultiCloud image. |
required |
**kwargs
|
Any
|
Additional keyword arguments for |
{}
|
Source code in lexos/visualization/cloud.py
__init__(**data: Any) -> None
¤
Initialize the MultiCloud model.
Source code in lexos/visualization/cloud.py
_process_data() -> list
¤
Process the input data into individual documents.
Source code in lexos/visualization/cloud.py
_render() -> None
¤
Generate and display the multi-cloud figure.
Source code in lexos/visualization/cloud.py
save(path: Path | str, **kwargs: Any) -> None
¤
Save the MultiCloud figure to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
The file path to save the MultiCloud image. |
required |
**kwargs
|
Any
|
Additional keyword arguments for |
{}
|
Source code in lexos/visualization/cloud.py
get_clouds() -> list[WordCloud]
¤
show() -> plt.Figure
¤
D3 Word Clouds¤
D3WordCloud
pydantic-model
¤
Bases: BaseModel
A Pydantic model for D3 WordCloud options.
Config:
arbitrary_types_allowed:Truejson_schema_extra:DocJSONSchema.model_json_schema()
Fields:
-
data(single_doc_types | multi_doc_types | DataFrame) -
docs(Optional[int | str | list[int] | list[str]]) -
layout(dict[str, Any]) -
limit(int) -
font(str) -
spiral(str) -
scale(str) -
angle_count(int) -
angle_from(int) -
angle_to(int) -
width(int) -
height(int) -
title(str) -
background_color(str) -
colorscale(str) -
auto_open(bool) -
template(Path | str) -
include_d3js(bool | str | None) -
include_d3_cloud(bool | str) -
counts(dict[str, int]) -
html(str)
Validators:
Source code in lexos/visualization/d3_wordcloud.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
angle_count: int = 5
pydantic-field
¤
The number of angles to use for the word cloud.
angle_from: int = -60
pydantic-field
¤
The starting angle for the word cloud.
angle_to: int = 60
pydantic-field
¤
The ending angle for the word cloud.
auto_open: bool = True
pydantic-field
¤
Whether to open the chart in a web browser automatically.
background_color: str = 'white'
pydantic-field
¤
The background color of the word cloud.
colorscale: str = 'd3.scale.category20b'
pydantic-field
¤
The name of a categorical d3 scale to use for the word cloud. See https://d3js.org/d3-scale.
data: single_doc_types | multi_doc_types | pd.DataFrame
pydantic-field
¤
The data to generate the word cloud from. Accepts data from a string, list of lists or tuples, a dict with terms as keys and counts/frequencies as values, or a dataframe.
docs: Optional[int | str | list[int] | list[str]] = None
pydantic-field
¤
A list of documents to be selected from the DTM.
font: str = 'Impact'
pydantic-field
¤
The font to use for the word cloud.
height: int = 600
pydantic-field
¤
The height of the word cloud in pixels.
html: str = ''
pydantic-field
¤
The HTML representation of the word cloud.
include_d3_cloud: bool | str = True
pydantic-field
¤
Whether to include the D3 cloud library. Can be a custom path to a JavaScript file or True to use the default bundled version.
include_d3js: bool | str | None = True
pydantic-field
¤
Whether to include the D3.js library. Can be 'cdn', 'directory', or a custom path. If False, the D3.js library will not be included. The cloud bundle is always included unless the setting is 'directory' or False.
limit: int = 100
pydantic-field
¤
The maximum number of terms in the cloud.
scale: str = 'log'
pydantic-field
¤
The scale type to use for the word cloud, 'log', 'sqrt', or 'linear'.
spiral: str = 'archimedean'
pydantic-field
¤
The spiral type to use for the word cloud, 'archimedean' or 'rectangular'.
template: Path | str = 'd3_cloud_template-1.0.html'
pydantic-field
¤
The template file for the word cloud.
title: str = 'Word Cloud Visualization'
pydantic-field
¤
The title of the word cloud.
width: int = 600
pydantic-field
¤
The width of the word cloud in pixels.
__init__(**data: Any) -> None
¤
Initialize with better error handling.
Source code in lexos/visualization/d3_wordcloud.py
save(path: Path | str, minify: bool = False) -> None
¤
Save the word cloud HTML to a file with optional HTML minification.
Source code in lexos/visualization/d3_wordcloud.py
validate_angles()
pydantic-validator
¤
Validate the angle settings.
validate_scale(v)
pydantic-validator
¤
Validate the scale setting.
validate_spiral(v)
pydantic-validator
¤
Validate the spiral setting.
Source code in lexos/visualization/d3_wordcloud.py
__init__(**data: Any) -> None
¤
Initialize with better error handling.
Source code in lexos/visualization/d3_wordcloud.py
validate_spiral(v)
pydantic-validator
¤
Validate the spiral setting.
Source code in lexos/visualization/d3_wordcloud.py
validate_scale(v)
pydantic-validator
¤
Validate the scale setting.
validate_angles()
pydantic-validator
¤
Validate the angle settings.
_render() -> None
¤
Render the word cloud as an HTML string.
Source code in lexos/visualization/d3_wordcloud.py
_get_asset_path(filename: str) -> Path
¤
_get_d3_js(path: str = 'd3.min.js') -> str
¤
Retrieve the contents of the d3.js bundle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
The path to the d3.js file. Defaults to "d3.min.js". |
'd3.min.js'
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The HTML script tag containing or pointing to the d3.js script. |
Source code in lexos/visualization/d3_wordcloud.py
_include_d3() -> None
¤
Modify the template to include d3.js and d3 cloud scripts.
Source code in lexos/visualization/d3_wordcloud.py
_include_d3_cloud() -> None
¤
Modify the template to include d3 cloud scripts.
Source code in lexos/visualization/d3_wordcloud.py
_load_template() -> str
¤
Load the HTML template for the word cloud.
Source code in lexos/visualization/d3_wordcloud.py
_minify_html(html: str) -> str
¤
Basic HTML minification.
Source code in lexos/visualization/d3_wordcloud.py
_open() -> None
¤
Open the HTML file in a web browser.
Source code in lexos/visualization/d3_wordcloud.py
save(path: Path | str, minify: bool = False) -> None
¤
Save the word cloud HTML to a file with optional HTML minification.
Source code in lexos/visualization/d3_wordcloud.py
D3MultiCloud
pydantic-model
¤
Bases: BaseModel
A Pydantic model for creating multiple D3 WordClouds in a grid layout.
Config:
arbitrary_types_allowed:True
Fields:
-
data_sources(list[multi_doc_types]) -
labels(Optional[list[str]]) -
cloud_width(int) -
cloud_height(int) -
columns(int) -
title(Optional[str]) -
cloud_spacing(int) -
limit(int) -
font(str) -
spiral(str) -
scale(str) -
angle_count(int) -
angle_from(int) -
angle_to(int) -
background_color(str) -
colorscale(str) -
auto_open(bool) -
template(Path | str) -
include_d3js(bool | str | None) -
include_d3_cloud(bool | str) -
word_clouds(list[D3WordCloud]) -
html(str)
Validators:
Source code in lexos/visualization/d3_wordcloud.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | |
angle_count: int = 5
pydantic-field
¤
The number of angles to use for all word clouds.
angle_from: int = -60
pydantic-field
¤
The starting angle for all word clouds.
angle_to: int = 60
pydantic-field
¤
The ending angle for all word clouds.
auto_open: bool = True
pydantic-field
¤
Whether to open the chart in a web browser automatically.
background_color: str = 'white'
pydantic-field
¤
The background color of the overall visualization.
cloud_height: int = 300
pydantic-field
¤
The height of each individual word cloud in pixels.
cloud_spacing: int = 20
pydantic-field
¤
The spacing between clouds in pixels.
cloud_width: int = 300
pydantic-field
¤
The width of each individual word cloud in pixels.
colorscale: str = 'd3.scale.category20b'
pydantic-field
¤
The name of a categorical d3 scale to use for all word clouds.
columns: int = 3
pydantic-field
¤
The number of columns in the grid layout.
data_sources: list[multi_doc_types]
pydantic-field
¤
List of data sources to create individual word clouds from.
font: str = 'Impact'
pydantic-field
¤
The font to use for all word clouds.
html: str = ''
pydantic-field
¤
The HTML representation of the multi-cloud.
include_d3_cloud: bool | str = True
pydantic-field
¤
Whether to include the D3 cloud library.
include_d3js: bool | str | None = True
pydantic-field
¤
Whether to include the D3.js library.
labels: Optional[list[str]] = None
pydantic-field
¤
List of titles for each word cloud. If None, will use 'Cloud 1', 'Cloud 2', etc.
limit: int = 50
pydantic-field
¤
The maximum number of terms in each cloud.
scale: str = 'log'
pydantic-field
¤
The scale type to use for all word clouds.
spiral: str = 'archimedean'
pydantic-field
¤
The spiral type to use for all word clouds.
template: Path | str = 'd3_multicloud_template-1.0.html'
pydantic-field
¤
The template file for the multi-cloud visualization.
title: Optional[str] = None
pydantic-field
¤
Overall title for the figure.
word_clouds: list[D3WordCloud] = []
pydantic-field
¤
List of generated D3WordCloud objects.
__init__(**data: Any) -> None
¤
Initialize the multi-cloud visualization.
Source code in lexos/visualization/d3_wordcloud.py
get_cloud_counts(index: int) -> dict[str, int]
¤
save(path: Path | str, minify: bool = False) -> None
¤
Save the multi-cloud HTML to a file.
Source code in lexos/visualization/d3_wordcloud.py
validate_angles()
pydantic-validator
¤
Validate the angle settings.
validate_scale(v)
pydantic-validator
¤
Validate the scale setting.
validate_spiral(v)
pydantic-validator
¤
Validate the spiral setting.
Source code in lexos/visualization/d3_wordcloud.py
__init__(**data: Any) -> None
¤
Initialize the multi-cloud visualization.
Source code in lexos/visualization/d3_wordcloud.py
validate_spiral(v)
pydantic-validator
¤
Validate the spiral setting.
Source code in lexos/visualization/d3_wordcloud.py
validate_scale(v)
pydantic-validator
¤
Validate the scale setting.
validate_angles()
pydantic-validator
¤
Validate the angle settings.
_generate_word_clouds() -> None
¤
Generate individual D3WordCloud objects for each data source.
Source code in lexos/visualization/d3_wordcloud.py
_get_asset_path(filename: str) -> Path
¤
_get_cloud(index: int) -> D3WordCloud
¤
Get a specific word cloud by index.
_get_d3_js(path: str = 'd3.min.js') -> str
¤
Retrieve the contents of the d3.js bundle.
Source code in lexos/visualization/d3_wordcloud.py
_include_d3() -> None
¤
Modify the template to include d3.js.
Source code in lexos/visualization/d3_wordcloud.py
_include_d3_cloud() -> None
¤
Modify the template to include d3 cloud scripts.
Source code in lexos/visualization/d3_wordcloud.py
_load_template() -> str
¤
Load the HTML template for the multi-cloud visualization.
_open() -> None
¤
Open the HTML file in a web browser.
Source code in lexos/visualization/d3_wordcloud.py
_render() -> None
¤
Generate the combined HTML for all word clouds.
Source code in lexos/visualization/d3_wordcloud.py
get_cloud_counts(index: int) -> dict[str, int]
¤
save(path: Path | str, minify: bool = False) -> None
¤
Save the multi-cloud HTML to a file.