The discover_arguments()
method finds argumentative segments in longer texts:
text = """Climate change is a serious issue. Global temperatures are rising at an
unprecedented rate. This is causing extreme weather events. However, some argue
that natural climate cycles are responsible."""
results_df = analyzer.discover_arguments(
text,
window_size=2,
step_size=1
)
print(results_df[['text_segment', 'argument_prediction', 'argument_confidence']])
df = pd.DataFrame({'text': [text1, text2]})
results_df = analyzer.discover_arguments(
df,
text_column='text',
window_size=2,
step_size=1
)
The discover_arguments()
method finds argumentative segments in longer texts:
Note: The window_size
and step_size
parameters are automatically converted to integers internally. If you experience any type conversion issues, you can explicitly use as.integer()
.
# Single text
text <- "Climate change is a serious issue. Global temperatures are rising at an
unprecedented rate. This is causing extreme weather events. However, some argue
that natural climate cycles are responsible."
# Parameters are automatically converted to integers internally
results_df <- analyzer$discover_arguments(
text,
window_size=2, # Number of sentences per window
step_size=1 # Number of sentences to move window
)
# Alternatively, you can explicitly convert to integers if needed
results_df <- analyzer$discover_arguments(
text,
window_size=as.integer(2),
step_size=as.integer(1)
)
print(results_df[c('text_segment', 'argument_prediction', 'argument_confidence')])
# Using data.frame
df <- data.frame(text = c(text1, text2))
results_df <- analyzer$discover_arguments(
df,
text_column='text',
window_size=2,
step_size=1
)