{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "57db6265",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Import the functions\n",
    "import word_separation as ws"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9b1bef5f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Configure the input image\n",
    "input_image=\"images/w0001_s03_pPHR_r01.png\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "473d65b2",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Split the lines\n",
    "split_images = ws.detect_lines(input_image)\n",
    "split_images"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "dd146734",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Display each split image\n",
    "for split_image in split_images:\n",
    "    ws.show_image(ws.separate_word(file_name=split_image))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d5b16edc",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "# Get every word extracted as a contour\n",
    "all_words = []\n",
    "for split_image in split_images:\n",
    "    im1_contours = ws.separate_word(file_name=split_image, ret=\"contours\")\n",
    "    all_words.append(ws.annotate_image(split_image, im1_contours))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "914f9e37",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Let's take a look!\n",
    "all_words"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "520536cf",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "batched = ws.batch_process(\"images\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
