abbreviateStatements: Abbreviate Statements in Concept Map Data

View source: R/abbreviateStatements.R

abbreviateStatementsR Documentation

Abbreviate Statements in Concept Map Data

Description

This function processes the "statement" column of a data frame containing concept map data by converting each statement to lowercase, removing stopwords, and truncating the statement to a specified maximum length. It allows for the abbreviation of long statements while maintaining their core meaning by removing unnecessary words.

Usage

abbreviateStatements(CMData, max_length = 30)

Arguments

CMData

A data frame containing concept map data. The data should have at least the following column:

  • statement: The text of the statement to be abbreviated.

max_length

An integer specifying the maximum number of characters for the abbreviated statement. Default is 30.

Details

This function performs several preprocessing steps on the "statement" column:

  • Converts statements to lowercase.

  • Removes punctuation and stopwords from the statements.

  • Truncates statements to a specified maximum length.

  • Removes any rows with empty statements after processing.

Stopwords are predefined and include common English words (e.g., "the", "and", "is", "a", etc.) that do not contribute much meaning to the core idea of the statement.

Value

A data frame with the same structure as the input, but with an updated "statement" column containing the abbreviated statements.

Examples

# Create a sample data frame with concept map data
conceptMapData <- data.frame(
   id = c(1, 2, 3),
    statement = c(
       "The quick brown fox jumps over the lazy dog",
       "This is a simple concept map example",
       "Data science involves analyzing datasets"
    )
)

# Apply the abbreviateStatements function with a maximum length of 20
result <- abbreviateStatements(conceptMapData, max_length = 20)

print(result)


cmAnalysis documentation built on April 4, 2025, 4:27 a.m.