Skip to contents

Creates a bar plot showing the frequency distribution of named entity types.

Usage

plot_entity_frequencies(
  entity_data,
  top_n = 20,
  title = "Named Entity Type Frequency",
  color = "#10B981",
  height = 500,
  width = NULL
)

Arguments

entity_data

Data frame containing entity data with columns:

  • entity: Named entity type (e.g., "PERSON", "ORG", "GPE")

  • n: (optional) Pre-computed frequency count

If n is not present, frequencies will be computed from the data.

top_n

Number of top entity types to display (default: 20)

title

Plot title (default: "Named Entity Type Frequency")

color

Bar color (default: "#10B981")

height

Plot height in pixels (default: 500)

width

Plot width in pixels (default: NULL for auto)

Value

A plotly object

Examples

if (interactive()) {
  entity_df <- data.frame(
    entity = c("PERSON", "ORG", "GPE", "DATE", "MONEY"),
    n = c(300, 250, 200, 150, 100)
  )
  plot_entity_frequencies(entity_df)
}