mineFromCsv method

Future<(Map<List<String>, int>, int)> mineFromCsv(
  1. String filePath
)

Mines frequent itemsets directly from a CSV file using the current instance configuration (minSupport, parallelism, etc.).

filePath is the path to the CSV file. Throws a FileSystemException if the file is not found.

This method is not available on the web platform.

Implementation

Future<(Map<List<String>, int>, int)> mineFromCsv(String filePath) {
  final file = File(filePath);

  if (!file.existsSync()) {
    throw FileSystemException('File not found', filePath);
  }

  // Reuse the generic mine() method with a file stream provider.
  // The provider creates a new stream for each pass of the algorithm.
  return mine(() => transactionsFromCsv(file.openRead()));
}