My goal is to add categories if there is a one of specified keywords in title description or both.
I am trying to execute a php script using feeds php tamper module my problem is that I don't know how I should I format term ids...

<?php
$title = $item['jsonpath_parser:1'];
$description = $item['jsonpath_parser:2'];

$keywords = array(
    '1' => array('tags1', 'tag2'),
    '2' => array('tg3','tags','lorem'),
    '3' => array('ipsum', 'dor'),
    '4' => array('set', 'amet'),
    '5' => array('et'),
    '6' => array('ista', 'kulpa', 'la'),
    '7' => array('bora') );

$cat_list = array();

foreach ($keywords as $cat => $tags) {
    foreach ($tags as $key => $tag) {
        if (strpos($title, $tag) !== false && strpos($description, $tag) !== false) {
            array_push($cat_list, $cat);
        }
    }
}

return implode(',', $cat_list);
?>