Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.2 kB
2
Indexable
Never
I am getting the output as 

USer recommendation List from event_prediction_tfidf function :  ['application hcm expenses claims expenses claims application function error submission form bb rupamdhara', 'application hcm expenses claims expenses claims application function error submission form bb rupamdhara', 'application hcm expenses claims expenses claims application function error error claiming anishanandi', 'application hcm expenses claims expenses claims application function error error message submitting editing claims anishanandi', 'application hcm expenses claims expenses claims application function error bfslhradmin unable login anishanandi']
TFIDF Prediction Done ['application hcm expenses claims expenses claims application function error submission form bb rupamdhara', 'application hcm expenses claims expenses claims application function error submission form bb rupamdhara', 'application hcm expenses claims expenses claims application function error error claiming anishanandi', 'application hcm expenses claims expenses claims application function error error message submitting editing claims anishanandi', 'application hcm expenses claims expenses claims application function error bfslhradmin unable login anishanandi']

User Recommendations: ['rupamdhara', 'rupamdhara', 'anishanandi', 'anishanandi', 'anishanandi']

on running above code, now if u carefully see rupamdhara anishanandi , these are concatenated first name and last name, which now needs to be separated by space.

Now the thing is above User recommendation list there is a output as application hcm expenses claims expenses claims application function error submission form bb rupamdhara  
wherein we want the last word so we used this in event prediction

user_recommendation_persons = [res.split(' ')[-1] for res in user_recommendation_list]

And in feature_engineering.py, we had used this-

def data_pre_processing(data):
    
    ## Convert all text columns to lowercase
    text_columns=[col for col in data.columns if data[col].dtype=='O']
    data[text_columns]=data[text_columns].apply(lambda x : x.str.lower())
    
    ## Modifying ticket_severity
    data['ticket_severity']=data['ticket_severity'].str.split('-').str[1]
      
    ## Concatenating first name and last name in person_who_resolved
    data['person_who_resolved'] = data['person_who_resolved'].apply(concatenate_names)
    
    ## Making a new column
    data['concatenated_string']=data['ticket_category'] + ' ' +data['ticket_type'] + ' ' +data['ticket_item'] + ' ' + data['ticket_summary'] + ' ' +data['ticket_desc'] + ' ' + data['person_who_resolved']
    
    data['concatenated_string'] = data['concatenated_string'].apply(preprocess_text)
    #print(data)
    return data

# Function to concatenate first name and last name with proper capitalization
def concatenate_names(name):
    parts = name.split()
    concatenated_name = ''.join(part.capitalize() for part in parts)
    return concatenated_name

In order to concatenate the person_who_resolved ,

Now there is a change in requirement to retain the original names as for eg Rupam Dhara as output, and also in some cases it might be 3 names like Fameer Rupam Dhara.

How to handle these cases.