{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ ":::{.content-hidden}\n", "# Human Annotations\n", ":::" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Install the `label-studio-sdk` package for programmatic control of Label Studio:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "id": "J1sLoUSsXzS4" }, "outputs": [], "source": [ "!pip -q install label-studio-sdk" ] }, { "cell_type": "markdown", "metadata": { "id": "NBow_A02gg8j" }, "source": [ "Next, let's read the text master from the previous sessions" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "id": "i9hkqOpUb8kQ" }, "outputs": [], "source": [ "import pandas as pd\n", "\n", "df = pd.read_csv('/content/drive/MyDrive/2023-12-01-Export-Posts-Text-Master.csv')" ] }, { "cell_type": "markdown", "metadata": { "id": "-TbauZ65PWhU" }, "source": [ "In my [video on GPT text classification](https://youtu.be/QcYGwC4QzW0) I mentioned the problem of the unique identifier, as we also need a unique identifier for the annotations. Use the code below in our text classification notebook when working with multidocument classifications!" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "id": "4IGsSLHCPypm" }, "outputs": [], "source": [ "df['identifier'] = df.apply(lambda x: f\"{x['shortcode']}-{x['Text Type']}\", axis=1)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 206 }, "id": "Y3NRaT_4gxes", "outputId": "155af2da-17ca-46c4-947e-6565f40640de" }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " | Unnamed: 0 | \n", "shortcode | \n", "Text | \n", "Text Type | \n", "Policy Issues | \n", "identifier | \n", "
---|---|---|---|---|---|---|
0 | \n", "0 | \n", "CyMAe_tufcR | \n", "#Landtagswahl23 🤩🧡🙏 #FREIEWÄHLER #Aiwanger #Da... | \n", "Caption | \n", "['1. Political parties:\\n- FREIEWÄHLER\\n- Aiwa... | \n", "CyMAe_tufcR-Caption | \n", "
1 | \n", "1 | \n", "CyL975vouHU | \n", "Die Landtagswahl war für uns als Liberale hart... | \n", "Caption | \n", "['Landtagswahl'] | \n", "CyL975vouHU-Caption | \n", "
2 | \n", "2 | \n", "CyL8GWWJmci | \n", "Nach einem starken Wahlkampf ein verdientes Er... | \n", "Caption | \n", "['1. Wahlkampf und Wahlergebnis:\\n- Wahlkampf\\... | \n", "CyL8GWWJmci-Caption | \n", "
3 | \n", "3 | \n", "CyL7wyJtTV5 | \n", "So viele Menschen am Odeonsplatz heute mit ein... | \n", "Caption | \n", "['Israel', 'Terrorismus', 'Hamas', 'Entwicklun... | \n", "CyL7wyJtTV5-Caption | \n", "
4 | \n", "4 | \n", "CyLxwHuvR4Y | \n", "Herzlichen Glückwunsch zu diesem grandiosen Wa... | \n", "Caption | \n", "['1. Wahlsieg und Parlamentseinstieg\\n- Wahlsi... | \n", "CyLxwHuvR4Y-Caption | \n", "