The subroutine ruleindexps takes a sentence and a ruleset as arguments and returns as value an array of all rules in the rule set indexed on the primary operator of the specified sentence.