-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparseTweetsAndAdd2DB.py
More file actions
44 lines (38 loc) · 1.19 KB
/
Copy pathparseTweetsAndAdd2DB.py
File metadata and controls
44 lines (38 loc) · 1.19 KB
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
import location
import pudb
def parseTweet(text_org):
print('helo')
text = text_org.lower()
places = location.return_location_list(text)
each_loc = [place[0] for place in places]
resources = {
"oxygen": "Oxygen",
"o2": "Oxygen",
"ventilator": "Ventilator",
"bed": "Beds",
"icu": "Beds",
"remdes": "Remdesivir",
"plasma": "Plasma",
"consultation": "Doctor",
"ambulance": "Ambulance"
}
places_to_remove = []
resource_text = ""
for resource in resources:
if resource in each_loc:
places_to_remove.append(each_loc.index(resource))
if resource in text:
resource_text = resource_text+resources[resource]+" "
places_to_remove.sort(reverse=True)
for ptr in places_to_remove:
del places[ptr]
# print("\n\n\nText: "+str(text_org))
print("\nLocation: ",places)
print("\nResources: "+resource_text)
if "need" in text or "require" in text:
print("\nType: Need")
elif "availab" in text or len(resource_text) != 0:
print("\nType: Availability")
else:
print("\nType: Other")
parseTweet('I need oxygen in hyderabad')