analyze static method

TextStats analyze(
  1. String text
)

Implementation

static TextStats analyze(String text) {
  final words = Tokenizer.tokenize(text);

  final sentences =
      RegExp(r'[.!?]+').allMatches(text).length;

  return TextStats(
    wordCount: words.length,
    sentenceCount: sentences,
    characterCount: text.length,
  );
}