noshot 0.1.7__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.
- noshot/data/ML TS XAI/ML/1. PCA - EDA/PCA-EDA.ipynb +207 -0
- noshot/data/ML TS XAI/ML/1. PCA - EDA/balance-scale.csv +626 -0
- noshot/data/ML TS XAI/ML/1. PCA - EDA/input.txt +625 -0
- noshot/data/ML TS XAI/ML/2. KNN Classifier/KNN.ipynb +287 -0
- noshot/data/ML TS XAI/ML/2. KNN Classifier/balance-scale.csv +626 -0
- noshot/data/ML TS XAI/ML/2. KNN Classifier/input.txt +625 -0
- noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/LDA.ipynb +83 -0
- noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/balance-scale.csv +626 -0
- noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/input.txt +625 -0
- noshot/data/ML TS XAI/ML/4. Linear Regression/Linear-Regression.ipynb +117 -0
- noshot/data/ML TS XAI/ML/4. Linear Regression/machine-data.csv +210 -0
- noshot/data/ML TS XAI/ML/5. Logistic Regression/Logistic-Regression.ipynb +137 -0
- noshot/data/ML TS XAI/ML/5. Logistic Regression/wine-dataset.csv +179 -0
- noshot/data/ML TS XAI/ML/6. Bayesian Classifier/Bayesian.ipynb +129 -0
- noshot/data/ML TS XAI/ML/6. Bayesian Classifier/wine-dataset.csv +179 -0
- {noshot-0.1.7.dist-info → noshot-0.1.8.dist-info}/METADATA +2 -2
- noshot-0.1.8.dist-info/RECORD +24 -0
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(A) Breadth First Search.ipynb +0 -112
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(B) Depth First Search.ipynb +0 -111
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(C) Uniform Cost Search.ipynb +0 -134
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(D) Depth Limites Search.ipynb +0 -115
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(E) Iterative Deepening DFS.ipynb +0 -123
- noshot/data/ML TS XAI/AIDS/10. ANOVA/2_ANOVA.csv +0 -769
- noshot/data/ML TS XAI/AIDS/10. ANOVA/One Way ANOVA (Repeated Measure).ipynb +0 -126
- noshot/data/ML TS XAI/AIDS/10. ANOVA/One Way ANOVA.ipynb +0 -134
- noshot/data/ML TS XAI/AIDS/10. ANOVA/Sample 1 Way ANOVA Test.ipynb +0 -119
- noshot/data/ML TS XAI/AIDS/10. ANOVA/Two Way ANOVA.ipynb +0 -138
- noshot/data/ML TS XAI/AIDS/10. ANOVA/reaction_time.csv +0 -5
- noshot/data/ML TS XAI/AIDS/10. ANOVA/sample_data.csv +0 -16
- noshot/data/ML TS XAI/AIDS/10. ANOVA/sleep_deprivation.csv +0 -4
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/3_Linear.csv +0 -4802
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression LAB.ipynb +0 -113
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression New- sklearn.ipynb +0 -118
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression.ipynb +0 -148
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/house_rate.csv +0 -22
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/Logistic Regression New- sklearn.ipynb +0 -128
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/Logistic Regression.ipynb +0 -145
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/default.csv +0 -1001
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/hours_scores_records.csv +0 -101
- noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(A) Astar.ipynb +0 -256
- noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(B) IDAstar.ipynb +0 -157
- noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(C) SMAstar.ipynb +0 -178
- noshot/data/ML TS XAI/AIDS/3. Genetic Algorithm/Genetic.ipynb +0 -95
- noshot/data/ML TS XAI/AIDS/4. Simulated Annealing/Simulated Annealing.ipynb +0 -74
- noshot/data/ML TS XAI/AIDS/4. Simulated Annealing/Sudoku Simulated Annealing.ipynb +0 -103
- noshot/data/ML TS XAI/AIDS/5. Alpha Beta Pruning/AlphaBetaPruning.ipynb +0 -182
- noshot/data/ML TS XAI/AIDS/6. Consraint Satisfaction Problems (CSP)/(A) CSP House Allocation.ipynb +0 -120
- noshot/data/ML TS XAI/AIDS/6. Consraint Satisfaction Problems (CSP)/(B) CSP Map Coloring.ipynb +0 -125
- noshot/data/ML TS XAI/AIDS/7. Random Sampling/Random Sampling.ipynb +0 -73
- noshot/data/ML TS XAI/AIDS/7. Random Sampling/height_weight_bmi.csv +0 -8389
- noshot/data/ML TS XAI/AIDS/8. Z Test/Z Test Hash Function.ipynb +0 -141
- noshot/data/ML TS XAI/AIDS/8. Z Test/Z Test.ipynb +0 -151
- noshot/data/ML TS XAI/AIDS/8. Z Test/height_weight_bmi.csv +0 -8389
- noshot/data/ML TS XAI/AIDS/9. T Test/1_heart.csv +0 -304
- noshot/data/ML TS XAI/AIDS/9. T Test/Independent T Test.ipynb +0 -119
- noshot/data/ML TS XAI/AIDS/9. T Test/Paired T Test.ipynb +0 -118
- noshot/data/ML TS XAI/AIDS/9. T Test/T Test Hash Function.ipynb +0 -142
- noshot/data/ML TS XAI/AIDS/9. T Test/T Test.ipynb +0 -158
- noshot/data/ML TS XAI/AIDS/9. T Test/height_weight_bmi.csv +0 -8389
- noshot/data/ML TS XAI/AIDS/9. T Test/iq_test.csv +0 -0
- noshot/data/ML TS XAI/AIDS/Others (AllinOne)/All In One.ipynb +0 -4581
- noshot/data/ML TS XAI/CN/1. Chat Application/chat.java +0 -81
- noshot/data/ML TS XAI/CN/1. Chat Application/output.png +0 -0
- noshot/data/ML TS XAI/CN/1. Chat Application/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/LAN.tcl +0 -65
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/analysis.awk +0 -44
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/output.png +0 -0
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/complexdcf.tcl +0 -229
- noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/output.png +0 -0
- noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/2. File Transfer/file_to_send.txt +0 -2
- noshot/data/ML TS XAI/CN/2. File Transfer/filetransfer.java +0 -119
- noshot/data/ML TS XAI/CN/2. File Transfer/output.png +0 -0
- noshot/data/ML TS XAI/CN/2. File Transfer/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/Client.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/MyServerImpl.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/MyServerIntf.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/Server.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/output.png +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/rmi.java +0 -56
- noshot/data/ML TS XAI/CN/4. Wired Network/output.png +0 -0
- noshot/data/ML TS XAI/CN/4. Wired Network/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/4. Wired Network/wired.awk +0 -25
- noshot/data/ML TS XAI/CN/4. Wired Network/wired.tcl +0 -81
- noshot/data/ML TS XAI/CN/5. Wireless Network/output.png +0 -0
- noshot/data/ML TS XAI/CN/5. Wireless Network/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/5. Wireless Network/wireless.awk +0 -27
- noshot/data/ML TS XAI/CN/5. Wireless Network/wireless.tcl +0 -153
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/analysis.awk +0 -27
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/output.png +0 -0
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/sack.tcl +0 -86
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/vegas.tcl +0 -86
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/analysis.awk +0 -28
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/output.png +0 -0
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/reno.tcl +0 -78
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/tahoe.tcl +0 -79
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/analysis.awk +0 -27
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/flow.tcl +0 -163
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/output.png +0 -0
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/DV.tcl +0 -111
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/LS.tcl +0 -106
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/analysis.awk +0 -36
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/output.png +0 -0
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/analysis.awk +0 -20
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/broadcast.tcl +0 -76
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/multicast.tcl +0 -103
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/output.png +0 -0
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/9. DHCP/DHCP.java +0 -125
- noshot/data/ML TS XAI/CN/9. DHCP/output.png +0 -0
- noshot/data/ML TS XAI/CN/9. DHCP/procedure.png +0 -0
- noshot/data/ML TS XAI/NLP/NLP 1/1-Prereqs.py +0 -18
- noshot/data/ML TS XAI/NLP/NLP 1/2-Chi2test.py +0 -83
- noshot/data/ML TS XAI/NLP/NLP 1/2-T-test.py +0 -79
- noshot/data/ML TS XAI/NLP/NLP 1/3-WSD-nb.py +0 -53
- noshot/data/ML TS XAI/NLP/NLP 1/4-Hindle-Rooth.py +0 -53
- noshot/data/ML TS XAI/NLP/NLP 1/5-HMM-Trellis.py +0 -82
- noshot/data/ML TS XAI/NLP/NLP 1/6-HMM-Viterbi.py +0 -16
- noshot/data/ML TS XAI/NLP/NLP 1/7-PCFG-parsetree.py +0 -15
- noshot/data/ML TS XAI/NLP/NLP 1/Chi2test.ipynb +0 -285
- noshot/data/ML TS XAI/NLP/NLP 1/Hindle-Rooth.ipynb +0 -179
- noshot/data/ML TS XAI/NLP/NLP 1/Lab 10 - Text generator using LSTM.ipynb +0 -1461
- noshot/data/ML TS XAI/NLP/NLP 1/Lab 11 NMT.ipynb +0 -2307
- noshot/data/ML TS XAI/NLP/NLP 1/PCFG.ipynb +0 -134
- noshot/data/ML TS XAI/NLP/NLP 1/Prereqs.ipynb +0 -131
- noshot/data/ML TS XAI/NLP/NLP 1/T test.ipynb +0 -252
- noshot/data/ML TS XAI/NLP/NLP 1/TFIDF BOW.ipynb +0 -171
- noshot/data/ML TS XAI/NLP/NLP 1/Trellis.ipynb +0 -244
- noshot/data/ML TS XAI/NLP/NLP 1/WSD.ipynb +0 -645
- noshot/data/ML TS XAI/NLP/NLP 1/Word2Vec.ipynb +0 -93
- noshot/data/ML TS XAI/NLP/NLP 2/Lab01(tokenizer)/tokenizer.ipynb +0 -370
- noshot/data/ML TS XAI/NLP/NLP 2/Lab01(tokenizer)/training_tokenizer.txt +0 -6
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/exp0.ipynb +0 -274
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/lab2.ipynb +0 -905
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/test.txt +0 -1
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/tokenizing.ipynb +0 -272
- noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/collocation.ipynb +0 -332
- noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/lab3.ipynb +0 -549
- noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/nlp.txt +0 -1
- noshot/data/ML TS XAI/NLP/NLP 2/Lab04(collocation)/Lab4-NLP-Exp-2.ipynb +0 -817
- noshot/data/ML TS XAI/NLP/NLP 2/Lab04(collocation)/collocation.ipynb +0 -332
- noshot/data/ML TS XAI/NLP/NLP 2/Lab05(WSD)/NLP-Lab-5-Exp3.ipynb +0 -231
- noshot/data/ML TS XAI/NLP/NLP 2/Lab05(WSD)/word-sense-disambiguation.ipynb +0 -507
- noshot/data/ML TS XAI/NLP/NLP 2/Lab06(additional-exercise)/lab6.ipynb +0 -134
- noshot/data/ML TS XAI/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP Exp 4.ipynb +0 -255
- noshot/data/ML TS XAI/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP_Exp_5.ipynb +0 -159
- noshot/data/ML TS XAI/NLP/NLP 2/Lab08(PCFG)/PCFG.ipynb +0 -282
- noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/Lab 9 - MLP classifier.ipynb +0 -670
- noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/MLP-alternative-code.ipynb +0 -613
- noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/hindle-rooth-algorithm.ipynb +0 -74
- noshot/data/ML TS XAI/NLP/NLP 2/Lab10(LSTM)/Lab_10_Text_generator_using_LSTM.ipynb +0 -480
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Machine-translation.ipynb +0 -445
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Viterbi-PCFG.ipynb +0 -105
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/corpora_tools.py +0 -87
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/data_utils.py +0 -11
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/train_translator.py +0 -83
- noshot/data/ML TS XAI/NLP/NLP 2/Lab12(Information-Extraction)/Information_Extraction.ipynb +0 -201
- noshot/data/ML TS XAI/NLP/NLP 3/Backtrack-without-Verbitri.ipynb +0 -185
- noshot/data/ML TS XAI/NLP/NLP 3/Backward-Procedure.ipynb +0 -597
- noshot/data/ML TS XAI/NLP/NLP 3/Bag_of.ipynb +0 -1422
- noshot/data/ML TS XAI/NLP/NLP 3/CYK-algorithm.ipynb +0 -1067
- noshot/data/ML TS XAI/NLP/NLP 3/Forward-Procedure.ipynb +0 -477
- noshot/data/ML TS XAI/NLP/NLP 3/LSTM.ipynb +0 -1290
- noshot/data/ML TS XAI/NLP/NLP 3/Lab 10 - Text generator using LSTM.ipynb +0 -1461
- noshot/data/ML TS XAI/NLP/NLP 3/Lab 11 NMT.ipynb +0 -2307
- noshot/data/ML TS XAI/NLP/NLP 3/NLP-LAB-4.ipynb +0 -216
- noshot/data/ML TS XAI/NLP/NLP 3/NLP-LAB-5.ipynb +0 -216
- noshot/data/ML TS XAI/NLP/NLP 3/abc.txt +0 -6
- noshot/data/ML TS XAI/NLP/NLP 3/ex-1-nltk.ipynb +0 -711
- noshot/data/ML TS XAI/NLP/NLP 3/ex-2-nlp.ipynb +0 -267
- noshot/data/ML TS XAI/NLP/NLP 3/exp8&9.ipynb +0 -305
- noshot/data/ML TS XAI/NLP/NLP 3/hind.ipynb +0 -287
- noshot/data/ML TS XAI/NLP/NLP 3/lab66.ipynb +0 -752
- noshot/data/ML TS XAI/NLP/NLP 3/leb_3.ipynb +0 -612
- noshot/data/ML TS XAI/NLP/NLP 3/naive_bayes_classifier.pkl +0 -0
- noshot/data/ML TS XAI/NLP/NLP 3/nlp_leb_1.ipynb +0 -3008
- noshot/data/ML TS XAI/NLP/NLP 3/nlp_leb_2.ipynb +0 -3095
- noshot/data/ML TS XAI/NLP/NLP 3/nlplab-9.ipynb +0 -295
- noshot/data/ML TS XAI/NLP/NLP 3/nltk-ex-4.ipynb +0 -506
- noshot/data/ML TS XAI/NLP/NLP 3/text1.txt +0 -48
- noshot/data/ML TS XAI/NLP/NLP 3/text2.txt +0 -8
- noshot/data/ML TS XAI/NLP/NLP 3/text3.txt +0 -48
- noshot/data/ML TS XAI/NLP/NLP 3/translation-rnn.ipynb +0 -812
- noshot/data/ML TS XAI/NLP/NLP 3/word2vector.ipynb +0 -173
- noshot/data/ML TS XAI/NLP/NLP 4/Backward Procedure Algorithm.ipynb +0 -179
- noshot/data/ML TS XAI/NLP/NLP 4/Chi Square Collocation.ipynb +0 -208
- noshot/data/ML TS XAI/NLP/NLP 4/Collocation (T test).ipynb +0 -188
- noshot/data/ML TS XAI/NLP/NLP 4/Experiment 1.ipynb +0 -437
- noshot/data/ML TS XAI/NLP/NLP 4/Forward Procedure Algorithm.ipynb +0 -132
- noshot/data/ML TS XAI/NLP/NLP 4/Hindle Rooth.ipynb +0 -414
- noshot/data/ML TS XAI/NLP/NLP 4/MachineTranslation.ipynb +0 -368
- noshot/data/ML TS XAI/NLP/NLP 4/Multi Layer Perceptron using MLPClassifier.ipynb +0 -86
- noshot/data/ML TS XAI/NLP/NLP 4/Multi Layer Perceptron using Tensorflow.ipynb +0 -112
- noshot/data/ML TS XAI/NLP/NLP 4/PCFG Inside Probability.ipynb +0 -451
- noshot/data/ML TS XAI/NLP/NLP 4/Text Generation using LSTM.ipynb +0 -297
- noshot/data/ML TS XAI/NLP/NLP 4/Viterbi.ipynb +0 -310
- noshot/data/ML TS XAI/NLP/NLP 4/Word Sense Disambiguation.ipynb +0 -335
- noshot/data/ML TS XAI/NLP/NLP 5/10.Text Generation using LSTM.ipynb +0 -316
- noshot/data/ML TS XAI/NLP/NLP 5/11.Machine Translation.ipynb +0 -868
- noshot/data/ML TS XAI/NLP/NLP 5/2.T and Chi2 Test.ipynb +0 -204
- noshot/data/ML TS XAI/NLP/NLP 5/3.Word Sense Diambiguation.ipynb +0 -234
- noshot/data/ML TS XAI/NLP/NLP 5/4.Hinddle and Rooth.ipynb +0 -128
- noshot/data/ML TS XAI/NLP/NLP 5/5.Forward and Backward.ipynb +0 -149
- noshot/data/ML TS XAI/NLP/NLP 5/6.Viterbi.ipynb +0 -111
- noshot/data/ML TS XAI/NLP/NLP 5/7.PCFG Parse Tree.ipynb +0 -134
- noshot/data/ML TS XAI/NLP/NLP 5/7.PCFG using cyk.ipynb +0 -101
- noshot/data/ML TS XAI/NLP/NLP 5/8.Bag of words and TF-IDF.ipynb +0 -310
- noshot/data/ML TS XAI/NLP/NLP 5/9.Word2Vector.ipynb +0 -78
- noshot/data/ML TS XAI/NLP/NLP 5/NLP ALL In One.ipynb +0 -2619
- noshot/data/ML TS XAI/NLP/NLP 5/sample1.txt +0 -15
- noshot/data/ML TS XAI/NLP/NLP 5/sample2.txt +0 -4
- noshot/data/ML TS XAI/NLP/NLP 5/word2vec_model.bin +0 -0
- noshot/data/ML TS XAI/NLP/NLP 6/1. Tokenize, Tagging, NER, Parse Tree.ipynb +0 -312
- noshot/data/ML TS XAI/NLP/NLP 6/2. T Test and Chi2 Test.ipynb +0 -185
- noshot/data/ML TS XAI/NLP/NLP 6/3. Naive Bayes WSD.ipynb +0 -199
- noshot/data/ML TS XAI/NLP/NLP 6/4. Hinddle and Rooth.ipynb +0 -151
- noshot/data/ML TS XAI/NLP/NLP 6/5 and 6 FWD, BWD, Viterbi.ipynb +0 -164
- noshot/data/ML TS XAI/NLP/NLP 6/7. PCFG using CYK.ipynb +0 -383
- noshot/data/ML TS XAI/NLP/NLP 6/8. BOW and TF-IDF.ipynb +0 -252
- noshot/data/ML TS XAI/Ubuntu CN Lab.iso +0 -0
- noshot-0.1.7.dist-info/RECORD +0 -216
- {noshot-0.1.7.dist-info → noshot-0.1.8.dist-info}/LICENSE.txt +0 -0
- {noshot-0.1.7.dist-info → noshot-0.1.8.dist-info}/WHEEL +0 -0
- {noshot-0.1.7.dist-info → noshot-0.1.8.dist-info}/top_level.txt +0 -0
@@ -1,173 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "922063be-4bfd-4f18-b051-fff55cb49b29",
|
7
|
-
"metadata": {},
|
8
|
-
"outputs": [],
|
9
|
-
"source": [
|
10
|
-
"#preprocessed_text = \"\""
|
11
|
-
]
|
12
|
-
},
|
13
|
-
{
|
14
|
-
"cell_type": "code",
|
15
|
-
"execution_count": null,
|
16
|
-
"id": "4550cf0a-3517-455e-b386-717e4e030f49",
|
17
|
-
"metadata": {},
|
18
|
-
"outputs": [],
|
19
|
-
"source": [
|
20
|
-
"from sklearn.feature_extraction.text import TfidfVectorizer\n",
|
21
|
-
"tfidf_vectorizer=TfidfVectorizer()\n",
|
22
|
-
"X_tfidf=tfidf_vectorizer.fit_transform([preprocessed_text])\n",
|
23
|
-
"tfidf_vocabulary=tfidf_vectorizer.get_feature_names_out()\n",
|
24
|
-
"tfidf_array=X_tfidf.toarray()\n",
|
25
|
-
"print(\"TF-IDF Vocabulary:\",tfidf_vocabulary)\n",
|
26
|
-
"print(\"\\nTF-IDF Array:\",tfidf_array)"
|
27
|
-
]
|
28
|
-
},
|
29
|
-
{
|
30
|
-
"cell_type": "code",
|
31
|
-
"execution_count": null,
|
32
|
-
"id": "16a77ab0-21d3-424a-9d11-3b7fc5005acc",
|
33
|
-
"metadata": {},
|
34
|
-
"outputs": [],
|
35
|
-
"source": [
|
36
|
-
"import re\n",
|
37
|
-
"import numpy as np\n",
|
38
|
-
"import pandas as pd\n",
|
39
|
-
"import seaborn as sns\n",
|
40
|
-
"import matplotlib.pyplot as plt\n",
|
41
|
-
"from gensim.models import Word2Vec\n",
|
42
|
-
"from nltk.tokenize import word_tokenize\n",
|
43
|
-
"\n",
|
44
|
-
"# Load the dataset\n",
|
45
|
-
"file_path = 'text3.txt'\n",
|
46
|
-
"with open(file_path, 'r', encoding='utf-8') as file:\n",
|
47
|
-
" text = file.read()\n",
|
48
|
-
"\n",
|
49
|
-
"# Preprocessing: convert to lowercase, remove special characters, and tokenize\n",
|
50
|
-
"def preprocess(text):\n",
|
51
|
-
" text = text.lower()\n",
|
52
|
-
" text = re.sub(r'[^a-zA-Z\\s]', '', text) # Remove special characters and numbers\n",
|
53
|
-
" tokens = word_tokenize(text) # Tokenize the text\n",
|
54
|
-
" return tokens\n",
|
55
|
-
"\n",
|
56
|
-
"# Tokenize and preprocess the dataset\n",
|
57
|
-
"tokens = preprocess(text)\n",
|
58
|
-
"\n",
|
59
|
-
"# Train Word2Vec model\n",
|
60
|
-
"model = Word2Vec(sentences=[tokens], vector_size=100, window=5, min_count=1, sg=0) # sg=0 for CBOW\n",
|
61
|
-
"\n",
|
62
|
-
"# Get the list of all unique words in the vocabulary\n",
|
63
|
-
"vocab = list(model.wv.index_to_key)\n",
|
64
|
-
"\n",
|
65
|
-
"# Initialize a matrix to store similarity scores\n",
|
66
|
-
"similarity_matrix = np.zeros((len(vocab), len(vocab)))\n",
|
67
|
-
"\n",
|
68
|
-
"# Compute pairwise similarity for all words in the vocabulary\n",
|
69
|
-
"for i, word1 in enumerate(vocab):\n",
|
70
|
-
" for j, word2 in enumerate(vocab):\n",
|
71
|
-
" similarity_matrix[i, j] = model.wv.similarity(word1, word2)\n",
|
72
|
-
"\n",
|
73
|
-
"# Convert similarity matrix into a pandas DataFrame for easy visualization\n",
|
74
|
-
"similarity_df = pd.DataFrame(similarity_matrix, index=vocab, columns=vocab)\n",
|
75
|
-
"\n",
|
76
|
-
"# Display the first few rows of the similarity matrix\n",
|
77
|
-
"print(similarity_df.head())\n",
|
78
|
-
"\n",
|
79
|
-
"# Plot heatmap of the similarity matrix\n",
|
80
|
-
"plt.figure(figsize=(20, 40))\n",
|
81
|
-
"sns.heatmap(similarity_df, cmap=\"coolwarm\", annot=False, xticklabels=True, yticklabels=True)\n",
|
82
|
-
"plt.title(\"Semantic Similarity Between Words\")\n",
|
83
|
-
"plt.show()\n"
|
84
|
-
]
|
85
|
-
},
|
86
|
-
{
|
87
|
-
"cell_type": "code",
|
88
|
-
"execution_count": null,
|
89
|
-
"id": "a6913d2e-3734-41b4-9285-6ac1afa2b1ee",
|
90
|
-
"metadata": {},
|
91
|
-
"outputs": [],
|
92
|
-
"source": [
|
93
|
-
"import re\n",
|
94
|
-
"import numpy as np\n",
|
95
|
-
"import pandas as pd\n",
|
96
|
-
"import seaborn as sns\n",
|
97
|
-
"import matplotlib.pyplot as plt\n",
|
98
|
-
"from gensim.models import Word2Vec\n",
|
99
|
-
"from nltk.tokenize import word_tokenize\n",
|
100
|
-
"\n",
|
101
|
-
"# Load the dataset\n",
|
102
|
-
"file_path = 'story.txt'\n",
|
103
|
-
"with open(file_path, 'r', encoding='utf-8') as file:\n",
|
104
|
-
" text = file.read()\n",
|
105
|
-
"\n",
|
106
|
-
"# Preprocessing: convert to lowercase, remove special characters, and tokenize\n",
|
107
|
-
"def preprocess(text):\n",
|
108
|
-
" text = text.lower()\n",
|
109
|
-
" text = re.sub(r'[^a-zA-Z\\s]', '', text) # Remove special characters and numbers\n",
|
110
|
-
" tokens = word_tokenize(text) # Tokenize the text\n",
|
111
|
-
" return tokens\n",
|
112
|
-
"\n",
|
113
|
-
"# Tokenize and preprocess the dataset\n",
|
114
|
-
"tokens = preprocess(text)\n",
|
115
|
-
"\n",
|
116
|
-
"# Train Word2Vec model\n",
|
117
|
-
"model = Word2Vec(sentences=[tokens], vector_size=100, window=5, min_count=1, sg=0) # sg=0 for CBOW\n",
|
118
|
-
"\n",
|
119
|
-
"# Get the list of all unique words in the vocabulary\n",
|
120
|
-
"vocab = list(model.wv.index_to_key)\n",
|
121
|
-
"\n",
|
122
|
-
"# Initialize a matrix to store similarity scores\n",
|
123
|
-
"similarity_matrix = np.zeros((len(vocab), len(vocab)))\n",
|
124
|
-
"\n",
|
125
|
-
"# Compute pairwise similarity for all words in the vocabulary\n",
|
126
|
-
"for i, word1 in enumerate(vocab):\n",
|
127
|
-
" for j, word2 in enumerate(vocab):\n",
|
128
|
-
" similarity_matrix[i, j] = model.wv.similarity(word1, word2)\n",
|
129
|
-
"\n",
|
130
|
-
"# Convert similarity matrix into a pandas DataFrame for easy visualization\n",
|
131
|
-
"similarity_df = pd.DataFrame(similarity_matrix, index=vocab, columns=vocab)\n",
|
132
|
-
"\n",
|
133
|
-
"# Display the first few rows of the similarity matrix\n",
|
134
|
-
"print(similarity_df.head())\n",
|
135
|
-
"\n",
|
136
|
-
"# Plot heatmap of the similarity matrix\n",
|
137
|
-
"plt.figure(figsize=(45,40))\n",
|
138
|
-
"sns.heatmap(similarity_df, cmap=\"coolwarm\", annot=False, xticklabels=True, yticklabels=True)\n",
|
139
|
-
"plt.title(\"Semantic Similarity Between Words\")\n",
|
140
|
-
"plt.show()\n"
|
141
|
-
]
|
142
|
-
},
|
143
|
-
{
|
144
|
-
"cell_type": "code",
|
145
|
-
"execution_count": null,
|
146
|
-
"id": "b5676923-468a-4b02-8f57-36633330ccb8",
|
147
|
-
"metadata": {},
|
148
|
-
"outputs": [],
|
149
|
-
"source": []
|
150
|
-
}
|
151
|
-
],
|
152
|
-
"metadata": {
|
153
|
-
"kernelspec": {
|
154
|
-
"display_name": "Python 3 (ipykernel)",
|
155
|
-
"language": "python",
|
156
|
-
"name": "python3"
|
157
|
-
},
|
158
|
-
"language_info": {
|
159
|
-
"codemirror_mode": {
|
160
|
-
"name": "ipython",
|
161
|
-
"version": 3
|
162
|
-
},
|
163
|
-
"file_extension": ".py",
|
164
|
-
"mimetype": "text/x-python",
|
165
|
-
"name": "python",
|
166
|
-
"nbconvert_exporter": "python",
|
167
|
-
"pygments_lexer": "ipython3",
|
168
|
-
"version": "3.12.4"
|
169
|
-
}
|
170
|
-
},
|
171
|
-
"nbformat": 4,
|
172
|
-
"nbformat_minor": 5
|
173
|
-
}
|
@@ -1,179 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"nbformat": 4,
|
3
|
-
"nbformat_minor": 0,
|
4
|
-
"metadata": {
|
5
|
-
"colab": {
|
6
|
-
"provenance": []
|
7
|
-
},
|
8
|
-
"kernelspec": {
|
9
|
-
"name": "python3",
|
10
|
-
"display_name": "Python 3"
|
11
|
-
},
|
12
|
-
"language_info": {
|
13
|
-
"name": "python"
|
14
|
-
}
|
15
|
-
},
|
16
|
-
"cells": [
|
17
|
-
{
|
18
|
-
"cell_type": "code",
|
19
|
-
"execution_count": null,
|
20
|
-
"metadata": {
|
21
|
-
"colab": {
|
22
|
-
"base_uri": "https://localhost:8080/"
|
23
|
-
},
|
24
|
-
"id": "gVbwDSwfR3CY",
|
25
|
-
"outputId": "84d47a98-d4d4-4b51-a679-65654164125c"
|
26
|
-
},
|
27
|
-
"outputs": [
|
28
|
-
{
|
29
|
-
"output_type": "stream",
|
30
|
-
"name": "stderr",
|
31
|
-
"text": [
|
32
|
-
"[nltk_data] Downloading package stopwords to /root/nltk_data...\n",
|
33
|
-
"[nltk_data] Package stopwords is already up-to-date!\n",
|
34
|
-
"[nltk_data] Downloading package punkt to /root/nltk_data...\n",
|
35
|
-
"[nltk_data] Package punkt is already up-to-date!\n",
|
36
|
-
"[nltk_data] Downloading package averaged_perceptron_tagger to\n",
|
37
|
-
"[nltk_data] /root/nltk_data...\n",
|
38
|
-
"[nltk_data] Package averaged_perceptron_tagger is already up-to-\n",
|
39
|
-
"[nltk_data] date!\n"
|
40
|
-
]
|
41
|
-
},
|
42
|
-
{
|
43
|
-
"output_type": "execute_result",
|
44
|
-
"data": {
|
45
|
-
"text/plain": [
|
46
|
-
"True"
|
47
|
-
]
|
48
|
-
},
|
49
|
-
"metadata": {},
|
50
|
-
"execution_count": 43
|
51
|
-
}
|
52
|
-
],
|
53
|
-
"source": [
|
54
|
-
"import nltk\n",
|
55
|
-
"nltk.download('stopwords')\n",
|
56
|
-
"nltk.download('punkt')\n",
|
57
|
-
"from nltk.corpus import stopwords\n",
|
58
|
-
"from nltk import pos_tag,word_tokenize\n",
|
59
|
-
"import pandas as pd\n",
|
60
|
-
"import math\n",
|
61
|
-
"nltk.download('averaged_perceptron_tagger')"
|
62
|
-
]
|
63
|
-
},
|
64
|
-
{
|
65
|
-
"cell_type": "code",
|
66
|
-
"source": [
|
67
|
-
"def bpa(pi,state,transition,words):\n",
|
68
|
-
" words=list(reversed(words))\n",
|
69
|
-
" for i in range(len(state)):\n",
|
70
|
-
" beta.update({i:{len(words)+1:1}})\n",
|
71
|
-
" #ok=-1\n",
|
72
|
-
"\n",
|
73
|
-
" for t in reversed(range(1,len(words)+1)):\n",
|
74
|
-
" #temp=list()\n",
|
75
|
-
" #ok=ok+1\n",
|
76
|
-
" for i in range(0,len(state)):\n",
|
77
|
-
" val=0\n",
|
78
|
-
" for j in range(0,len(state)):\n",
|
79
|
-
" ok=words[(len(words)+1)-(t+1)]\n",
|
80
|
-
" val=val+(state[i][j]*transition[i][ok]*beta[j][t+1])\n",
|
81
|
-
" print(\"k : \",ok,\"i: \",i,\"j: \",j,\"beta({},{}): \".format(j,t+1),beta[j][t+1],\"ok value: \",ok)\n",
|
82
|
-
" print(\"\\t\",state[i][j],\"*\",transition[i][ok],\"*\",beta[i][t+1])\n",
|
83
|
-
" #temp.append(val)\n",
|
84
|
-
" beta[i][t]=val\n",
|
85
|
-
" print(\"\\t beta({}{}): \".format(i,t),val)\n",
|
86
|
-
" val=0\n",
|
87
|
-
" #print(\"updated val: \",val,\"updated temp: \",temp,\"\\n\")\n",
|
88
|
-
" fsum=0\n",
|
89
|
-
" for i in range(len(state)):\n",
|
90
|
-
" fsum=fsum+beta[i][1]\n",
|
91
|
-
" return fsum"
|
92
|
-
],
|
93
|
-
"metadata": {
|
94
|
-
"id": "xIZ1yukLSCL4"
|
95
|
-
},
|
96
|
-
"execution_count": null,
|
97
|
-
"outputs": []
|
98
|
-
},
|
99
|
-
{
|
100
|
-
"cell_type": "code",
|
101
|
-
"source": [
|
102
|
-
"state=[[0.7,0.3],[0.5,0.5]]\n",
|
103
|
-
"transition=[[0.6,0.1,0.3],[0.1,0.7,0.2]]\n",
|
104
|
-
"words=[2,1,0]\n",
|
105
|
-
"\n",
|
106
|
-
"ans=bpa(pi,state,transition,words)\n"
|
107
|
-
],
|
108
|
-
"metadata": {
|
109
|
-
"id": "rr4yPQHDSYYA",
|
110
|
-
"colab": {
|
111
|
-
"base_uri": "https://localhost:8080/"
|
112
|
-
},
|
113
|
-
"outputId": "c0fbbcc3-c7ff-4906-f082-f0152207832f"
|
114
|
-
},
|
115
|
-
"execution_count": null,
|
116
|
-
"outputs": [
|
117
|
-
{
|
118
|
-
"output_type": "stream",
|
119
|
-
"name": "stdout",
|
120
|
-
"text": [
|
121
|
-
"k : 0 i: 0 j: 0 beta(0,4): 1 ok value: 0\n",
|
122
|
-
"\t 0.7 * 0.6 * 1\n",
|
123
|
-
"k : 0 i: 0 j: 1 beta(1,4): 1 ok value: 0\n",
|
124
|
-
"\t 0.3 * 0.6 * 1\n",
|
125
|
-
"\t beta(03): 0.6\n",
|
126
|
-
"k : 0 i: 1 j: 0 beta(0,4): 1 ok value: 0\n",
|
127
|
-
"\t 0.5 * 0.1 * 1\n",
|
128
|
-
"k : 0 i: 1 j: 1 beta(1,4): 1 ok value: 0\n",
|
129
|
-
"\t 0.5 * 0.1 * 1\n",
|
130
|
-
"\t beta(13): 0.1\n",
|
131
|
-
"k : 1 i: 0 j: 0 beta(0,3): 0.6 ok value: 1\n",
|
132
|
-
"\t 0.7 * 0.1 * 0.6\n",
|
133
|
-
"k : 1 i: 0 j: 1 beta(1,3): 0.1 ok value: 1\n",
|
134
|
-
"\t 0.3 * 0.1 * 0.6\n",
|
135
|
-
"\t beta(02): 0.045\n",
|
136
|
-
"k : 1 i: 1 j: 0 beta(0,3): 0.6 ok value: 1\n",
|
137
|
-
"\t 0.5 * 0.7 * 0.1\n",
|
138
|
-
"k : 1 i: 1 j: 1 beta(1,3): 0.1 ok value: 1\n",
|
139
|
-
"\t 0.5 * 0.7 * 0.1\n",
|
140
|
-
"\t beta(12): 0.245\n",
|
141
|
-
"k : 2 i: 0 j: 0 beta(0,2): 0.045 ok value: 2\n",
|
142
|
-
"\t 0.7 * 0.3 * 0.045\n",
|
143
|
-
"k : 2 i: 0 j: 1 beta(1,2): 0.245 ok value: 2\n",
|
144
|
-
"\t 0.3 * 0.3 * 0.045\n",
|
145
|
-
"\t beta(01): 0.0315\n",
|
146
|
-
"k : 2 i: 1 j: 0 beta(0,2): 0.045 ok value: 2\n",
|
147
|
-
"\t 0.5 * 0.2 * 0.245\n",
|
148
|
-
"k : 2 i: 1 j: 1 beta(1,2): 0.245 ok value: 2\n",
|
149
|
-
"\t 0.5 * 0.2 * 0.245\n",
|
150
|
-
"\t beta(11): 0.029\n"
|
151
|
-
]
|
152
|
-
}
|
153
|
-
]
|
154
|
-
},
|
155
|
-
{
|
156
|
-
"cell_type": "code",
|
157
|
-
"source": [
|
158
|
-
"print(\"final probability for given words: \",ans)"
|
159
|
-
],
|
160
|
-
"metadata": {
|
161
|
-
"colab": {
|
162
|
-
"base_uri": "https://localhost:8080/"
|
163
|
-
},
|
164
|
-
"id": "9rmYcYrY3yHl",
|
165
|
-
"outputId": "9a6c3008-27ca-4a21-e20b-ae5397827149"
|
166
|
-
},
|
167
|
-
"execution_count": null,
|
168
|
-
"outputs": [
|
169
|
-
{
|
170
|
-
"output_type": "stream",
|
171
|
-
"name": "stdout",
|
172
|
-
"text": [
|
173
|
-
"final probability for given words: 0.0605\n"
|
174
|
-
]
|
175
|
-
}
|
176
|
-
]
|
177
|
-
}
|
178
|
-
]
|
179
|
-
}
|
@@ -1,208 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"nbformat": 4,
|
3
|
-
"nbformat_minor": 0,
|
4
|
-
"metadata": {
|
5
|
-
"colab": {
|
6
|
-
"provenance": []
|
7
|
-
},
|
8
|
-
"kernelspec": {
|
9
|
-
"name": "python3",
|
10
|
-
"display_name": "Python 3"
|
11
|
-
},
|
12
|
-
"language_info": {
|
13
|
-
"name": "python"
|
14
|
-
}
|
15
|
-
},
|
16
|
-
"cells": [
|
17
|
-
{
|
18
|
-
"cell_type": "code",
|
19
|
-
"source": [
|
20
|
-
"import nltk\n",
|
21
|
-
"nltk.download('stopwords')\n",
|
22
|
-
"nltk.download('punkt')"
|
23
|
-
],
|
24
|
-
"metadata": {
|
25
|
-
"colab": {
|
26
|
-
"base_uri": "https://localhost:8080/"
|
27
|
-
},
|
28
|
-
"id": "DLR4rnnIgiqo",
|
29
|
-
"outputId": "a27f8918-2355-4417-ef8c-908e8aa648a5"
|
30
|
-
},
|
31
|
-
"execution_count": null,
|
32
|
-
"outputs": [
|
33
|
-
{
|
34
|
-
"output_type": "stream",
|
35
|
-
"name": "stderr",
|
36
|
-
"text": [
|
37
|
-
"[nltk_data] Downloading package stopwords to /root/nltk_data...\n",
|
38
|
-
"[nltk_data] Package stopwords is already up-to-date!\n",
|
39
|
-
"[nltk_data] Downloading package punkt to /root/nltk_data...\n",
|
40
|
-
"[nltk_data] Package punkt is already up-to-date!\n"
|
41
|
-
]
|
42
|
-
},
|
43
|
-
{
|
44
|
-
"output_type": "execute_result",
|
45
|
-
"data": {
|
46
|
-
"text/plain": [
|
47
|
-
"True"
|
48
|
-
]
|
49
|
-
},
|
50
|
-
"metadata": {},
|
51
|
-
"execution_count": 2
|
52
|
-
}
|
53
|
-
]
|
54
|
-
},
|
55
|
-
{
|
56
|
-
"cell_type": "code",
|
57
|
-
"source": [
|
58
|
-
"from nltk.tokenize import word_tokenize\n",
|
59
|
-
"\n",
|
60
|
-
"f=open(\"/content/sample.txt\",\"r\")\n",
|
61
|
-
"text=f.read()\n",
|
62
|
-
"text=text.lower()\n",
|
63
|
-
"word_tokens = word_tokenize(text)\n",
|
64
|
-
"print(word_tokens)\n"
|
65
|
-
],
|
66
|
-
"metadata": {
|
67
|
-
"colab": {
|
68
|
-
"base_uri": "https://localhost:8080/"
|
69
|
-
},
|
70
|
-
"id": "t8RO6ZQEgeXB",
|
71
|
-
"outputId": "01e1b0db-e84f-4f39-8735-393f526f47a3"
|
72
|
-
},
|
73
|
-
"execution_count": null,
|
74
|
-
"outputs": [
|
75
|
-
{
|
76
|
-
"output_type": "stream",
|
77
|
-
"name": "stdout",
|
78
|
-
"text": [
|
79
|
-
"['sastra', 'university', 'is', 'good', 'sastra', 'university', 'is', 'in', 'thanjavur', 'trichy', 'is', 'relatively', 'close', 'from', 'sastra', 'university', 'various', 'other', 'university', 'are', 'also', 'present', 'in', 'tamilnadu', 'sastra', 'offers', 'a', 'lot', 'of', 'courses', 'sastra', 'is', 'an', 'acronym', 'nit', 'is', 'also', 'a', 'college', 'near', 'trichy', ',', 'but', 'not', 'a', 'university']\n"
|
80
|
-
]
|
81
|
-
}
|
82
|
-
]
|
83
|
-
},
|
84
|
-
{
|
85
|
-
"cell_type": "code",
|
86
|
-
"execution_count": null,
|
87
|
-
"metadata": {
|
88
|
-
"id": "Qt6BAzwcf5PK"
|
89
|
-
},
|
90
|
-
"outputs": [],
|
91
|
-
"source": [
|
92
|
-
"def collocation(w1,w2):\n",
|
93
|
-
" nl=list()\n",
|
94
|
-
" N=len(word_tokens)\n",
|
95
|
-
" pw1=word_tokens.count(w1)\n",
|
96
|
-
" pw2=word_tokens.count(w2)\n",
|
97
|
-
"\n",
|
98
|
-
" Ew1w2= ((pw1*pw2)/N) \n",
|
99
|
-
" Ew1nw2= ((pw1*(N-pw2))/N)\n",
|
100
|
-
" Enw1w2= (((N-pw1)*pw2)/N)\n",
|
101
|
-
" Enw1nw2= (((N-pw1)*(N-pw2)/N))\n",
|
102
|
-
"\n",
|
103
|
-
" j=0\n",
|
104
|
-
" for i in range(len(word_tokens)-1):\n",
|
105
|
-
" if(word_tokens[i]==w1 and word_tokens[i+1]==w2):\n",
|
106
|
-
" j=j+1\n",
|
107
|
-
" pw12=j\n",
|
108
|
-
" \n",
|
109
|
-
" Ow1w2=pw12\n",
|
110
|
-
" Ow1nw2=pw1-pw12\n",
|
111
|
-
" Onw1w2=pw2-pw12\n",
|
112
|
-
" Onw1nw2=N-pw12\n",
|
113
|
-
"\n",
|
114
|
-
" X= (((Ow1w2-Ew1w2)**2)/Ew1w2) + (((Ow1nw2-Ew1nw2)**2)/Ew1nw2) + (((Onw1w2-Enw1w2)**2)/Enw1w2) + (((Onw1nw2-Enw1nw2)**2)/Enw1nw2)\n",
|
115
|
-
" \n",
|
116
|
-
" if(float(X) > float(cv)):\n",
|
117
|
-
" #print(\"hypothesis rejected thus the given words( \",w1,\" \",w2,\" ) form a collocation\")\n",
|
118
|
-
" #print(X)\n",
|
119
|
-
" nl.append(w1)\n",
|
120
|
-
" nl.append(w2)\n",
|
121
|
-
" nl.append(X)\n",
|
122
|
-
" return nl"
|
123
|
-
]
|
124
|
-
},
|
125
|
-
{
|
126
|
-
"cell_type": "code",
|
127
|
-
"source": [
|
128
|
-
"cv=int(input(\"enter the critical value : \"))"
|
129
|
-
],
|
130
|
-
"metadata": {
|
131
|
-
"colab": {
|
132
|
-
"base_uri": "https://localhost:8080/"
|
133
|
-
},
|
134
|
-
"id": "C-B4kq2of7pS",
|
135
|
-
"outputId": "d61ad4c3-7224-4325-8079-de7c337c8e37"
|
136
|
-
},
|
137
|
-
"execution_count": null,
|
138
|
-
"outputs": [
|
139
|
-
{
|
140
|
-
"name": "stdout",
|
141
|
-
"output_type": "stream",
|
142
|
-
"text": [
|
143
|
-
"enter the critical value : 10\n"
|
144
|
-
]
|
145
|
-
}
|
146
|
-
]
|
147
|
-
},
|
148
|
-
{
|
149
|
-
"cell_type": "code",
|
150
|
-
"source": [
|
151
|
-
"fcol=list()\n",
|
152
|
-
"for i in range(len(word_tokens)-1):\n",
|
153
|
-
" w1=word_tokens[i]\n",
|
154
|
-
" w2=word_tokens[i+1]\n",
|
155
|
-
" fcol.append(collocation(w1,w2))\n",
|
156
|
-
"for i in fcol:\n",
|
157
|
-
" if(len(i) > 1):\n",
|
158
|
-
" if(fcol.count(i)>1):\n",
|
159
|
-
" fcol.remove(i)\n",
|
160
|
-
" else:\n",
|
161
|
-
" fcol.remove(i)\n",
|
162
|
-
" \n",
|
163
|
-
"for i in fcol:\n",
|
164
|
-
" if(len(i) > 1):\n",
|
165
|
-
" print(i)"
|
166
|
-
],
|
167
|
-
"metadata": {
|
168
|
-
"colab": {
|
169
|
-
"base_uri": "https://localhost:8080/"
|
170
|
-
},
|
171
|
-
"id": "lBTZtPcaf-rZ",
|
172
|
-
"outputId": "38a7d8d6-d49c-43b9-9cdd-c0d9b506d0d9"
|
173
|
-
},
|
174
|
-
"execution_count": null,
|
175
|
-
"outputs": [
|
176
|
-
{
|
177
|
-
"output_type": "stream",
|
178
|
-
"name": "stdout",
|
179
|
-
"text": [
|
180
|
-
"['in', 'thanjavur', 22.556565656565656]\n",
|
181
|
-
"['thanjavur', 'trichy', 22.556565656565656]\n",
|
182
|
-
"['relatively', 'close', 46.0]\n",
|
183
|
-
"['close', 'from', 46.0]\n",
|
184
|
-
"['sastra', 'university', 14.952385484830458]\n",
|
185
|
-
"['various', 'other', 46.0]\n",
|
186
|
-
"['are', 'also', 22.556565656565656]\n",
|
187
|
-
"['also', 'present', 22.556565656565656]\n",
|
188
|
-
"['present', 'in', 22.556565656565656]\n",
|
189
|
-
"['in', 'tamilnadu', 22.556565656565656]\n",
|
190
|
-
"['offers', 'a', 14.835831180017228]\n",
|
191
|
-
"['a', 'lot', 14.835831180017228]\n",
|
192
|
-
"['lot', 'of', 46.0]\n",
|
193
|
-
"['of', 'courses', 46.0]\n",
|
194
|
-
"['an', 'acronym', 46.0]\n",
|
195
|
-
"['acronym', 'nit', 46.0]\n",
|
196
|
-
"['a', 'college', 14.835831180017228]\n",
|
197
|
-
"['college', 'near', 46.0]\n",
|
198
|
-
"['near', 'trichy', 22.556565656565656]\n",
|
199
|
-
"['trichy', ',', 22.556565656565656]\n",
|
200
|
-
"[',', 'but', 46.0]\n",
|
201
|
-
"['but', 'not', 46.0]\n",
|
202
|
-
"['not', 'a', 14.835831180017228]\n"
|
203
|
-
]
|
204
|
-
}
|
205
|
-
]
|
206
|
-
}
|
207
|
-
]
|
208
|
-
}
|