Correlation between two strings

Viewed 696

I am trying to find if there is a relationship between two columns in a dataset. I am using fuzzywuzzy and the partial_ratio to identify if there is a "match" between a keyword column, and an "issue title" column.

Key keyword column is full of meta data tags for articles with a space separator. My code works fine, but i am wondering if there is a better way to do what i am trying to do?

CODE:

import pandas as pd
import numpy as np
from fuzzywuzzy import fuzz   

df.dropna(subset=['Keywords', 'Issue'], inplace=True)
df['Acc'] = df.apply(lambda rows: fuzz.partial_ratio(rows['Keywords'],rows['Issue']),axis = 1)
df[['Issue','Keywords','Len','Acc']].head(1)

This returns the following dataframe:

| Issue | Keywords                                                                                            | Len | Acc |
|-------|-----------------------------------------------------------------------------------------------------|-----|-----|
| 0     | General information regarding proof of employm... Verification Employment calls Work Number VOE ... | 19  | 57  |

So, there are 19 keywords in the Len column, and 57 on a match score. Cool, so, is there any other way to identify if the correct "tags" are being used and are 100% related to the "issue" column?

0 Answers
Related