-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.py
68 lines (53 loc) · 2.23 KB
/
Main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import ModelTrainer
import ModelTester
import DutchtoEnglish
import EnglishtoDutch
import Jaccard
import CosineSimilarity
import nltk
nltk.download('punkt')
while True:
try:
mode = int(input('\n\nPlease choose what you want to do: \n\t1: Train the Model\n\t2: Test sentence to translate\n\t3: Translate a Dutch document to English \n\t4: Translate an English document to Dutch \n\t5: Calculate Jaccard coefficient \n\t6: Calculate Cosine Similarity \n\t7:For exit\n'))
except ValueError:
print ("Not a number")
if mode == 1:
ModelTrainer.model_trainer()
elif mode == 2:
try:
translate_option = int(input('Select translation option: \n\t1: Dutch to English \n\t2: English to Dutch\n'))
except ValueError:
print ("Not a number")
if translate_option > 2 or translate_option < 1 :
print("Invalid Option")
exit()
sentence_to_translate = input("Plese provide sentence to translate: ")
translated_sentence = ModelTester.test(sentence_to_translate,translate_option)
print(translated_sentence)
elif mode == 3: #translate Dutch document to English
DutchtoEnglish.translate()
elif mode == 4: #translate English document to Dutch
EnglishtoDutch.translate()
elif mode == 5: #Calculate Jaccard Correlation Coefficient
try:
language = int(input('\n\nPlease choose the language of output and actual documents \n\t1: Dutch\n\t2:English\n'))
except ValueError:
print ("Not a number")
if language > 2 or language < 1 :
print("Invalid Option")
exit()
Jaccard.calcJaccardCoeff(language)
elif mode == 6: #Calculate Cosine Similarity
try:
language = int(input('\n\nPlease choose the language of output and actual documents \n\t1: Dutch\n\t2:English\n'))
except ValueError:
print ("Not a number")
if language > 2 or language < 1 :
print("Invalid Option")
exit()
CosineSimilarity.calcCosineSim(language)
elif mode == 7:
break
else:
print("invalid mode")
print("goodbye!")