noshot 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. noshot/__init__.py +1 -0
  2. noshot/data/AIDS CN NLP/AIDS/1. Implement Basic Search Strategies/(A) Breadth First Search.ipynb +112 -0
  3. noshot/data/AIDS CN NLP/AIDS/1. Implement Basic Search Strategies/(B) Depth First Search.ipynb +111 -0
  4. noshot/data/AIDS CN NLP/AIDS/1. Implement Basic Search Strategies/(C) Uniform Cost Search.ipynb +134 -0
  5. noshot/data/AIDS CN NLP/AIDS/1. Implement Basic Search Strategies/(D) Depth Limites Search.ipynb +115 -0
  6. noshot/data/AIDS CN NLP/AIDS/1. Implement Basic Search Strategies/(E) Iterative Deepening DFS.ipynb +123 -0
  7. noshot/data/AIDS CN NLP/AIDS/10. ANOVA/2_ANOVA.csv +769 -0
  8. noshot/data/AIDS CN NLP/AIDS/10. ANOVA/One Way ANOVA (Repeated Measure).ipynb +126 -0
  9. noshot/data/AIDS CN NLP/AIDS/10. ANOVA/One Way ANOVA.ipynb +134 -0
  10. noshot/data/AIDS CN NLP/AIDS/10. ANOVA/Sample 1 Way ANOVA Test.ipynb +119 -0
  11. noshot/data/AIDS CN NLP/AIDS/10. ANOVA/Two Way ANOVA.ipynb +138 -0
  12. noshot/data/AIDS CN NLP/AIDS/10. ANOVA/reaction_time.csv +5 -0
  13. noshot/data/AIDS CN NLP/AIDS/10. ANOVA/sample_data.csv +16 -0
  14. noshot/data/AIDS CN NLP/AIDS/10. ANOVA/sleep_deprivation.csv +4 -0
  15. noshot/data/AIDS CN NLP/AIDS/11. Linear Regression/3_Linear.csv +4802 -0
  16. noshot/data/AIDS CN NLP/AIDS/11. Linear Regression/Linear Regression LAB.ipynb +113 -0
  17. noshot/data/AIDS CN NLP/AIDS/11. Linear Regression/Linear Regression New- sklearn.ipynb +118 -0
  18. noshot/data/AIDS CN NLP/AIDS/11. Linear Regression/Linear Regression.ipynb +148 -0
  19. noshot/data/AIDS CN NLP/AIDS/11. Linear Regression/house_rate.csv +22 -0
  20. noshot/data/AIDS CN NLP/AIDS/12. Logistic Regression/Logistic Regression New- sklearn.ipynb +128 -0
  21. noshot/data/AIDS CN NLP/AIDS/12. Logistic Regression/Logistic Regression.ipynb +145 -0
  22. noshot/data/AIDS CN NLP/AIDS/12. Logistic Regression/default.csv +1001 -0
  23. noshot/data/AIDS CN NLP/AIDS/12. Logistic Regression/hours_scores_records.csv +101 -0
  24. noshot/data/AIDS CN NLP/AIDS/2. Implement A Star And MA Star/(A) Astar.ipynb +256 -0
  25. noshot/data/AIDS CN NLP/AIDS/2. Implement A Star And MA Star/(B) IDAstar.ipynb +157 -0
  26. noshot/data/AIDS CN NLP/AIDS/2. Implement A Star And MA Star/(C) SMAstar.ipynb +178 -0
  27. noshot/data/AIDS CN NLP/AIDS/3. Genetic Algorithm/Genetic.ipynb +95 -0
  28. noshot/data/AIDS CN NLP/AIDS/4. Simulated Annealing/Simulated Annealing.ipynb +74 -0
  29. noshot/data/AIDS CN NLP/AIDS/4. Simulated Annealing/Sudoku Simulated Annealing.ipynb +103 -0
  30. noshot/data/AIDS CN NLP/AIDS/5. Alpha Beta Pruning/AlphaBetaPruning.ipynb +182 -0
  31. noshot/data/AIDS CN NLP/AIDS/6. Consraint Satisfaction Problems (CSP)/(A) CSP House Allocation.ipynb +120 -0
  32. noshot/data/AIDS CN NLP/AIDS/6. Consraint Satisfaction Problems (CSP)/(B) CSP Map Coloring.ipynb +125 -0
  33. noshot/data/AIDS CN NLP/AIDS/7. Random Sampling/Random Sampling.ipynb +73 -0
  34. noshot/data/AIDS CN NLP/AIDS/7. Random Sampling/height_weight_bmi.csv +8389 -0
  35. noshot/data/AIDS CN NLP/AIDS/8. Z Test/Z Test Hash Function.ipynb +141 -0
  36. noshot/data/AIDS CN NLP/AIDS/8. Z Test/Z Test.ipynb +151 -0
  37. noshot/data/AIDS CN NLP/AIDS/8. Z Test/height_weight_bmi.csv +8389 -0
  38. noshot/data/AIDS CN NLP/AIDS/9. T Test/1_heart.csv +304 -0
  39. noshot/data/AIDS CN NLP/AIDS/9. T Test/Independent T Test.ipynb +119 -0
  40. noshot/data/AIDS CN NLP/AIDS/9. T Test/Paired T Test.ipynb +118 -0
  41. noshot/data/AIDS CN NLP/AIDS/9. T Test/T Test Hash Function.ipynb +142 -0
  42. noshot/data/AIDS CN NLP/AIDS/9. T Test/T Test.ipynb +158 -0
  43. noshot/data/AIDS CN NLP/AIDS/9. T Test/height_weight_bmi.csv +8389 -0
  44. noshot/data/AIDS CN NLP/AIDS/9. T Test/iq_test.csv +0 -0
  45. noshot/data/AIDS CN NLP/AIDS/Others (AllinOne)/All In One.ipynb +4581 -0
  46. noshot/data/AIDS CN NLP/CN/1. Chat Application/chat.java +81 -0
  47. noshot/data/AIDS CN NLP/CN/1. Chat Application/output.png +0 -0
  48. noshot/data/AIDS CN NLP/CN/1. Chat Application/procedure.png +0 -0
  49. noshot/data/AIDS CN NLP/CN/10. Ethernet LAN IEEE 802.3/LAN.tcl +65 -0
  50. noshot/data/AIDS CN NLP/CN/10. Ethernet LAN IEEE 802.3/analysis.awk +44 -0
  51. noshot/data/AIDS CN NLP/CN/10. Ethernet LAN IEEE 802.3/output.png +0 -0
  52. noshot/data/AIDS CN NLP/CN/10. Ethernet LAN IEEE 802.3/procedure.png +0 -0
  53. noshot/data/AIDS CN NLP/CN/11. Wireless LAN IEEE 802.11/complexdcf.tcl +229 -0
  54. noshot/data/AIDS CN NLP/CN/11. Wireless LAN IEEE 802.11/output.png +0 -0
  55. noshot/data/AIDS CN NLP/CN/11. Wireless LAN IEEE 802.11/procedure.png +0 -0
  56. noshot/data/AIDS CN NLP/CN/2. File Transfer/file_to_send.txt +2 -0
  57. noshot/data/AIDS CN NLP/CN/2. File Transfer/filetransfer.java +119 -0
  58. noshot/data/AIDS CN NLP/CN/2. File Transfer/output.png +0 -0
  59. noshot/data/AIDS CN NLP/CN/2. File Transfer/procedure.png +0 -0
  60. noshot/data/AIDS CN NLP/CN/3. RMI (Remote Method Invocation)/output.png +0 -0
  61. noshot/data/AIDS CN NLP/CN/3. RMI (Remote Method Invocation)/procedure.png +0 -0
  62. noshot/data/AIDS CN NLP/CN/3. RMI (Remote Method Invocation)/rmi.java +56 -0
  63. noshot/data/AIDS CN NLP/CN/4. Wired Network/output.png +0 -0
  64. noshot/data/AIDS CN NLP/CN/4. Wired Network/procedure.png +0 -0
  65. noshot/data/AIDS CN NLP/CN/4. Wired Network/wired.awk +25 -0
  66. noshot/data/AIDS CN NLP/CN/4. Wired Network/wired.tcl +81 -0
  67. noshot/data/AIDS CN NLP/CN/5. Wireless Network/output.png +0 -0
  68. noshot/data/AIDS CN NLP/CN/5. Wireless Network/procedure.png +0 -0
  69. noshot/data/AIDS CN NLP/CN/5. Wireless Network/wireless.awk +27 -0
  70. noshot/data/AIDS CN NLP/CN/5. Wireless Network/wireless.tcl +153 -0
  71. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/analysis.awk +27 -0
  72. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/output.png +0 -0
  73. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/sack.tcl +86 -0
  74. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/vegas.tcl +86 -0
  75. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/analysis.awk +28 -0
  76. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/output.png +0 -0
  77. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/reno.tcl +78 -0
  78. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/tahoe.tcl +79 -0
  79. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Flow Control/analysis.awk +27 -0
  80. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Flow Control/flow.tcl +163 -0
  81. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/TCP Flow Control/output.png +0 -0
  82. noshot/data/AIDS CN NLP/CN/6. TCP Flow And Congestion Control/procedure.png +0 -0
  83. noshot/data/AIDS CN NLP/CN/7. Link State And Distance Vector Routing/DV.tcl +111 -0
  84. noshot/data/AIDS CN NLP/CN/7. Link State And Distance Vector Routing/LS.tcl +106 -0
  85. noshot/data/AIDS CN NLP/CN/7. Link State And Distance Vector Routing/analysis.awk +36 -0
  86. noshot/data/AIDS CN NLP/CN/7. Link State And Distance Vector Routing/output.png +0 -0
  87. noshot/data/AIDS CN NLP/CN/7. Link State And Distance Vector Routing/procedure.png +0 -0
  88. noshot/data/AIDS CN NLP/CN/8. Multicast And Broadcast Routing/analysis.awk +20 -0
  89. noshot/data/AIDS CN NLP/CN/8. Multicast And Broadcast Routing/broadcast.tcl +76 -0
  90. noshot/data/AIDS CN NLP/CN/8. Multicast And Broadcast Routing/multicast.tcl +103 -0
  91. noshot/data/AIDS CN NLP/CN/8. Multicast And Broadcast Routing/output.png +0 -0
  92. noshot/data/AIDS CN NLP/CN/8. Multicast And Broadcast Routing/procedure.png +0 -0
  93. noshot/data/AIDS CN NLP/CN/9. DHCP/DHCP.java +125 -0
  94. noshot/data/AIDS CN NLP/CN/9. DHCP/output.png +0 -0
  95. noshot/data/AIDS CN NLP/CN/9. DHCP/procedure.png +0 -0
  96. noshot/data/AIDS CN NLP/NLP/NLP 1/1-Prereqs.py +18 -0
  97. noshot/data/AIDS CN NLP/NLP/NLP 1/2-Chi2test.py +83 -0
  98. noshot/data/AIDS CN NLP/NLP/NLP 1/2-T-test.py +79 -0
  99. noshot/data/AIDS CN NLP/NLP/NLP 1/3-WSD-nb.py +53 -0
  100. noshot/data/AIDS CN NLP/NLP/NLP 1/4-Hindle-Rooth.py +53 -0
  101. noshot/data/AIDS CN NLP/NLP/NLP 1/5-HMM-Trellis.py +82 -0
  102. noshot/data/AIDS CN NLP/NLP/NLP 1/6-HMM-Viterbi.py +16 -0
  103. noshot/data/AIDS CN NLP/NLP/NLP 1/7-PCFG-parsetree.py +15 -0
  104. noshot/data/AIDS CN NLP/NLP/NLP 1/Chi2test.ipynb +285 -0
  105. noshot/data/AIDS CN NLP/NLP/NLP 1/Hindle-Rooth.ipynb +179 -0
  106. noshot/data/AIDS CN NLP/NLP/NLP 1/Lab 10 - Text generator using LSTM.ipynb +1461 -0
  107. noshot/data/AIDS CN NLP/NLP/NLP 1/Lab 11 NMT.ipynb +2307 -0
  108. noshot/data/AIDS CN NLP/NLP/NLP 1/PCFG.ipynb +134 -0
  109. noshot/data/AIDS CN NLP/NLP/NLP 1/Prereqs.ipynb +131 -0
  110. noshot/data/AIDS CN NLP/NLP/NLP 1/T test.ipynb +252 -0
  111. noshot/data/AIDS CN NLP/NLP/NLP 1/TFIDF BOW.ipynb +171 -0
  112. noshot/data/AIDS CN NLP/NLP/NLP 1/Trellis.ipynb +244 -0
  113. noshot/data/AIDS CN NLP/NLP/NLP 1/WSD.ipynb +645 -0
  114. noshot/data/AIDS CN NLP/NLP/NLP 1/Word2Vec.ipynb +93 -0
  115. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab01(tokenizer)/tokenizer.ipynb +370 -0
  116. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab01(tokenizer)/training_tokenizer.txt +6 -0
  117. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab02(stemming)/exp0.ipynb +274 -0
  118. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab02(stemming)/lab2.ipynb +905 -0
  119. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab02(stemming)/test.txt +1 -0
  120. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab02(stemming)/tokenizing.ipynb +272 -0
  121. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab03(parse-tree)/collocation.ipynb +332 -0
  122. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab03(parse-tree)/lab3.ipynb +549 -0
  123. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab03(parse-tree)/nlp.txt +1 -0
  124. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab04(collocation)/Lab4-NLP-Exp-2.ipynb +817 -0
  125. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab04(collocation)/collocation.ipynb +332 -0
  126. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab05(WSD)/NLP-Lab-5-Exp3.ipynb +231 -0
  127. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab05(WSD)/word-sense-disambiguation.ipynb +507 -0
  128. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab06(additional-exercise)/lab6.ipynb +134 -0
  129. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP Exp 4.ipynb +255 -0
  130. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP_Exp_5.ipynb +159 -0
  131. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab08(PCFG)/PCFG.ipynb +282 -0
  132. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab09-Hindle-rooth&MLP/Lab 9 - MLP classifier.ipynb +670 -0
  133. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab09-Hindle-rooth&MLP/MLP-alternative-code.ipynb +613 -0
  134. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab09-Hindle-rooth&MLP/hindle-rooth-algorithm.ipynb +74 -0
  135. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab10(LSTM)/Lab_10_Text_generator_using_LSTM.ipynb +480 -0
  136. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Machine-translation.ipynb +445 -0
  137. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Viterbi-PCFG.ipynb +105 -0
  138. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/corpora_tools.py +87 -0
  139. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/data_utils.py +11 -0
  140. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/train_translator.py +83 -0
  141. noshot/data/AIDS CN NLP/NLP/NLP 2/Lab12(Information-Extraction)/Information_Extraction.ipynb +201 -0
  142. noshot/data/AIDS CN NLP/NLP/NLP 3/Backtrack-without-Verbitri.ipynb +185 -0
  143. noshot/data/AIDS CN NLP/NLP/NLP 3/Backward-Procedure.ipynb +597 -0
  144. noshot/data/AIDS CN NLP/NLP/NLP 3/Bag_of.ipynb +1422 -0
  145. noshot/data/AIDS CN NLP/NLP/NLP 3/CYK-algorithm.ipynb +1067 -0
  146. noshot/data/AIDS CN NLP/NLP/NLP 3/Forward-Procedure.ipynb +477 -0
  147. noshot/data/AIDS CN NLP/NLP/NLP 3/LSTM.ipynb +1290 -0
  148. noshot/data/AIDS CN NLP/NLP/NLP 3/Lab 10 - Text generator using LSTM.ipynb +1461 -0
  149. noshot/data/AIDS CN NLP/NLP/NLP 3/Lab 11 NMT.ipynb +2307 -0
  150. noshot/data/AIDS CN NLP/NLP/NLP 3/NLP-LAB-4.ipynb +216 -0
  151. noshot/data/AIDS CN NLP/NLP/NLP 3/NLP-LAB-5.ipynb +216 -0
  152. noshot/data/AIDS CN NLP/NLP/NLP 3/abc.txt +6 -0
  153. noshot/data/AIDS CN NLP/NLP/NLP 3/ex-1-nltk.ipynb +711 -0
  154. noshot/data/AIDS CN NLP/NLP/NLP 3/ex-2-nlp.ipynb +267 -0
  155. noshot/data/AIDS CN NLP/NLP/NLP 3/exp8&9.ipynb +305 -0
  156. noshot/data/AIDS CN NLP/NLP/NLP 3/hind.ipynb +287 -0
  157. noshot/data/AIDS CN NLP/NLP/NLP 3/lab66.ipynb +752 -0
  158. noshot/data/AIDS CN NLP/NLP/NLP 3/leb_3.ipynb +612 -0
  159. noshot/data/AIDS CN NLP/NLP/NLP 3/naive_bayes_classifier.pkl +0 -0
  160. noshot/data/AIDS CN NLP/NLP/NLP 3/nlp_leb_1.ipynb +3008 -0
  161. noshot/data/AIDS CN NLP/NLP/NLP 3/nlp_leb_2.ipynb +3095 -0
  162. noshot/data/AIDS CN NLP/NLP/NLP 3/nlplab-9.ipynb +295 -0
  163. noshot/data/AIDS CN NLP/NLP/NLP 3/nltk-ex-4.ipynb +506 -0
  164. noshot/data/AIDS CN NLP/NLP/NLP 3/text1.txt +48 -0
  165. noshot/data/AIDS CN NLP/NLP/NLP 3/text2.txt +8 -0
  166. noshot/data/AIDS CN NLP/NLP/NLP 3/text3.txt +48 -0
  167. noshot/data/AIDS CN NLP/NLP/NLP 3/translation-rnn.ipynb +812 -0
  168. noshot/data/AIDS CN NLP/NLP/NLP 3/word2vector.ipynb +173 -0
  169. noshot/data/AIDS CN NLP/NLP/NLP 4/Backward Procedure Algorithm.ipynb +179 -0
  170. noshot/data/AIDS CN NLP/NLP/NLP 4/Chi Square Collocation.ipynb +208 -0
  171. noshot/data/AIDS CN NLP/NLP/NLP 4/Collocation (T test).ipynb +188 -0
  172. noshot/data/AIDS CN NLP/NLP/NLP 4/Experiment 1.ipynb +437 -0
  173. noshot/data/AIDS CN NLP/NLP/NLP 4/Forward Procedure Algorithm.ipynb +132 -0
  174. noshot/data/AIDS CN NLP/NLP/NLP 4/Hindle Rooth.ipynb +414 -0
  175. noshot/data/AIDS CN NLP/NLP/NLP 4/MachineTranslation.ipynb +368 -0
  176. noshot/data/AIDS CN NLP/NLP/NLP 4/Multi Layer Perceptron using MLPClassifier.ipynb +86 -0
  177. noshot/data/AIDS CN NLP/NLP/NLP 4/Multi Layer Perceptron using Tensorflow.ipynb +112 -0
  178. noshot/data/AIDS CN NLP/NLP/NLP 4/PCFG Inside Probability.ipynb +451 -0
  179. noshot/data/AIDS CN NLP/NLP/NLP 4/Text Generation using LSTM.ipynb +297 -0
  180. noshot/data/AIDS CN NLP/NLP/NLP 4/Viterbi.ipynb +310 -0
  181. noshot/data/AIDS CN NLP/NLP/NLP 4/Word Sense Disambiguation.ipynb +335 -0
  182. noshot/data/AIDS CN NLP/NLP/NLP 5/10.Text Generation using LSTM.ipynb +316 -0
  183. noshot/data/AIDS CN NLP/NLP/NLP 5/11.Machine Translation.ipynb +868 -0
  184. noshot/data/AIDS CN NLP/NLP/NLP 5/2.T and Chi2 Test.ipynb +204 -0
  185. noshot/data/AIDS CN NLP/NLP/NLP 5/3.Word Sense Diambiguation.ipynb +234 -0
  186. noshot/data/AIDS CN NLP/NLP/NLP 5/4.Hinddle and Rooth.ipynb +128 -0
  187. noshot/data/AIDS CN NLP/NLP/NLP 5/5.Forward and Backward.ipynb +149 -0
  188. noshot/data/AIDS CN NLP/NLP/NLP 5/6.Viterbi.ipynb +111 -0
  189. noshot/data/AIDS CN NLP/NLP/NLP 5/7.PCFG Parse Tree.ipynb +134 -0
  190. noshot/data/AIDS CN NLP/NLP/NLP 5/7.PCFG using cyk.ipynb +101 -0
  191. noshot/data/AIDS CN NLP/NLP/NLP 5/8.Bag of words and TF-IDF.ipynb +310 -0
  192. noshot/data/AIDS CN NLP/NLP/NLP 5/9.Word2Vector.ipynb +78 -0
  193. noshot/data/AIDS CN NLP/NLP/NLP 5/NLP ALL In One.ipynb +2619 -0
  194. noshot/data/AIDS CN NLP/NLP/NLP 5/sample1.txt +15 -0
  195. noshot/data/AIDS CN NLP/NLP/NLP 5/sample2.txt +4 -0
  196. noshot/data/AIDS CN NLP/NLP/NLP 5/word2vec_model.bin +0 -0
  197. noshot/data/AIDS CN NLP/NLP/NLP 6/1. Tokenize, Tagging, NER, Parse Tree.ipynb +312 -0
  198. noshot/data/AIDS CN NLP/NLP/NLP 6/2. T Test and Chi2 Test.ipynb +185 -0
  199. noshot/data/AIDS CN NLP/NLP/NLP 6/3. Naive Bayes WSD.ipynb +199 -0
  200. noshot/data/AIDS CN NLP/NLP/NLP 6/4. Hinddle and Rooth.ipynb +151 -0
  201. noshot/data/AIDS CN NLP/NLP/NLP 6/5 and 6 FWD, BWD, Viterbi.ipynb +164 -0
  202. noshot/data/AIDS CN NLP/NLP/NLP 6/7. PCFG using CYK.ipynb +383 -0
  203. noshot/data/AIDS CN NLP/NLP/NLP 6/8. BOW and TF-IDF.ipynb +252 -0
  204. noshot/data/AIDS CN NLP/Ubuntu CN Lab.iso +0 -0
  205. noshot/main.py +47 -0
  206. noshot-0.1.0.dist-info/LICENSE.txt +21 -0
  207. noshot-0.1.0.dist-info/METADATA +65 -0
  208. noshot-0.1.0.dist-info/RECORD +210 -0
  209. noshot-0.1.0.dist-info/WHEEL +5 -0
  210. noshot-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,332 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "6d49579f",
