|
@@ -16,6 +16,24 @@ def model_inference(text):
|
|
|
return response
|
|
|
|
|
|
|
|
|
+def is_a_name(name):
|
|
|
+ '''
|
|
|
+ function that decide whether it is a person name or not
|
|
|
+ :param -> a string usually reviewer name:
|
|
|
+ :return -> a boolean True/False:
|
|
|
+ '''
|
|
|
+
|
|
|
+ response = model_inference(name.title())
|
|
|
+ entities = response.get('entities')
|
|
|
+ if not entities:
|
|
|
+ return False
|
|
|
+ entity = entities[0]
|
|
|
+ if entity.get('entity') == 'PERSON':
|
|
|
+ return True
|
|
|
+ else:
|
|
|
+ return False
|
|
|
+
|
|
|
+
|
|
|
def analyze_inference(response):
|
|
|
'''
|
|
|
response has four property
|