Text this: Ternary contextualised histogram pattern for curve matching