Text this: Ranks with Respect to a Projective Variety and a Cost-Function