0
$\begingroup$

Given a dataset that looks like the following:

-----------------------------------------------------------
|Category|Phrase         |Related 1       |Related 2  |...|
-----------------------------------------------------------
|Art     |Art exhibitions|                |           |   |
|Art     |Art galleries  |Art exhibitions |Art museum |   |
|Art     |Art museum     |Art galleries   |           |   |
|Sports  |Football       |Sports coaching |NFL        |   |
|Sports  |Basketball     |NBA             |           |   |
|Sports  |Sports coaching|                |           |   |
-----------------------------------------------------------

If I have an input phrase, how can I list possible related phrases inside the dataset? For example, I would relate "art exhibitions" to "art museum" and "art galleries". The dataset has some relationships filled out already (I am not sure if this counts as usable training data or if I have to transform it further) and I am looking to fill in the blanks, that is find relationships for some rows.

Eventually we would want to be able to support input phrases that don't exist yet in this dataset and establish relationships for them based on historical info, which is why I think I should be looking at machine learning.

What is the best algorithm/approach I can make use of for this problem?

$\endgroup$
3
  • $\begingroup$ Can you explain what the dataset looks like? Like what are the columns etc $\endgroup$ Mar 5 '20 at 17:56
  • $\begingroup$ @fractalnature I've updated with a small sample of what our current dataset looks like $\endgroup$ Mar 6 '20 at 5:50
  • $\begingroup$ What kinds of historical data do you have? You can also use a pre-trained model. $\endgroup$ Mar 7 '20 at 21:15
0
$\begingroup$

Given your example, if you want to group phrases based on terms, a simple approach would be to use grep to find rows that contain specific letter sequences (e.g. "art", "ball"). For example, say your table is a csv file (myfile.csv), where each line is a word or phrase (e.g. "Football", "Jazz music"). We can use a UNIX terminal to get all lines that contain "ball":

grep -n ball myfile.csv | cut -d: -f1 > myresults.txt

This would yield a file (myresults.txt) that containts the lines numbers of phrases that contain "ball". You can also apply grep to a data frame version of your table using R or Python, so you can loop over different letter sequences and save the found relationships to a separate column of the data frame or a separate data frame or vector.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.