You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.9 KiB

4 years ago
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 2,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "from GenitivSolve import *\n",
  10. "\n",
  11. "from oi import *\n",
  12. "\n",
  13. "oi = oi()\n"
  14. ]
  15. },
  16. {
  17. "cell_type": "code",
  18. "execution_count": 3,
  19. "metadata": {},
  20. "outputs": [
  21. {
  22. "name": "stdout",
  23. "output_type": "stream",
  24. "text": [
  25. "loading the german spacy model..\n",
  26. "done\n"
  27. ]
  28. }
  29. ],
  30. "source": [
  31. "gs = GenitivSolve()"
  32. ]
  33. },
  34. {
  35. "cell_type": "code",
  36. "execution_count": 4,
  37. "metadata": {},
  38. "outputs": [],
  39. "source": [
  40. "sentences, punctuations = oi.ReadDoc2Sent('test1')"
  41. ]
  42. },
  43. {
  44. "cell_type": "code",
  45. "execution_count": 5,
  46. "metadata": {},
  47. "outputs": [
  48. {
  49. "name": "stdout",
  50. "output_type": "stream",
  51. "text": [
  52. "processing sentence 1\n",
  53. "processing sentence 2\n",
  54. "processing sentence 3\n",
  55. "processing sentence 4\n",
  56. "processing sentence 5\n",
  57. "processing sentence 6\n",
  58. "processing sentence 7\n",
  59. "processing sentence 8\n",
  60. "processing sentence 9\n"
  61. ]
  62. }
  63. ],
  64. "source": [
  65. "outsentences = gs.ReplaceGenitivWithDativ(sentences)\n"
  66. ]
  67. },
  68. {
  69. "cell_type": "code",
  70. "execution_count": 6,
  71. "metadata": {
  72. "scrolled": true
  73. },
  74. "outputs": [
  75. {
  76. "name": "stdout",
  77. "output_type": "stream",
  78. "text": [
  79. "['Hallo', 'was', 'geht', 'denn', 'hier', 'so']\n"
  80. ]
  81. },
  82. {
  83. "ename": "TypeError",
  84. "evalue": "Can't convert 'list' object to str implicitly",
  85. "output_type": "error",
  86. "traceback": [
  87. "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
  88. "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
  89. "\u001b[0;32m<ipython-input-6-431ebe52fd8b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0moi\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPrintSplitSentencesToTextFile\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moutsentences\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpunctuations\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'test1out'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
  90. "\u001b[0;32m~/ProjektA/LeichteSprache/code200110/Prototyp/oi.py\u001b[0m in \u001b[0;36mPrintSplitSentencesToTextFile\u001b[0;34m(self, punctuations, sentences, document)\u001b[0m\n\u001b[1;32m 60\u001b[0m \u001b[0mpunctuation\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpunctuations\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mn\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 62\u001b[0;31m \u001b[0mdoc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwrite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtowrite\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mpunctuation\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m'\\n'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 63\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
  91. "\u001b[0;31mTypeError\u001b[0m: Can't convert 'list' object to str implicitly"
  92. ]
  93. }
  94. ],
  95. "source": [
  96. "oi.PrintSplitSentencesToTextFile(punctuations, outsentences, 'test1out')"
  97. ]
  98. },
  99. {
  100. "cell_type": "code",
  101. "execution_count": null,
  102. "metadata": {},
  103. "outputs": [],
  104. "source": []
  105. }
  106. ],
  107. "metadata": {
  108. "kernelspec": {
  109. "display_name": "Python 3",
  110. "language": "python",
  111. "name": "python3"
  112. },
  113. "language_info": {
  114. "codemirror_mode": {
  115. "name": "ipython",
  116. "version": 3
  117. },
  118. "file_extension": ".py",
  119. "mimetype": "text/x-python",
  120. "name": "python",
  121. "nbconvert_exporter": "python",
  122. "pygments_lexer": "ipython3",
  123. "version": "3.5.3"
  124. }
  125. },
  126. "nbformat": 4,
  127. "nbformat_minor": 2
  128. }