noshot 0.1.6__py3-none-any.whl → 0.1.8__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 (228) hide show
  1. noshot/data/ML TS XAI/ML/1. PCA - EDA/PCA-EDA.ipynb +207 -0
  2. noshot/data/ML TS XAI/ML/1. PCA - EDA/balance-scale.csv +626 -0
  3. noshot/data/ML TS XAI/ML/1. PCA - EDA/input.txt +625 -0
  4. noshot/data/ML TS XAI/ML/2. KNN Classifier/KNN.ipynb +287 -0
  5. noshot/data/ML TS XAI/ML/2. KNN Classifier/balance-scale.csv +626 -0
  6. noshot/data/ML TS XAI/ML/2. KNN Classifier/input.txt +625 -0
  7. noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/LDA.ipynb +83 -0
  8. noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/balance-scale.csv +626 -0
  9. noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/input.txt +625 -0
  10. noshot/data/ML TS XAI/ML/4. Linear Regression/Linear-Regression.ipynb +117 -0
  11. noshot/data/ML TS XAI/ML/4. Linear Regression/machine-data.csv +210 -0
  12. noshot/data/ML TS XAI/ML/5. Logistic Regression/Logistic-Regression.ipynb +137 -0
  13. noshot/data/ML TS XAI/ML/5. Logistic Regression/wine-dataset.csv +179 -0
  14. noshot/data/ML TS XAI/ML/6. Bayesian Classifier/Bayesian.ipynb +129 -0
  15. noshot/data/ML TS XAI/ML/6. Bayesian Classifier/wine-dataset.csv +179 -0
  16. {noshot-0.1.6.dist-info → noshot-0.1.8.dist-info}/METADATA +2 -2
  17. noshot-0.1.8.dist-info/RECORD +24 -0
  18. noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(A) Breadth First Search.ipynb +0 -112
  19. noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(B) Depth First Search.ipynb +0 -111
  20. noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(C) Uniform Cost Search.ipynb +0 -134
  21. noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(D) Depth Limites Search.ipynb +0 -115
  22. noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(E) Iterative Deepening DFS.ipynb +0 -123
  23. noshot/data/ML TS XAI/AIDS/10. ANOVA/2_ANOVA.csv +0 -769
  24. noshot/data/ML TS XAI/AIDS/10. ANOVA/One Way ANOVA (Repeated Measure).ipynb +0 -126
  25. noshot/data/ML TS XAI/AIDS/10. ANOVA/One Way ANOVA.ipynb +0 -134
  26. noshot/data/ML TS XAI/AIDS/10. ANOVA/Sample 1 Way ANOVA Test.ipynb +0 -119
  27. noshot/data/ML TS XAI/AIDS/10. ANOVA/Two Way ANOVA.ipynb +0 -138
  28. noshot/data/ML TS XAI/AIDS/10. ANOVA/reaction_time.csv +0 -5
  29. noshot/data/ML TS XAI/AIDS/10. ANOVA/sample_data.csv +0 -16
  30. noshot/data/ML TS XAI/AIDS/10. ANOVA/sleep_deprivation.csv +0 -4
  31. noshot/data/ML TS XAI/AIDS/11. Linear Regression/3_Linear.csv +0 -4802
  32. noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression LAB.ipynb +0 -113
  33. noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression New- sklearn.ipynb +0 -118
  34. noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression.ipynb +0 -148
  35. noshot/data/ML TS XAI/AIDS/11. Linear Regression/house_rate.csv +0 -22
  36. noshot/data/ML TS XAI/AIDS/12. Logistic Regression/Logistic Regression New- sklearn.ipynb +0 -128
  37. noshot/data/ML TS XAI/AIDS/12. Logistic Regression/Logistic Regression.ipynb +0 -145
  38. noshot/data/ML TS XAI/AIDS/12. Logistic Regression/default.csv +0 -1001
  39. noshot/data/ML TS XAI/AIDS/12. Logistic Regression/hours_scores_records.csv +0 -101
  40. noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(A) Astar.ipynb +0 -256
  41. noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(B) IDAstar.ipynb +0 -157
  42. noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(C) SMAstar.ipynb +0 -178
  43. noshot/data/ML TS XAI/AIDS/3. Genetic Algorithm/Genetic.ipynb +0 -95
  44. noshot/data/ML TS XAI/AIDS/4. Simulated Annealing/Simulated Annealing.ipynb +0 -74
  45. noshot/data/ML TS XAI/AIDS/4. Simulated Annealing/Sudoku Simulated Annealing.ipynb +0 -103
  46. noshot/data/ML TS XAI/AIDS/5. Alpha Beta Pruning/AlphaBetaPruning.ipynb +0 -182
  47. noshot/data/ML TS XAI/AIDS/6. Consraint Satisfaction Problems (CSP)/(A) CSP House Allocation.ipynb +0 -120
  48. noshot/data/ML TS XAI/AIDS/6. Consraint Satisfaction Problems (CSP)/(B) CSP Map Coloring.ipynb +0 -125
  49. noshot/data/ML TS XAI/AIDS/7. Random Sampling/Random Sampling.ipynb +0 -73
  50. noshot/data/ML TS XAI/AIDS/7. Random Sampling/height_weight_bmi.csv +0 -8389
  51. noshot/data/ML TS XAI/AIDS/8. Z Test/Z Test Hash Function.ipynb +0 -141
  52. noshot/data/ML TS XAI/AIDS/8. Z Test/Z Test.ipynb +0 -151
  53. noshot/data/ML TS XAI/AIDS/8. Z Test/height_weight_bmi.csv +0 -8389
  54. noshot/data/ML TS XAI/AIDS/9. T Test/1_heart.csv +0 -304
  55. noshot/data/ML TS XAI/AIDS/9. T Test/Independent T Test.ipynb +0 -119
  56. noshot/data/ML TS XAI/AIDS/9. T Test/Paired T Test.ipynb +0 -118
  57. noshot/data/ML TS XAI/AIDS/9. T Test/T Test Hash Function.ipynb +0 -142
  58. noshot/data/ML TS XAI/AIDS/9. T Test/T Test.ipynb +0 -158
  59. noshot/data/ML TS XAI/AIDS/9. T Test/height_weight_bmi.csv +0 -8389
  60. noshot/data/ML TS XAI/AIDS/9. T Test/iq_test.csv +0 -0
  61. noshot/data/ML TS XAI/AIDS/Others (AllinOne)/All In One.ipynb +0 -4581
  62. noshot/data/ML TS XAI/CN/1. Chat Application/chat.java +0 -81
  63. noshot/data/ML TS XAI/CN/1. Chat Application/output.png +0 -0
  64. noshot/data/ML TS XAI/CN/1. Chat Application/procedure.png +0 -0
  65. noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/LAN.tcl +0 -65
  66. noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/analysis.awk +0 -44
  67. noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/output.png +0 -0
  68. noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/procedure.png +0 -0
  69. noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/complexdcf.tcl +0 -229
  70. noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/output.png +0 -0
  71. noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/procedure.png +0 -0
  72. noshot/data/ML TS XAI/CN/2. File Transfer/file_to_send.txt +0 -2
  73. noshot/data/ML TS XAI/CN/2. File Transfer/filetransfer.java +0 -119
  74. noshot/data/ML TS XAI/CN/2. File Transfer/output.png +0 -0
  75. noshot/data/ML TS XAI/CN/2. File Transfer/procedure.png +0 -0
  76. noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/Client.class +0 -0
  77. noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/MyServerImpl.class +0 -0
  78. noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/MyServerIntf.class +0 -0
  79. noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/Server.class +0 -0
  80. noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/output.png +0 -0
  81. noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/procedure.png +0 -0
  82. noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/rmi.java +0 -56
  83. noshot/data/ML TS XAI/CN/4. Wired Network/output.png +0 -0
  84. noshot/data/ML TS XAI/CN/4. Wired Network/procedure.png +0 -0
  85. noshot/data/ML TS XAI/CN/4. Wired Network/wired.awk +0 -25
  86. noshot/data/ML TS XAI/CN/4. Wired Network/wired.tcl +0 -81
  87. noshot/data/ML TS XAI/CN/5. Wireless Network/output.png +0 -0
  88. noshot/data/ML TS XAI/CN/5. Wireless Network/procedure.png +0 -0
  89. noshot/data/ML TS XAI/CN/5. Wireless Network/wireless.awk +0 -27
  90. noshot/data/ML TS XAI/CN/5. Wireless Network/wireless.tcl +0 -153
  91. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/analysis.awk +0 -27
  92. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/output.png +0 -0
  93. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/sack.tcl +0 -86
  94. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/vegas.tcl +0 -86
  95. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/analysis.awk +0 -28
  96. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/output.png +0 -0
  97. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/reno.tcl +0 -78
  98. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/tahoe.tcl +0 -79
  99. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/analysis.awk +0 -27
  100. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/flow.tcl +0 -163
  101. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/output.png +0 -0
  102. noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/procedure.png +0 -0
  103. noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/DV.tcl +0 -111
  104. noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/LS.tcl +0 -106
  105. noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/analysis.awk +0 -36
  106. noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/output.png +0 -0
  107. noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/procedure.png +0 -0
  108. noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/analysis.awk +0 -20
  109. noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/broadcast.tcl +0 -76
  110. noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/multicast.tcl +0 -103
  111. noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/output.png +0 -0
  112. noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/procedure.png +0 -0
  113. noshot/data/ML TS XAI/CN/9. DHCP/DHCP.java +0 -125
  114. noshot/data/ML TS XAI/CN/9. DHCP/output.png +0 -0
  115. noshot/data/ML TS XAI/CN/9. DHCP/procedure.png +0 -0
  116. noshot/data/ML TS XAI/NLP/NLP 1/1-Prereqs.py +0 -18
  117. noshot/data/ML TS XAI/NLP/NLP 1/2-Chi2test.py +0 -83
  118. noshot/data/ML TS XAI/NLP/NLP 1/2-T-test.py +0 -79
  119. noshot/data/ML TS XAI/NLP/NLP 1/3-WSD-nb.py +0 -53
  120. noshot/data/ML TS XAI/NLP/NLP 1/4-Hindle-Rooth.py +0 -53
  121. noshot/data/ML TS XAI/NLP/NLP 1/5-HMM-Trellis.py +0 -82
  122. noshot/data/ML TS XAI/NLP/NLP 1/6-HMM-Viterbi.py +0 -16
  123. noshot/data/ML TS XAI/NLP/NLP 1/7-PCFG-parsetree.py +0 -15
  124. noshot/data/ML TS XAI/NLP/NLP 1/Chi2test.ipynb +0 -285
  125. noshot/data/ML TS XAI/NLP/NLP 1/Hindle-Rooth.ipynb +0 -179
  126. noshot/data/ML TS XAI/NLP/NLP 1/Lab 10 - Text generator using LSTM.ipynb +0 -1461
  127. noshot/data/ML TS XAI/NLP/NLP 1/Lab 11 NMT.ipynb +0 -2307
  128. noshot/data/ML TS XAI/NLP/NLP 1/PCFG.ipynb +0 -134
  129. noshot/data/ML TS XAI/NLP/NLP 1/Prereqs.ipynb +0 -131
  130. noshot/data/ML TS XAI/NLP/NLP 1/T test.ipynb +0 -252
  131. noshot/data/ML TS XAI/NLP/NLP 1/TFIDF BOW.ipynb +0 -171
  132. noshot/data/ML TS XAI/NLP/NLP 1/Trellis.ipynb +0 -244
  133. noshot/data/ML TS XAI/NLP/NLP 1/WSD.ipynb +0 -645
  134. noshot/data/ML TS XAI/NLP/NLP 1/Word2Vec.ipynb +0 -93
  135. noshot/data/ML TS XAI/NLP/NLP 2/Lab01(tokenizer)/tokenizer.ipynb +0 -370
  136. noshot/data/ML TS XAI/NLP/NLP 2/Lab01(tokenizer)/training_tokenizer.txt +0 -6
  137. noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/exp0.ipynb +0 -274
  138. noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/lab2.ipynb +0 -905
  139. noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/test.txt +0 -1
  140. noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/tokenizing.ipynb +0 -272
  141. noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/collocation.ipynb +0 -332
  142. noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/lab3.ipynb +0 -549
  143. noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/nlp.txt +0 -1
  144. noshot/data/ML TS XAI/NLP/NLP 2/Lab04(collocation)/Lab4-NLP-Exp-2.ipynb +0 -817
  145. noshot/data/ML TS XAI/NLP/NLP 2/Lab04(collocation)/collocation.ipynb +0 -332
  146. noshot/data/ML TS XAI/NLP/NLP 2/Lab05(WSD)/NLP-Lab-5-Exp3.ipynb +0 -231
  147. noshot/data/ML TS XAI/NLP/NLP 2/Lab05(WSD)/word-sense-disambiguation.ipynb +0 -507
  148. noshot/data/ML TS XAI/NLP/NLP 2/Lab06(additional-exercise)/lab6.ipynb +0 -134
  149. noshot/data/ML TS XAI/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP Exp 4.ipynb +0 -255
  150. noshot/data/ML TS XAI/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP_Exp_5.ipynb +0 -159
  151. noshot/data/ML TS XAI/NLP/NLP 2/Lab08(PCFG)/PCFG.ipynb +0 -282
  152. noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/Lab 9 - MLP classifier.ipynb +0 -670
  153. noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/MLP-alternative-code.ipynb +0 -613
  154. noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/hindle-rooth-algorithm.ipynb +0 -74
  155. noshot/data/ML TS XAI/NLP/NLP 2/Lab10(LSTM)/Lab_10_Text_generator_using_LSTM.ipynb +0 -480
  156. noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Machine-translation.ipynb +0 -445
  157. noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Viterbi-PCFG.ipynb +0 -105
  158. noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/corpora_tools.py +0 -87
  159. noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/data_utils.py +0 -11
  160. noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/train_translator.py +0 -83
  161. noshot/data/ML TS XAI/NLP/NLP 2/Lab12(Information-Extraction)/Information_Extraction.ipynb +0 -201
  162. noshot/data/ML TS XAI/NLP/NLP 3/Backtrack-without-Verbitri.ipynb +0 -185
  163. noshot/data/ML TS XAI/NLP/NLP 3/Backward-Procedure.ipynb +0 -597
  164. noshot/data/ML TS XAI/NLP/NLP 3/Bag_of.ipynb +0 -1422
  165. noshot/data/ML TS XAI/NLP/NLP 3/CYK-algorithm.ipynb +0 -1067
  166. noshot/data/ML TS XAI/NLP/NLP 3/Forward-Procedure.ipynb +0 -477
  167. noshot/data/ML TS XAI/NLP/NLP 3/LSTM.ipynb +0 -1290
  168. noshot/data/ML TS XAI/NLP/NLP 3/Lab 10 - Text generator using LSTM.ipynb +0 -1461
  169. noshot/data/ML TS XAI/NLP/NLP 3/Lab 11 NMT.ipynb +0 -2307
  170. noshot/data/ML TS XAI/NLP/NLP 3/NLP-LAB-4.ipynb +0 -216
  171. noshot/data/ML TS XAI/NLP/NLP 3/NLP-LAB-5.ipynb +0 -216
  172. noshot/data/ML TS XAI/NLP/NLP 3/abc.txt +0 -6
  173. noshot/data/ML TS XAI/NLP/NLP 3/ex-1-nltk.ipynb +0 -711
  174. noshot/data/ML TS XAI/NLP/NLP 3/ex-2-nlp.ipynb +0 -267
  175. noshot/data/ML TS XAI/NLP/NLP 3/exp8&9.ipynb +0 -305
  176. noshot/data/ML TS XAI/NLP/NLP 3/hind.ipynb +0 -287
  177. noshot/data/ML TS XAI/NLP/NLP 3/lab66.ipynb +0 -752
  178. noshot/data/ML TS XAI/NLP/NLP 3/leb_3.ipynb +0 -612
  179. noshot/data/ML TS XAI/NLP/NLP 3/naive_bayes_classifier.pkl +0 -0
  180. noshot/data/ML TS XAI/NLP/NLP 3/nlp_leb_1.ipynb +0 -3008
  181. noshot/data/ML TS XAI/NLP/NLP 3/nlp_leb_2.ipynb +0 -3095
  182. noshot/data/ML TS XAI/NLP/NLP 3/nlplab-9.ipynb +0 -295
  183. noshot/data/ML TS XAI/NLP/NLP 3/nltk-ex-4.ipynb +0 -506
  184. noshot/data/ML TS XAI/NLP/NLP 3/text1.txt +0 -48
  185. noshot/data/ML TS XAI/NLP/NLP 3/text2.txt +0 -8
  186. noshot/data/ML TS XAI/NLP/NLP 3/text3.txt +0 -48
  187. noshot/data/ML TS XAI/NLP/NLP 3/translation-rnn.ipynb +0 -812
  188. noshot/data/ML TS XAI/NLP/NLP 3/word2vector.ipynb +0 -173
  189. noshot/data/ML TS XAI/NLP/NLP 4/Backward Procedure Algorithm.ipynb +0 -179
  190. noshot/data/ML TS XAI/NLP/NLP 4/Chi Square Collocation.ipynb +0 -208
  191. noshot/data/ML TS XAI/NLP/NLP 4/Collocation (T test).ipynb +0 -188
  192. noshot/data/ML TS XAI/NLP/NLP 4/Experiment 1.ipynb +0 -437
  193. noshot/data/ML TS XAI/NLP/NLP 4/Forward Procedure Algorithm.ipynb +0 -132
  194. noshot/data/ML TS XAI/NLP/NLP 4/Hindle Rooth.ipynb +0 -414
  195. noshot/data/ML TS XAI/NLP/NLP 4/MachineTranslation.ipynb +0 -368
  196. noshot/data/ML TS XAI/NLP/NLP 4/Multi Layer Perceptron using MLPClassifier.ipynb +0 -86
  197. noshot/data/ML TS XAI/NLP/NLP 4/Multi Layer Perceptron using Tensorflow.ipynb +0 -112
  198. noshot/data/ML TS XAI/NLP/NLP 4/PCFG Inside Probability.ipynb +0 -451
  199. noshot/data/ML TS XAI/NLP/NLP 4/Text Generation using LSTM.ipynb +0 -297
  200. noshot/data/ML TS XAI/NLP/NLP 4/Viterbi.ipynb +0 -310
  201. noshot/data/ML TS XAI/NLP/NLP 4/Word Sense Disambiguation.ipynb +0 -335
  202. noshot/data/ML TS XAI/NLP/NLP 5/10.Text Generation using LSTM.ipynb +0 -316
  203. noshot/data/ML TS XAI/NLP/NLP 5/11.Machine Translation.ipynb +0 -868
  204. noshot/data/ML TS XAI/NLP/NLP 5/2.T and Chi2 Test.ipynb +0 -204
  205. noshot/data/ML TS XAI/NLP/NLP 5/3.Word Sense Diambiguation.ipynb +0 -234
  206. noshot/data/ML TS XAI/NLP/NLP 5/4.Hinddle and Rooth.ipynb +0 -128
  207. noshot/data/ML TS XAI/NLP/NLP 5/5.Forward and Backward.ipynb +0 -149
  208. noshot/data/ML TS XAI/NLP/NLP 5/6.Viterbi.ipynb +0 -111
  209. noshot/data/ML TS XAI/NLP/NLP 5/7.PCFG Parse Tree.ipynb +0 -134
  210. noshot/data/ML TS XAI/NLP/NLP 5/7.PCFG using cyk.ipynb +0 -101
  211. noshot/data/ML TS XAI/NLP/NLP 5/8.Bag of words and TF-IDF.ipynb +0 -310
  212. noshot/data/ML TS XAI/NLP/NLP 5/9.Word2Vector.ipynb +0 -78
  213. noshot/data/ML TS XAI/NLP/NLP 5/NLP ALL In One.ipynb +0 -2619
  214. noshot/data/ML TS XAI/NLP/NLP 5/sample1.txt +0 -15
  215. noshot/data/ML TS XAI/NLP/NLP 5/sample2.txt +0 -4
  216. noshot/data/ML TS XAI/NLP/NLP 5/word2vec_model.bin +0 -0
  217. noshot/data/ML TS XAI/NLP/NLP 6/1. Tokenize, Tagging, NER, Parse Tree.ipynb +0 -312
  218. noshot/data/ML TS XAI/NLP/NLP 6/2. T Test and Chi2 Test.ipynb +0 -185
  219. noshot/data/ML TS XAI/NLP/NLP 6/3. Naive Bayes WSD.ipynb +0 -199
  220. noshot/data/ML TS XAI/NLP/NLP 6/4. Hinddle and Rooth.ipynb +0 -151
  221. noshot/data/ML TS XAI/NLP/NLP 6/5 and 6 FWD, BWD, Viterbi.ipynb +0 -164
  222. noshot/data/ML TS XAI/NLP/NLP 6/7. PCFG using CYK.ipynb +0 -383
  223. noshot/data/ML TS XAI/NLP/NLP 6/8. BOW and TF-IDF.ipynb +0 -252
  224. noshot/data/ML TS XAI/Ubuntu CN Lab.iso +0 -0
  225. noshot-0.1.6.dist-info/RECORD +0 -216
  226. {noshot-0.1.6.dist-info → noshot-0.1.8.dist-info}/LICENSE.txt +0 -0
  227. {noshot-0.1.6.dist-info → noshot-0.1.8.dist-info}/WHEEL +0 -0
  228. {noshot-0.1.6.dist-info → noshot-0.1.8.dist-info}/top_level.txt +0 -0
@@ -1,332 +0,0 @@
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
- }
@@ -1,231 +0,0 @@
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
- }