getNamesList method

Future<List<Map<String, dynamic>>> getNamesList(
  1. String path,
  2. List<String> inputNames,
  3. int strictness
)

***** ***** ***** ***** ***** FUNCTIONS_TO_USE_AND_CALL ***** ***** ***** ***** *****


this function extracts list of names of users extracts last names next to their first names and removes possible icon read like 'i' if inputNames is empty the function finds the names itself with a lot of problems and needs verticalSort if inputNames is not empty, the first and last names found in this list will be returned. valid item in the inputNames list: "amir mehdizadeh". we use remove from top to removes extra words! example: " seat ", don't forget the space! Strictness = 0 : medium & Strictness = 1 : hard & alternative hard = 2

Implementation

///this function extracts list of names of users
///extracts last names next to their first names and removes possible icon read like 'i'
///if inputNames is empty the function finds the names itself with a lot of problems and needs verticalSort
///if inputNames is not empty, the first and last names found in this list will be returned.
///valid item in the inputNames list: "amir mehdizadeh".
///we use remove from top to removes extra words! example: " seat ", don't forget the space!
///Strictness = 0 : medium & Strictness = 1 : hard & alternative hard = 2
Future<List<Map<String, dynamic>>> getNamesList(
    String path, List<String> inputNames, int strictness) async {
  final result = await occ.processImageFromPathWithoutView(path);
  if (result.toString().isEmpty) return [];
  Map<String, dynamic> data = jsonDecode(result);
  List<Line>? lines = await initialize(data,
      removeFromTopWords: [" seat ", " type ", " name "],
      removeFromTopWords2: [" date:", " gate:"]);
  List<Line>? lines2 = [...lines!];
  String horizontalSort = await initSort(lines,
      spaceBetweenWordsCount: 1, strictness: strictness);
  List<Map<String, dynamic>> finalResult =
      await findPassengers(horizontalSort, lines2, inputNames);
  return finalResult;
}