6
+ "metadata": {},
7
+ "source": [
8
+ "## Exp 4\n",
9
+ "\n",
10
+ "Code credits - [Mudit Golchha](https://github.com/mudit2004/NLP)"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 61,
16
+ "id": "25e2b36e",
17
+ "metadata": {},
18
+ "outputs": [
19
+ {
20
+ "name": "stdout",
21
+ "output_type": "stream",
22
+ "text": [
23
+ "<head><title>Not Acceptable!</title></head><body><h1>Not Acceptable!</h1><p>An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.</p></body></html>\n"
24
+ ]
25
+ }
26
+ ],
27
+ "source": [
28
+ "#SETTING THE TEXT FROM A URL\n",
29
+ "import requests\n",
30
+ "url = 'https://coffeeshopstartups.com/how-to-start-a-coffee-shop-blog/'\n",
31
+ "\n",
32
+ "# CREATE REQUEST\n",
33
+ "x = requests.get(url)\n",
34
+ "\n",
35
+ "#CONVERT REQUEST TO STRING\n",
36
+ "text = x.text\n",
37
+ "\n",
38
+ "#PRINT\n",
39
+ "print(text)"
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "code",
44
+ "execution_count": 62,
45
+ "id": "ada9929d",
46
+ "metadata": {},
47
+ "outputs": [
48
+ {
49
+ "name": "stdout",
50
+ "output_type": "stream",
51
+ "text": [
52
+ "['coffee', 'has', 'been', 'forever', 'been', 'close', 'to', 'my', 'heart', 'if', 'you', 'ask', 'me', 'i', 'don', '’', 't', 'really', 'remember', 'when', 'exactly', 'i', 'fell', 'in', 'love', 'but', 'i', 'just', 'did', 'the', 'aroma', 'the', 'taste', 'the', 'flavour', 'everything', 'is', 'so', 'therapeutic', 'i', 'am', 'sure', 'like', 'me', 'you', 'have', 'wondered', 'what', 'is', 'about', 'coffee', 'that', 'we', 'love', 'so', 'much', 'like', 'how', 'is', 'it', 'even', 'possible', 'to', 'love', 'coffee', 'so', 'muchmy', 'love', 'for', 'coffee', 'extends', 'far', 'back', 'atleast', 'a', 'decade', 'back', 'when', 'i', 'used', 'to', 'sip', 'some', 'coffee', 'here', 'and', 'there', 'it', 'then', 'grew', 'into', 'a', 'weekly', 'saturday', 'morning', 'tradition', 'almost', 'when', 'my', 'friends', 'would', 'either', 'come', 'over', 'to', 'my', 'place', 'or', 'we', 'would', 'all', 'go', 'out', 'meet', 'at', 'a', 'coffee', 'shop', 'and', 'nonchalantly', 'order', 'for', 'the', 'beverage', 'of', 'our', 'choice', '–', 'coffee', 'my', 'love', 'for', 'coffee', 'has', 'developed', 'over', 'the', 'years', 'but', 'has', 'grown', 'more', 'than', 'ever', 'especially', 'in', 'the', 'past', 'few', 'years', 'i', 'know', 'it', 'may', 'seem', 'kind', 'of', 'silly', 'to', 'some', 'to', 'love', 'something', 'like', 'a', 'beverage', 'as', 'much', 'as', 'i', 'do', 'but', 'then', 'again', 'it', '’', 's', 'more', 'than', 'just', 'a', '“', 'simple', 'beverage', '”', 'to', 'meyou', 'see', 'now', 'that', 'i', 'think', 'about', 'it', 'i', 'feel', 'there', 'is', 'no', 'smell', 'i', 'love', 'waking', 'up', 'to', 'than', 'a', 'fresh', 'brewed', 'cup', 'of', 'coffee', 'i', 'think', 'there', 'is', 'just', 'something', 'so', 'inviting', 'about', 'the', 'smell', 'of', 'coffee', 'that', 'makes', 'me', 'feel', 'so', 'ready', 'i', 'mean', 'it', '’', 's', 'almost', 'like', 'it', 'makes', 'me', 'feel', 'renewed', 'i', 'actually', 'love', 'the', 'aroma', 'of', 'coffee', 'so', 'much', 'that', 'i', 'even', 'have', 'coffee', 'scented', 'perfumes', 'that', 'i', 'use', 'of', 'course', 'there', 'is', 'the', 'taste', 'that', 'i', 'truly', 'adore', 'it', 'was', 'never', 'something', 'that', 'i', 'had', 'to', 'acquire', 'so', 'to', 'speak', 'i', 'appreciate', 'the', 'taste', 'of', 'coffee', 'without', 'any', 'cream', 'or', 'sugar', 'quite', 'franklyi', 'don', '’', 't', 'know', 'why', 'am', 'i', 'getting', 'into', 'the', 'tiny', 'details', 'about', 'its', 'aroma', 'or', 'taste', 'in', 'this', 'piece', 'of', 'blog', 'post', 'but', 'i', 'totally', 'feel', 'i', 'just', 'get', 'lost', 'when', 'it', 'comes', 'to', 'either', 'talking', 'about', 'coffee', 'or', 'penning', 'down', 'about', 'the', 'subjectat', 'the', 'end', 'of', 'it', 'all', 'i', 'would', 'want', 'to', 'say', 'one', 'simple', 'thing', '–', 'when', 'you', 'appreciate', 'coffee', 'for', 'more', 'than', 'the', 'caffeine', 'it', 'provides', 'that', '’', 's', 'when', 'you', 'truly', 'begin', 'to', 'love', 'coffee', 'that', '’', 's', 'when', 'you', 'realize', 'you', 'have', 'a', 'heart', 'of', 'coffee…']\n"
53
+ ]
54
+ }
55
+ ],
56
+ "source": [
57
+ "import nltk\n",
58
+ "from nltk.tokenize import word_tokenize\n",
59
+ "import string\n",
60
+ "\n",
61
+ "#setting string\n",
62
+ "text = 'Coffee has been forever been close to my heart. If you ask me, I don’t really remember when exactly I fell in love, but I just did. The aroma, the taste, the flavour, everything is so therapeutic. I am sure, like me, you have wondered what is about coffee that we love so much? Like, how is it even possible to love coffee so much?My love for coffee extends far back, atleast a decade back when I used to sip some coffee here and there. It then grew into a weekly Saturday morning tradition almost, when my friends would either come over to my place or we would all go out, meet at a coffee shop and nonchalantly order for the beverage of our choice – coffee. My love for coffee has developed over the years, but has grown more than ever, especially, in the past few years. I know it may seem kind of silly to some to love something like a beverage as much as I do, but then again, it’s more than just a “simple beverage” to me.You see, now that I think about it, I feel, there is no smell I love waking up to than a fresh brewed cup of coffee. I think, there is just something so inviting about the smell of coffee that makes me feel so ready; I mean, it’s almost like it makes me feel renewed. I actually love the aroma of coffee so much that I even have coffee scented perfumes that I use! Of course, there is the taste that I truly adore, it was never something that I had to acquire, so to speak. I appreciate the taste of coffee without any cream or sugar, quite frankly.I don’t know why am I getting into the tiny details about its aroma or taste in this piece of blog post, but I totally feel, I just get lost when it comes to either talking about coffee or penning down about the subject.At the end of it all, I would want to say one simple thing – when you appreciate coffee for more than the caffeine it provides, that’s when you truly begin to love coffee. That’s when you realize, you have a heart of coffee…'\n",
63
+ "\n",
64
+ "#preparing the string\n",
65
+ "translating = str.maketrans('', '', string.punctuation)\n",
66
+ "cleaned_text = text.translate(translating)\n",
67
+ "token = word_tokenize(cleaned_text.lower())\n",
68
+ "\n",
69
+ "#printing the token\n",
70
+ "print(token)"
71
+ ]
72
+ },
73
+ {
74
+ "cell_type": "code",
75
+ "execution_count": 63,
76
+ "id": "9c58ac9b",
77
+ "metadata": {},
78
+ "outputs": [
79
+ {
80
+ "name": "stdout",
81
+ "output_type": "stream",
82
+ "text": [
83
+ "hasbeen->1 beenforever->1 foreverbeen->1 beenclose->1 closeto->1 myheart->1 heartif->1 ifyou->1 youask->1 askme->1 mei->1 idon->1 treally->1 reallyremember->1 rememberwhen->1 whenexactly->1 exactlyi->1 ifell->1 fellin->1 inlove->1 lovebut->1 justdid->1 didthe->1 aromathe->1 tastethe->1 theflavour->1 flavoureverything->1 everythingis->1 isso->1 sotherapeutic->1 therapeutici->1 iam->1 amsure->1 surelike->1 likeme->1 meyou->1 havewondered->1 wonderedwhat->1 whatis->1 isabout->1 thatwe->1 welove->1 loveso->1 muchlike->1 likehow->1 howis->1 isit->1 iteven->1 evenpossible->1 possibleto->1 somuchmy->1 muchmylove->1 coffeeextends->1 extendsfar->1 farback->1 backatleast->1 atleasta->1 adecade->1 decadeback->1 backwhen->1 wheni->1 iused->1 usedto->1 tosip->1 sipsome->1 somecoffee->1 coffeehere->1 hereand->1 andthere->1 thereit->1 itthen->1 thengrew->1 grewinto->1 intoa->1 aweekly->1 weeklysaturday->1 saturdaymorning->1 morningtradition->1 traditionalmost->1 almostwhen->1 whenmy->1 myfriends->1 friendswould->1 wouldeither->1 eithercome->1 comeover->1 overto->1 myplace->1 placeor->1 orwe->1 wewould->1 wouldall->1 allgo->1 goout->1 outmeet->1 meetat->1 ata->1 acoffee->1 coffeeshop->1 shopand->1 andnonchalantly->1 nonchalantlyorder->1 orderfor->1 forthe->1 thebeverage->1 beverageof->1 ofour->1 ourchoice->1 choice–->1 –coffee->1 coffeemy->1 mylove->1 hasdeveloped->1 developedover->1 overthe->1 theyears->1 yearsbut->1 buthas->1 hasgrown->1 grownmore->1 thanever->1 everespecially->1 especiallyin->1 inthe->1 thepast->1 pastfew->1 fewyears->1 yearsi->1 iknow->1 knowit->1 itmay->1 mayseem->1 seemkind->1 kindof->1 ofsilly->1 sillyto->1 tosome->1 someto->1 lovesomething->1 somethinglike->1 likea->1 abeverage->1 beverageas->1 asmuch->1 muchas->1 asi->1 ido->1 dobut->1 butthen->1 thenagain->1 againit->1 smore->1 thanjust->1 justa->1 a“->1 “simple->1 simplebeverage->1 beverage”->1 ”to->1 tomeyou->1 meyousee->1 seenow->1 nowthat->1 thinkabout->1 aboutit->1 iti->1 ifeel->1 feelthere->1 isno->1 nosmell->1 smelli->1 ilove->1 lovewaking->1 wakingup->1 upto->1 tothan->1 thana->1 afresh->1 freshbrewed->1 brewedcup->1 cupof->1 coffeei->1 thinkthere->1 isjust->1 justsomething->1 somethingso->1 soinviting->1 invitingabout->1 thesmell->1 smellof->1 thatmakes->1 feelso->1 soready->1 readyi->1 imean->1 meanit->1 salmost->1 almostlike->1 likeit->1 itmakes->1 feelrenewed->1 renewedi->1 iactually->1 actuallylove->1 lovethe->1 aromaof->1 muchthat->1 ieven->1 evenhave->1 havecoffee->1 coffeescented->1 scentedperfumes->1 perfumesthat->1 iuse->1 useof->1 ofcourse->1 coursethere->1 isthe->1 tastethat->1 itruly->1 trulyadore->1 adoreit->1 itwas->1 wasnever->1 neversomething->1 somethingthat->1 ihad->1 hadto->1 toacquire->1 acquireso->1 soto->1 tospeak->1 speaki->1 iappreciate->1 appreciatethe->1 tasteof->1 coffeewithout->1 withoutany->1 anycream->1 creamor->1 orsugar->1 sugarquite->1 quitefranklyi->1 franklyidon->1 tknow->1 knowwhy->1 whyam->1 ami->1 igetting->1 gettinginto->1 intothe->1 thetiny->1 tinydetails->1 detailsabout->1 aboutits->1 itsaroma->1 aromaor->1 ortaste->1 tastein->1 inthis->1 thispiece->1 pieceof->1 ofblog->1 blogpost->1 postbut->1 itotally->1 totallyfeel->1 feeli->1 justget->1 getlost->1 lostwhen->1 whenit->1 itcomes->1 comesto->1 toeither->1 eithertalking->1 talkingabout->1 coffeeor->1 orpenning->1 penningdown->1 downabout->1 thesubjectat->1 subjectatthe->1 theend->1 endof->1 ofit->1 itall->1 alli->1 iwould->1 wouldwant->1 wantto->1 tosay->1 sayone->1 onesimple->1 simplething->1 thing–->1 –when->1 youappreciate->1 appreciatecoffee->1 coffeefor->1 formore->1 thanthe->1 thecaffeine->1 caffeineit->1 itprovides->1 providesthat->1 youtruly->1 trulybegin->1 beginto->1 yourealize->1 realizeyou->1 havea->1 aheart->1 heartof->1 ofcoffee…->1 coffeehas->2 tomy->2 don’->2 ’t->2 buti->2 ijust->2 thearoma->2 youhave->2 aboutcoffee->2 somuch->2 lovecoffee->2 coffeeso->2 lovefor->2 forcoffee->2 it’->2 ithink->2 aboutthe->2 makesme->2 mefeel->2 that’->2 swhen->2 thetaste->3 coffeethat->3 tolove->3 morethan->3 thereis->3 whenyou->3 ’s->4 ofcoffee->4 thati->5 "
84
+ ]
85
+ }
86
+ ],
87
+ "source": [
88
+ "#FINDING THE FREQ NOW OF PAIRS OF WORDS\n",
89
+ "Elements_count = {}\n",
90
+ "for i in range(len(token)):\n",
91
+ " if(i != len(token)-1):\n",
92
+ " a = token[i]+token[i+1]\n",
93
+ " if a in Elements_count:\n",
94
+ " Elements_count[a] += 1\n",
95
+ " else:\n",
96
+ " Elements_count[a] = 1\n",
97
+ " \n",
98
+ "#SORTING THE DICTIONARY\n",
99
+ "sorted_dict = dict(sorted(Elements_count .items(), key=lambda item: item[1]))\n",
100
+ "\n",
101
+ "#PRINTING THE DICTIONARY\n",
102
+ "for key, value in sorted_dict.items():\n",
103
+ " print(f\"{key}->{value}\",end=' ')"
104
+ ]
105
+ },
106
+ {
107
+ "cell_type": "code",
108
+ "execution_count": 64,
109
+ "id": "b1faa524",
110
+ "metadata": {},
111
+ "outputs": [
112
+ {
113
+ "name": "stdout",
114
+ "output_type": "stream",
115
+ "text": [
116
+ "The number of times 'i' has come: 22\n"
117
+ ]
118
+ }
119
+ ],
120
+ "source": [
121
+ "#NOW FINDING HOW MANY TIMES 'i' HAS COME\n",
122
+ "i_count = 0\n",
123
+ "for j in range(len(token)):\n",
124
+ " if token[j] == 'i':\n",
125
+ " i_count +=1\n",
126
+ "print(\"The number of times \\'i\\' has come:\",i_count)"
127
+ ]
128
+ },
129
+ {
130
+ "cell_type": "code",
131
+ "execution_count": 65,
132
+ "id": "59d0d270",
133
+ "metadata": {},
134
+ "outputs": [
135
+ {
136
+ "name": "stdout",
137
+ "output_type": "stream",
138
+ "text": [
139
+ "The number of times 'that' has come: 9\n"
140
+ ]
141
+ }
142
+ ],
143
+ "source": [
144
+ "#SIMILARLY FINDING FOR 'that'\n",
145
+ "that_count = 0\n",
146
+ "for j in range(len(token)):\n",
147
+ " if token[j] == 'that':\n",
148
+ " that_count +=1\n",
149
+ "print(\"The number of times \\'that\\' has come:\",that_count)"
150
+ ]
151
+ },
152
+ {
153
+ "cell_type": "code",
154
+ "execution_count": 66,
155
+ "id": "bdfb07a2",
156
+ "metadata": {},
157
+ "outputs": [
158
+ {
159
+ "name": "stdout",
160
+ "output_type": "stream",
161
+ "text": [
162
+ "Total count of toekn : 389\n"
163
+ ]
164
+ }
165
+ ],
166
+ "source": [
167
+ "#TOTAL NUMBER OF WORDS\n",
168
+ "total_count = len(token)\n",
169
+ "print(\"Total count of toekn :\",total_count)"
170
+ ]
171
+ },
172
+ {
173
+ "cell_type": "code",
174
+ "execution_count": 77,
175
+ "id": "62562a76",
176
+ "metadata": {},
177
+ "outputs": [
178
+ {
179
+ "name": "stdout",
180
+ "output_type": "stream",
181
+ "text": [
182
+ "The null hypothesis is : 0.0013084766820203409\n",
183
+ "The observed is : 0.012853470437017995\n",
184
+ "The value of t-test is : 17.71528322212498\n",
185
+ "Since the confidence level id 0.005 and 17.71528322212498 > 3.169 , we can reject it and Hence it is a collocation\n"
186
+ ]
187
+ }
188
+ ],
189
+ "source": [
190
+ "import math\n",
191
+ "\n",
192
+ "#T-TEST FOR 'thati'\n",
193
+ "Null_hypothesis = (i_count/total_count)*(that_count/total_count)\n",
194
+ "print(\"The null hypothesis is :\",Null_hypothesis)\n",
195
+ "observed = (5/total_count)\n",
196
+ "print(\"The observed is :\", observed)\n",
197
+ "\n",
198
+ "t_test = (observed-Null_hypothesis)/(math.sqrt(math.pow(observed,2)/total_count))\n",
199
+ "print(\"The value of t-test is :\",t_test)\n",
200
+ "\n",
201
+ "print(\"Since the confidence level id 0.005 and \",t_test,'>',\"3.169 , we can reject it and Hence it is a collocation\")"
202
+ ]
203
+ },
204
+ {
205
+ "cell_type": "code",
206
+ "execution_count": 68,
207
+ "id": "04396255",
208
+ "metadata": {},
209
+ "outputs": [
210
+ {
211
+ "name": "stdout",
212
+ "output_type": "stream",
213
+ "text": [
214
+ "5\n",
215
+ "4\n",
216
+ "17\n",
217
+ "362\n"
218
+ ]
219
+ }
220
+ ],
221
+ "source": [
222
+ "#NOW HYPOTHESIS TEST\n",
223
+ "thati_count = 0\n",
224
+ "that_other_count = 0\n",
225
+ "other_i_count = 0\n",
226
+ "other_count = 0\n",
227
+ "\n",
228
+ "for j in range(len(token)):\n",
229
+ " if(j< len(token)-1):\n",
230
+ " if(token[j] == 'that' and token[j+1] == 'i'):\n",
231
+ " thati_count +=1\n",
232
+ " elif(token[j] == 'that' and token[j+1] != 'i'):\n",
233
+ " that_other_count += 1\n",
234
+ " elif(token[j] != 'that' and token[j+1] == 'i'):\n",
235
+ " other_i_count += 1\n",
236
+ " elif(token[j] != 'that' and token[j+1] != 'i'):\n",
237
+ " other_count += 1\n",
238
+ " \n",
239
+ "#PRINTING\n",
240
+ "print(thati_count)\n",
241
+ "print(that_other_count) \n",
242
+ "print(other_i_count)\n",
243
+ "print(other_count)"
244
+ ]
245
+ },
246
+ {
247
+ "cell_type": "code",
248
+ "execution_count": 72,
249
+ "id": "35ec04f5",
250
+ "metadata": {
251
+ "scrolled": false
252
+ },
253
+ "outputs": [
254
+ {
255
+ "name": "stdout",
256
+ "output_type": "stream",
257
+ "text": [
258
+ "The value of that i : 0.5089974293059126\n",
259
+ "The value of that other : 0.09254498714652956\n",
260
+ "The value of other i : 0.961439588688946\n",
261
+ "The value of other : 362.0\n"
262
+ ]
263
+ }
264
+ ],
265
+ "source": [
266
+ "#PRINTING\n",
267
+ "print(\"The value of that i :\",(i_count*that_count)/total_count)\n",
268
+ "print(\"The value of that other :\",(that_count*that_other_count)/total_count)\n",
269
+ "print(\"The value of other i :\",(i_count*other_i_count)/total_count)\n",
270
+ "print(\"The value of other :\",(other_count*total_count)/total_count)"
271
+ ]
272
+ },
273
+ {
274
+ "cell_type": "code",
275
+ "execution_count": 74,
276
+ "id": "2f6a88f4",
277
+ "metadata": {},
278
+ "outputs": [],
279
+ "source": [
280
+ "i =(i_count*that_count)/total_count\n",
281
+ "j = (that_count*that_other_count)/total_count\n",
282
+ "k =(i_count*other_i_count)/total_count\n",
283
+ "l = (other_count*total_count)/total_count"
284
+ ]
285
+ },
286
+ {
287
+ "cell_type": "code",
288
+ "execution_count": 75,
289
+ "id": "de862f55",
290
+ "metadata": {},
291
+ "outputs": [
292
+ {
293
+ "name": "stdout",
294
+ "output_type": "stream",
295
+ "text": [
296
+ "The hypothesis test is : 472.158941601101\n"
297
+ ]
298
+ }
299
+ ],
300
+ "source": [
301
+ "#NOW x^2\n",
302
+ "a = math.pow(thati_count-i,2)/i\n",
303
+ "b = math.pow(that_other_count-j,2)/j\n",
304
+ "c = math.pow(other_i_count-k,2)/k\n",
305
+ "d = math.pow(other_count-l,2)/l\n",
306
+ "hypothesis =a+b+c+d\n",
307
+ "print(\"The hypothesis test is :\",hypothesis)"
308
+ ]
309
+ }
310
+ ],
311
+ "metadata": {
312
+ "kernelspec": {
313
+ "display_name": "Python 3",
314
+ "language": "python",
315
+ "name": "python3"
316
+ },
317
+ "language_info": {
318
+ "codemirror_mode": {
319
+ "name": "ipython",
320
+ "version": 3
321
+ },
322
+ "file_extension": ".py",
323
+ "mimetype": "text/x-python",
324
+ "name": "python",
325
+ "nbconvert_exporter": "python",
326
+ "pygments_lexer": "ipython3",
327
+ "version": "3.8.8"
328
+ }
329
+ },
330
+ "nbformat": 4,
331
+ "nbformat_minor": 5
332
+ }
@@ -0,0 +1,231 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "d597a8c2",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Bayesian Disambiguation Algorithm"
9
+ ]
10
+ },
11
+ {
12
+ "cell_type": "markdown",
13
+ "id": "97e28de1-57fa-4968-b252-96d0b0a8b94f",
14
+ "metadata": {},
15
+ "source": [
16
+ "Code credits: [**V Tarun Thothadri**](https://github.com/TarunThothadri)"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "code",
21
+ "execution_count": 66,
22
+ "id": "62b0e452",
23
+ "metadata": {},
24
+ "outputs": [],
25
+ "source": [
26
+ "import math as m"
27
+ ]
28
+ },
29
+ {
30
+ "cell_type": "code",
31
+ "execution_count": 67,
32
+ "id": "a9f8a06c",
33
+ "metadata": {},
34
+ "outputs": [
35
+ {
36
+ "data": {
37
+ "text/plain": [
38
+ "'\\nsl = int(input(\"Enter no of sensus : \"))\\nsll = {}\\nfor i in range(sl):\\n sen = input(f\"Enter sensus (i+1) : \")\\n ll = int(input(\"Enter no of corpus for this sensus : \"))\\n for j in range(ll):'"
39
+ ]
40
+ },
41
+ "execution_count": 67,
42
+ "metadata": {},
43
+ "output_type": "execute_result"
44
+ }
45
+ ],
46
+ "source": [
47
+ "'''di = {\n",
48
+ " \"Furniture\" : [\"put coat back chair sat down\",\"chair made timber company\",\"type different chair award fun use\"],\n",
49
+ " \"Position\" : [\"chair institute best\",\"award it chair\"]\n",
50
+ "}'''\n",
51
+ "\n",
52
+ "di = {\n",
53
+ " \"Fish\" : [\"bass eat super\",\"bass lunch excellent\",\"bass ate like\"],\n",
54
+ " \"Music\" : [\"bass play music\",\"bass interest play\"]\n",
55
+ "}\n",
56
+ "\n",
57
+ "\n",
58
+ "'''\n",
59
+ "sl = int(input(\"Enter no of sensus : \"))\n",
60
+ "sll = {}\n",
61
+ "for i in range(sl):\n",
62
+ " sen = input(f\"Enter sensus (i+1) : \")\n",
63
+ " ll = int(input(\"Enter no of corpus for this sensus : \"))\n",
64
+ " for j in range(ll):''' "
65
+ ]
66
+ },
67
+ {
68
+ "cell_type": "code",
69
+ "execution_count": 68,
70
+ "id": "60271e94",
71
+ "metadata": {},
72
+ "outputs": [],
73
+ "source": [
74
+ "uws = {}\n",
75
+ "for i in di:\n",
76
+ " for j in di[i]:\n",
77
+ " wrds = j.split(' ')\n",
78
+ " for wrd in wrds:\n",
79
+ " if wrd not in uws:\n",
80
+ " uws[wrd] = 1\n",
81
+ " else:\n",
82
+ " uws[wrd] += 1\n",
83
+ "\n",
84
+ "voc = list(uws.keys())\n",
85
+ "v = len(voc)\n",
86
+ "cw = 0\n",
87
+ "for i in di:\n",
88
+ " cw += len(di[i])\n",
89
+ "sensus = list(di.keys())"
90
+ ]
91
+ },
92
+ {
93
+ "cell_type": "markdown",
94
+ "id": "b1bbf094",
95
+ "metadata": {},
96
+ "source": [
97
+ "Training Algorithm"
98
+ ]
99
+ },
100
+ {
101
+ "cell_type": "code",
102
+ "execution_count": 69,
103
+ "id": "0ac06be3",
104
+ "metadata": {},
105
+ "outputs": [],
106
+ "source": [
107
+ "#Laplace Formula\n",
108
+ "p={}\n",
109
+ "for sk in sensus:\n",
110
+ " for vj in voc:\n",
111
+ " c_vjsk = 0\n",
112
+ " l_of_sen = di[sk]\n",
113
+ " for wl in l_of_sen:\n",
114
+ " c_vjsk += wl.count(vj)\n",
115
+ " p[(vj,sk)] = float((c_vjsk+1)/(len(di[sk])+v))\n",
116
+ "\n",
117
+ "psk = {}\n",
118
+ "for sk in sensus:\n",
119
+ " psk[sk] = float(len(di[sk])/cw)"
120
+ ]
121
+ },
122
+ {
123
+ "cell_type": "markdown",
124
+ "id": "4443f01b",
125
+ "metadata": {},
126
+ "source": [
127
+ "Disambiguation Algorithm"
128
+ ]
129
+ },
130
+ {
131
+ "cell_type": "code",
132
+ "execution_count": 70,
133
+ "id": "2770e777",
134
+ "metadata": {},
135
+ "outputs": [],
136
+ "source": [
137
+ "score = {}\n",
138
+ "for sk in sensus:\n",
139
+ " score[sk] = float(m.log(psk[sk],10))\n",
140
+ " for vj in voc:\n",
141
+ " score[sk] = float(score[sk] + float(m.log(p[vj,sk],10)))"
142
+ ]
143
+ },
144
+ {
145
+ "cell_type": "markdown",
146
+ "id": "d96773ee",
147
+ "metadata": {},
148
+ "source": [
149
+ "User Input"
150
+ ]
151
+ },
152
+ {
153
+ "cell_type": "code",
154
+ "execution_count": 71,
155
+ "id": "a36d5efa",
156
+ "metadata": {},
157
+ "outputs": [],
158
+ "source": [
159
+ "ui = \"bass super excellent play\"\n",
160
+ "ui = ui.split(' ')"
161
+ ]
162
+ },
163
+ {
164
+ "cell_type": "code",
165
+ "execution_count": 72,
166
+ "id": "3f581dac",
167
+ "metadata": {},
168
+ "outputs": [
169
+ {
170
+ "name": "stdout",
171
+ "output_type": "stream",
172
+ "text": [
173
+ "Fish\n",
174
+ "Fish init : -0.22184874961635637\n",
175
+ "Fish : -0.7337321105952307\n",
176
+ "Fish : -1.5466454672380863\n",
177
+ "Fish : -2.359558823880942\n",
178
+ "Fish : -3.473502176187779\n",
179
+ "Music\n",
180
+ "Music init : -0.39794000867203755\n",
181
+ "Music : -0.9999999999999998\n",
182
+ "Music : -2.079181246047624\n",
183
+ "Music : -3.158362492095249\n",
184
+ "Music : -3.760422483423211\n",
185
+ "For the given context, the sense is Fish with score : -3.473502176187779\n"
186
+ ]
187
+ }
188
+ ],
189
+ "source": [
190
+ "sc = {}\n",
191
+ "for sk in sensus:\n",
192
+ " print(sk)\n",
193
+ " sc[sk] = float(m.log(psk[sk],10))\n",
194
+ " print(sk,\"init : \",sc[sk])\n",
195
+ " for vj in ui:\n",
196
+ " sc[sk] = float(float(sc[sk]) + float(m.log(p[vj,sk],10)))\n",
197
+ " print(sk,\" : \",sc[sk])\n",
198
+ "\n",
199
+ "maxn = -9999\n",
200
+ "maxp = \"\"\n",
201
+ "for s in sc:\n",
202
+ " if sc[s] > maxn :\n",
203
+ " maxn = float(sc[s])\n",
204
+ " maxp = s\n",
205
+ "\n",
206
+ "print(\"For the given context, the sense is \",maxp,\" with score : \",maxn)"
207
+ ]
208
+ }
209
+ ],
210
+ "metadata": {
211
+ "kernelspec": {
212
+ "display_name": "Python 3 (ipykernel)",
213
+ "language": "python",
214
+ "name": "python3"
215
+ },
216
+ "language_info": {
217
+ "codemirror_mode": {
218
+ "name": "ipython",
219
+ "version": 3
220
+ },
221
+ "file_extension": ".py",
222
+ "mimetype": "text/x-python",
223
+ "name": "python",
224
+ "nbconvert_exporter": "python",
225
+ "pygments_lexer": "ipython3",
226
+ "version": "3.11.5"
227
+ }
228
+ },
229
+ "nbformat": 4,
230
+ "nbformat_minor": 5
231
+ }