<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from tomato.symbolic.SymbTrAnalyzer import SymbTrAnalyzer\n",
    "from symbtrextras.ScoreExtras import ScoreExtras\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# score filepaths\n",
    "txt_filepath = os.path.join('ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede',\n",
    "                            'ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede.txt')\n",
    "mu2_filepath = os.path.join('ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede',\n",
    "                            'ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede.mu2')\n",
    "\n",
    "# only needed if the filename is modified from the SymbTr naming convention\n",
    "symbtr_name = 'ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede'\n",
    "\n",
    "# relevant recording or work mbid, if you want additional information from musicbrainz\n",
    "# Note: very rare but there can be more that one mbid returned, we are going to use \n",
    "# the first work to get fetch the metadata\n",
    "mbids = ScoreExtras.get_mbids(symbtr_name)[0]\n",
    "\n",
    "# instantiate analyzer object\n",
    "scoreAnalyzer = SymbTrAnalyzer(verbose=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "- Extracting (meta)data from the SymbTr-txt file: ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede/ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede.txt\n",
      "- Extracting metadata from the SymbTr-mu2 file: ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede/ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede.mu2\n"
     ]
    }
   ],
   "source": [
    "# Extract the (meta)data from the SymbTr scores\n",
    "# This includes the metadata from the score formats and MusicBrainz, extracted sections\n",
    "# rhythmic structure etc.\n",
    "score_data = scoreAnalyzer.extract_data(\n",
    "    txt_filepath, mu2_filepath, symbtr_name=symbtr_name, mbid=mbids)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can use the **symbtrdataextractor** package to call the extractors for each score format. You can refer to the [extractsymbtrdata.ipynb](https://github.com/sertansenturk/symbtrdataextractor/blob/master/extractsymbtrdata.ipynb) for an interactive demo"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}<commit_msg>Added additional info to score_analysis_demo.ipynb<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "from tomato.symbolic.SymbTrAnalyzer import SymbTrAnalyzer\n",
    "from symbtrextras.ScoreExtras import ScoreExtras\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# score filepaths\n",
    "txt_filepath = os.path.join('ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede',\n",
    "                            'ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede.txt')\n",
    "mu2_filepath = os.path.join('ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede',\n",
    "                            'ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede.mu2')\n",
    "\n",
    "# only needed if the filename is modified from the SymbTr naming convention\n",
    "symbtr_name = 'ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede'\n",
    "\n",
    "# relevant recording or work mbid, if you want additional information from musicbrainz\n",
    "# Note 1: MBID input will make the function returns significantly slower because we\n",
    "# have to wait a couple of seconds before each subsequent query from MusicBrainz.\n",
    "#\n",
    "# Note 2: very rare but there can be more that one mbid returned, we are going to use \n",
    "# the first work to get fetch the metadata\n",
    "mbids = ScoreExtras.get_mbids(symbtr_name)[0]\n",
    "\n",
    "# instantiate analyzer object\n",
    "scoreAnalyzer = SymbTrAnalyzer(verbose=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "- Extracting (meta)data from the SymbTr-txt file: ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede/ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede.txt\n",
      "- Extracting metadata from the SymbTr-mu2 file: ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede/ussak--sazsemaisi--aksaksemai----neyzen_aziz_dede.mu2\n"
     ]
    }
   ],
   "source": [
    "# Extract the (meta)data from the SymbTr scores\n",
    "# This includes the metadata from the score formats and MusicBrainz, extracted sections\n",
    "# rhythmic structure etc.\n",
    "score_data = scoreAnalyzer.extract_data(\n",
    "    txt_filepath, mu2_filepath, symbtr_name=symbtr_name, mbid=mbids)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can use the **symbtrdataextractor** package to call the extractors for each score format. You can refer to the [extractsymbtrdata.ipynb](https://github.com/sertansenturk/symbtrdataextractor/blob/master/extractsymbtrdata.ipynb) for an interactive demo"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
{'fraction_non_alphanumeric': 0.16277977774299576, 'fraction_numerical': 0.0061042416653623414, 'mean_word_length': 3.034090909090909, 'pattern_counts': {'":': 84, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6855418', 'n_tokens_mistral': 2402, 'n_tokens_neox': 2364, 'n_words': 462}