-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
40 lines (36 loc) · 1.37 KB
/
app.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
''' Keyword Matched Sentences '''
# --------------------------------
# Date : 19-06-2020
# Project : Keyword Matched Sentences
# Category : NLP/NLTK sentence Scoring
# Company : weblineindia
# Department : AI/ML
# --------------------------------
import scoring
print("#-----------------------------------------------------------#")
print("#------------------------- TEXT SCORING --------------------#")
# Enter keyword and paragraph
print("#-----------------------------------------------------------#")
keyword = input("ENTER KEYWORDS : ")
print("#############################################################")
paragraph = input("ENTER PARAGRAPH : ")
print("#############################################################")
# Initialize the textscoring instance
scoreTextObj = scoring.scoreText()
# Paragraph passed will be split inot sentences,
# Each sentence will be split and it will be compared with keyword and a score is given.
# Top scored sentence will be displayed as results.
matchedSentences = scoreTextObj.sentenceMatch(keyword, paragraph)
print()
print("#-------------------------- RESULTS ------------------------#")
print("#-------------------BEST MATCHING SENTENCES-----------------#")
print()
# print the top scored sentences
# try:
count = 1
for text in matchedSentences:
print(' '+str(count)+' : '+text)
count += 1
print()
# except:
# print('something went wrong')